:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --bg-accent: #e7ddca;
  --panel: rgba(255, 255, 255, 0.88);
  --text: #1f1b16;
  --muted: #6c6256;
  --line: rgba(31, 27, 22, 0.12);
  --accent: #c6612f;
  --accent-dark: #9f4d24;
  --shadow: 0 24px 50px rgba(55, 36, 19, 0.14);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 36%),
    linear-gradient(160deg, var(--bg), var(--bg-accent));
}

.page {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.hero {
  max-width: 620px;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font: 600 0.78rem/1.2 Arial, sans-serif;
  color: var(--muted);
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(2.6rem, 4vw, 4.4rem);
  line-height: 0.98;
}

.intro {
  margin: 0;
  max-width: 54ch;
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--muted);
}

.panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 22px;
  align-items: stretch;
}

.calculator,
.result-card,
.history-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.stack {
  display: grid;
  gap: 22px;
}

.calculator label {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  font: 600 0.95rem/1.4 Arial, sans-serif;
}

.resolution-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.resolution-row label {
  margin-bottom: 18px;
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 2px),
    calc(100% - 14px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

select:focus,
input:focus {
  outline: 3px solid rgba(198, 97, 47, 0.18);
  border-color: var(--accent);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font: 700 1rem/1 Arial, sans-serif;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  cursor: pointer;
}

button:hover {
  filter: brightness(1.04);
}

.error {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: #9a2f20;
  font: 600 0.92rem/1.4 Arial, sans-serif;
}

.result-card {
  display: grid;
  align-content: center;
  gap: 10px;
}

.result-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font: 600 0.78rem/1.2 Arial, sans-serif;
  color: var(--muted);
}

.result-value {
  margin: 0;
  font-size: clamp(3rem, 8vw, 5.2rem);
  line-height: 0.92;
}

.gauge-block {
  display: grid;
  gap: 10px;
}

.gauge-scale {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  align-items: center;
}

.gauge-segment {
  height: 12px;
  border-radius: 999px;
}

.gauge-bad {
  background: linear-gradient(90deg, #b84c33, #d9784b);
}

.gauge-fair {
  background: linear-gradient(90deg, #cd7d43, #d99c51);
}

.gauge-good {
  background: linear-gradient(90deg, #d7a14b, #e1bc63);
}

.gauge-great {
  background: linear-gradient(90deg, #7ca663, #5f955d);
}

.gauge-retina {
  background: linear-gradient(90deg, #4a8d77, #2f6f7d);
}

.gauge-marker {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--text);
  box-shadow: 0 6px 16px rgba(31, 27, 22, 0.18);
  transform: translate(-50%, -50%);
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font: 700 0.72rem/1 Arial, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gauge-rating {
  margin: 0;
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(198, 97, 47, 0.1);
  color: var(--accent-dark);
  font: 700 0.82rem/1 Arial, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-summary {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.history-label {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font: 600 0.78rem/1.2 Arial, sans-serif;
  color: var(--muted);
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.history-note {
  margin: 0;
  max-width: 34ch;
  color: var(--muted);
  font: 0.95rem/1.5 Arial, sans-serif;
}

.history-badge {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(198, 97, 47, 0.1);
  color: var(--accent-dark);
  font: 700 0.78rem/1 Arial, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.history-list li {
  border-radius: 18px;
}

.history-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  font: 0.95rem/1.5 Arial, sans-serif;
}

.history-item {
  padding: 16px 18px;
  border: 1px solid rgba(31, 27, 22, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 241, 231, 0.92));
  box-shadow: 0 12px 28px rgba(55, 36, 19, 0.08);
}

.history-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.history-item-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 27, 22, 0.06);
  color: var(--muted);
  font: 700 0.72rem/1 Arial, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.history-item-ppi {
  font: 700 1.1rem/1 Georgia, "Times New Roman", serif;
  color: var(--text);
}

.history-item-ppi span {
  font: 700 0.72rem/1 Arial, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.history-item-spec {
  margin: 0 0 4px;
  font: 700 1.1rem/1.3 Georgia, "Times New Roman", serif;
  color: var(--text);
}

.history-item-meta {
  margin: 0;
  color: var(--muted);
  font: 0.9rem/1.45 Arial, sans-serif;
}

.history-item-rating {
  margin: 10px 0 0;
  color: var(--accent-dark);
  font: 700 0.78rem/1.2 Arial, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .page {
    padding: 32px 0 48px;
  }

  .panel {
    grid-template-columns: 1fr;
  }

  .calculator,
  .result-card,
  .history-card {
    padding: 22px;
  }

  .resolution-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .history-head,
  .history-item-top {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 430px) {
  .page {
    width: min(100%, calc(100% - 20px));
    padding: 20px 0 36px;
  }

  h1 {
    font-size: clamp(2rem, 11vw, 2.8rem);
  }

  .intro {
    font-size: 0.98rem;
    line-height: 1.55;
  }

  .calculator,
  .result-card,
  .history-card {
    padding: 18px;
    border-radius: 22px;
  }

  select,
  input,
  button {
    min-height: 48px;
  }

  .result-value {
    font-size: clamp(2.5rem, 16vw, 4rem);
  }

  .gauge-scale {
    gap: 4px;
  }

  .gauge-labels {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    gap: 6px;
  }

  .gauge-rating,
  .history-badge,
  .history-item-tag {
    font-size: 0.7rem;
  }

  .history-item {
    padding: 14px 15px;
  }
}
