@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --bg-deep: #0f1a2d;
  --bg-mid: #153450;
  --bg-soft: #f3f6fb;
  --panel: #ffffff;
  --ink: #152137;
  --muted: #4b5970;
  --line: #d9e0eb;
  --accent: #2b8e8a;
  --accent-strong: #1e6c9f;

  --red: #b2463f;
  --yellow: #d39b1d;
  --green: #4c7c4f;
  --blue: #2d5f93;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 14%, #ffffff26 0, #ffffff00 38%),
    radial-gradient(circle at 85% 6%, #ffd37d2b 0, #ffd37d00 36%),
    linear-gradient(140deg, var(--bg-deep) 0%, var(--bg-mid) 48%, #20475d 100%);
}

.app-shell {
  width: min(1060px, 92vw);
  margin: 2.4rem auto 3rem;
  display: grid;
  gap: 1.1rem;
}

.hero {
  color: #eef4ff;
}

.eyebrow {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.9;
}

.hero h1 {
  margin: 0.35rem 0 0.55rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 4.3vw, 3.1rem);
  line-height: 1.04;
}

.lead {
  margin: 0;
  width: min(760px, 100%);
  color: #e0ebfa;
}

.panel {
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  border: 1px solid #ffffff29;
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow:
    0 16px 38px #09142a4a,
    inset 0 1px 0 #ffffffa1;
  animation: rise-in 420ms ease both;
}

.panel:nth-of-type(2) {
  animation-delay: 70ms;
}

.panel:nth-of-type(3) {
  animation-delay: 120ms;
}

.panel:nth-of-type(4) {
  animation-delay: 170ms;
}

.panel h2 {
  margin: 0 0 0.85rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.3rem;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.8rem;
}

.mode-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  display: grid;
  gap: 0.35rem;
  cursor: pointer;
  background: #fff;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.mode-card:hover {
  transform: translateY(-1px);
}

.mode-card:has(input:checked) {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px #1e6c9f1a;
}

.mode-card input {
  margin: 0;
}

.mode-title {
  font-weight: 700;
}

.mode-copy {
  color: var(--muted);
  font-size: 0.94rem;
}

.words-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.selection-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.word-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.word-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem;
  background: linear-gradient(180deg, #ffffff, #f6f9ff);
  display: grid;
  gap: 0.5rem;
}

.word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.word-label {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.slider-wrap {
  display: grid;
  grid-template-columns: 28px 1fr 42px;
  align-items: center;
  gap: 0.55rem;
}

.scale-end {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.rate-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0 var(--slider-pct, 44%), #dce5f2 var(--slider-pct, 44%) 100%);
  outline: none;
}

.rate-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--accent-strong);
  box-shadow: 0 2px 8px #17345163;
  cursor: pointer;
}

.rate-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--accent-strong);
  box-shadow: 0 2px 8px #17345163;
  cursor: pointer;
}

.slider-value {
  min-width: 32px;
  text-align: center;
  border-radius: 999px;
  padding: 0.2rem 0.35rem;
  font-weight: 700;
  font-size: 0.82rem;
  color: #16325c;
  background: #e9f0fb;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
}

.select-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.select-wrap input {
  width: 16px;
  height: 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 0.68rem 1.1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(120deg, #18489b, #176877);
  color: #fff;
  box-shadow: 0 10px 22px #10376347;
}

.btn-secondary {
  background: #e8edf7;
  color: #122746;
}

.type-output {
  margin: 0.2rem 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.42rem;
}

.type-description {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.order-output {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-weight: 600;
}

.score-bars {
  display: grid;
  gap: 0.58rem;
  margin-top: 0.9rem;
}

.score-row {
  display: grid;
  grid-template-columns: 72px 1fr 68px;
  align-items: center;
  gap: 0.45rem;
}

.track {
  height: 12px;
  border-radius: 999px;
  background: #e8edf3;
  overflow: hidden;
}

.fill {
  height: 100%;
}

.fill.red {
  background: var(--red);
}

.fill.yellow {
  background: var(--yellow);
}

.fill.green {
  background: var(--green);
}

.fill.blue {
  background: var(--blue);
}

.tie-note {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.hidden {
  display: none;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: 94vw;
    margin-top: 1.3rem;
  }

  .words-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .word-list {
    grid-template-columns: 1fr;
  }

  .score-row {
    grid-template-columns: 62px 1fr 54px;
  }
}
