:root {
  --ink: #153b36;
  --ink-soft: #45635f;
  --teal: #087a72;
  --teal-dark: #075a55;
  --teal-pale: #e5f5f1;
  --orange: #ef6b46;
  --orange-dark: #cf4d2d;
  --paper: #fbfbf8;
  --sand: #f3f0e8;
  --line: #d8e3df;
  --white: #ffffff;
  --shadow: 0 20px 50px rgba(20, 56, 51, 0.1);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0, rgba(219, 238, 230, 0.72), transparent 27rem),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: -3rem;
  left: 1rem;
  padding: 0.65rem 0.9rem;
  color: var(--white);
  background: var(--teal-dark);
  border-radius: 0 0 0.5rem 0.5rem;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 3rem));
  min-height: 86px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(21, 59, 54, 0.11);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.03rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  color: var(--ink-soft);
  font-size: 0.94rem;
  font-weight: 700;
}

.top-nav a {
  position: relative;
  padding: 0.3rem 0;
}

.top-nav a::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  content: "";
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}

.top-nav a:hover::after,
.top-nav a:focus-visible::after {
  transform: scaleX(1);
}

.hero,
.learning-section,
.guide-section {
  width: min(1180px, calc(100% - 3rem));
  margin-right: auto;
  margin-left: auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: clamp(3rem, 9vw, 9rem);
  align-items: center;
  min-height: 448px;
  padding: 4.6rem 0 4.3rem;
}

.eyebrow,
.card-kicker {
  margin: 0;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero h1,
.section-heading h2 {
  margin: 0.8rem 0 0;
  color: var(--ink);
  letter-spacing: -0.055em;
}

.hero h1 {
  max-width: 8em;
  font-size: clamp(3.1rem, 6.5vw, 5.35rem);
  line-height: 1.05;
}

.hero-description {
  max-width: 41rem;
  margin: 1.45rem 0 0;
  color: var(--ink-soft);
  font-size: 1.08rem;
  line-height: 1.9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.05rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 48px;
  padding: 0.75rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 0.6rem;
  font-weight: 800;
  line-height: 1.2;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.button-primary {
  color: var(--white);
  background: var(--orange);
  box-shadow: 0 12px 24px rgba(207, 77, 45, 0.2);
}

.button-primary:hover:not(:disabled),
.button-primary:focus-visible {
  background: var(--orange-dark);
}

.button-quiet {
  color: var(--ink);
  background: var(--white);
  border-color: var(--line);
}

.button-quiet:hover:not(:disabled),
.button-quiet:focus-visible {
  color: var(--teal-dark);
  border-color: var(--teal);
  box-shadow: 0 8px 18px rgba(21, 59, 54, 0.08);
}

.text-button {
  padding: 0.7rem 0.25rem;
  color: var(--teal-dark);
  background: transparent;
  border: 0;
  font-weight: 800;
}

.text-button span {
  display: inline-block;
  margin-left: 0.28rem;
  transition: transform 0.18s ease;
}

.text-button:hover span,
.text-button:focus-visible span {
  transform: translateX(0.25rem);
}

.privacy-note {
  margin: 1.15rem 0 0;
  color: #748984;
  font-size: 0.86rem;
}

.hero-progress {
  position: relative;
  overflow: hidden;
  padding: 2rem;
  color: var(--white);
  background: var(--ink);
  border-radius: 1.15rem;
  box-shadow: var(--shadow);
}

.hero-progress::before,
.hero-progress::after {
  position: absolute;
  width: 13rem;
  height: 13rem;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
}

.hero-progress::before {
  top: -7.8rem;
  right: -5.8rem;
}

.hero-progress::after {
  right: -7.5rem;
  bottom: -9rem;
  width: 17rem;
  height: 17rem;
  background: rgba(8, 122, 114, 0.24);
}

.hero-progress > * {
  position: relative;
  z-index: 1;
}

.hero-progress .card-kicker {
  color: #a9d9d1;
}

.today-number {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin-top: 1.1rem;
}

.today-number strong {
  font-size: 4.15rem;
  line-height: 0.95;
  letter-spacing: -0.07em;
}

.today-number span {
  color: #cfe2dd;
  font-weight: 700;
}

.hero-progress > p:not(.card-kicker) {
  margin: 1rem 0 0;
  color: #c8ddd8;
  font-size: 0.92rem;
  line-height: 1.6;
}

.progress-track {
  height: 5px;
  margin: 1.2rem 0 1.35rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: #ffb168;
  border-radius: inherit;
  transition: width 0.3s ease;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.17);
}

.hero-stats div {
  display: grid;
  gap: 0.25rem;
}

.hero-stats span {
  color: #abc6c0;
  font-size: 0.78rem;
}

.hero-stats strong {
  font-size: 1.4rem;
}

.learning-section {
  padding: 4.5rem 0 5rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}

.section-heading h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.13;
}

.next-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0;
  color: var(--teal-dark);
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  font-size: 0.92rem;
  font-weight: 800;
}

.next-button span {
  font-size: 1.15rem;
}

.mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 2rem 0 1.1rem;
  padding-bottom: 0.75rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.mode-tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.85rem;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 0.45rem;
  font-size: 0.92rem;
  font-weight: 800;
}

.mode-tab b {
  min-width: 1.45rem;
  padding: 0.08rem 0.35rem;
  color: inherit;
  background: rgba(21, 59, 54, 0.08);
  border-radius: 99px;
  font-size: 0.72rem;
  text-align: center;
}

.mode-tab:hover,
.mode-tab:focus-visible {
  color: var(--teal-dark);
  background: var(--teal-pale);
}

.mode-tab.is-active {
  color: var(--white);
  background: var(--teal);
}

.mode-tab.is-active b {
  color: var(--teal-dark);
  background: #c6eee7;
}

.learning-grid {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr) 205px;
  gap: 1.15rem;
  align-items: stretch;
}

.study-controls,
.progress-panel {
  padding: 1.35rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 0.95rem;
}

.search-label {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.65rem;
  background: var(--white);
  border: 1px solid #cbd9d4;
  border-radius: 0.55rem;
}

.search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 122, 114, 0.12);
}

.search-box svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: var(--ink-soft);
  stroke-linecap: round;
  stroke-width: 1.9;
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 0.7rem 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 0.86rem;
}

.search-box input::placeholder {
  color: #97aaa5;
}

.control-tip {
  margin: 0.7rem 0 1.5rem;
  color: #718781;
  font-size: 0.78rem;
  line-height: 1.65;
}

.mini-note {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.mini-note-number {
  color: var(--orange);
  font-size: 0.72rem;
  font-weight: 900;
}

.mini-note p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.65;
}

.mini-note strong {
  color: var(--ink);
}

.word-card {
  display: flex;
  flex-direction: column;
  min-height: 470px;
  padding: clamp(1.55rem, 4.2vw, 3.1rem);
  background: var(--white);
  border: 1px solid rgba(8, 122, 114, 0.24);
  border-radius: 1.15rem;
  box-shadow: 0 14px 34px rgba(13, 68, 61, 0.08);
}

.word-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.word-card-topline > p {
  margin: 0;
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 800;
}

.speaker-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.6rem;
  color: var(--teal-dark);
  background: var(--teal-pale);
  border: 1px solid transparent;
  border-radius: 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.speaker-button:hover:not(:disabled),
.speaker-button:focus-visible {
  border-color: #a6d8ce;
  background: #d8f1eb;
}

.speaker-button.is-speaking {
  color: var(--white);
  background: var(--teal);
}

.speaker-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.word-display {
  margin: clamp(2.1rem, 7vw, 4.4rem) 0 2rem;
}

.word-display h3 {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.55rem, 6.4vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1;
}

.word-display p {
  margin: 0.9rem 0 0;
  color: #6d8580;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.03rem;
  letter-spacing: 0.02em;
}

.meaning-panel {
  min-height: 5.6rem;
}

.reveal-button {
  padding: 0.2rem 0 0.45rem;
  color: var(--teal-dark);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed rgba(8, 122, 114, 0.52);
  font-size: 0.9rem;
  font-weight: 800;
}

.reveal-button:hover:not(:disabled),
.reveal-button:focus-visible {
  color: var(--orange-dark);
  border-bottom-color: currentColor;
}

.meaning-content {
  margin-top: 0.9rem;
  padding: 0.95rem 1rem;
  background: #f7faf8;
  border-left: 3px solid #93cec4;
  border-radius: 0 0.45rem 0.45rem 0;
}

.meaning-content p {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.8;
  white-space: pre-line;
}

.start-spelling-button {
  display: block;
  margin-top: 0.8rem;
  padding: 0.38rem 0.68rem;
  color: var(--teal-dark);
  background: #e8f5f1;
  border: 1px solid #b9ded6;
  border-radius: 0.42rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.start-spelling-button:hover:not(:disabled),
.start-spelling-button:focus-visible {
  color: var(--white);
  background: var(--teal);
  border-color: var(--teal);
}

.spelling-check {
  margin-top: auto;
  padding-top: 1.7rem;
}

.spelling-check > label {
  display: block;
  margin-bottom: 0.58rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.spelling-check > label span {
  color: #7e938e;
  font-weight: 500;
}

.spelling-check form {
  display: flex;
  gap: 0.55rem;
}

.spelling-check input {
  flex: 1;
  min-width: 0;
  padding: 0.72rem 0.85rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #cbd9d4;
  border-radius: 0.5rem;
  outline: 0;
}

.spelling-check input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 122, 114, 0.12);
}

.spelling-check input.is-correct {
  border-color: #3ca777;
  background: #f1fcf6;
}

.spelling-check input.is-wrong {
  border-color: #e37b5c;
  background: #fff7f3;
}

.spelling-check form button {
  padding: 0.65rem 0.9rem;
  color: var(--white);
  background: var(--teal);
  border: 1px solid var(--teal);
  border-radius: 0.5rem;
  font-weight: 800;
}

.spelling-check form button:hover:not(:disabled),
.spelling-check form button:focus-visible {
  background: var(--teal-dark);
}

.spell-feedback {
  min-height: 1.25rem;
  margin: 0.55rem 0 0;
  color: #728782;
  font-size: 0.78rem;
  line-height: 1.55;
}

.spell-feedback.is-correct {
  color: #257852;
}

.spell-feedback.is-wrong {
  color: #b24a2f;
}

.action-label {
  margin: 1.45rem 0 -0.7rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.word-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1.45rem;
}

.word-actions .button {
  flex-direction: column;
  gap: 0.18rem;
  min-height: 4.6rem;
  line-height: 1.1;
}

.word-actions .button span {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.82;
}

.button-fuzzy {
  color: #925321;
  background: #fff7ec;
  border-color: #f3c9a7;
}

.button-fuzzy:hover:not(:disabled),
.button-fuzzy:focus-visible {
  color: #764116;
  background: #ffedda;
  border-color: #eaa168;
  box-shadow: 0 8px 18px rgba(146, 83, 33, 0.1);
}

.progress-panel {
  display: flex;
  flex-direction: column;
}

.progress-overview {
  display: grid;
  gap: 0.1rem;
  margin: 1.1rem 0 1.3rem;
}

.progress-overview strong {
  font-size: 3rem;
  letter-spacing: -0.07em;
  line-height: 1;
}

.progress-overview span {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.progress-panel dl {
  display: grid;
  gap: 0.7rem;
  margin: 0;
}

.progress-panel dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.progress-panel dt {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.progress-panel dd {
  margin: 0;
  font-weight: 900;
}

.reset-button {
  margin-top: auto;
  padding: 1.35rem 0 0.1rem;
  color: #869a95;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  font-size: 0.76rem;
  text-align: left;
}

.reset-button:hover,
.reset-button:focus-visible {
  color: var(--orange-dark);
  border-bottom-color: currentColor;
}

.guide-section {
  padding: 4.8rem 0 5.5rem;
  border-top: 1px solid var(--line);
}

.guide-intro {
  max-width: 19rem;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.7;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  min-height: 205px;
  padding: 1.3rem;
  background: var(--sand);
  border-radius: 0.85rem;
}

.steps span {
  color: var(--orange);
  font-size: 0.8rem;
  font-weight: 900;
}

.steps h3 {
  margin: 1.45rem 0 0;
  font-size: 1.1rem;
}

.steps p {
  margin: 0.72rem 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.7;
}

.site-footer {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 2rem;
  width: min(1180px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 1.8rem 0 2.6rem;
  color: #70837f;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  line-height: 1.75;
}

.site-footer p {
  max-width: 46rem;
  margin: 0;
}

.site-footer div {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 0.7rem 1.15rem;
}

.site-footer a {
  color: var(--teal-dark);
  font-weight: 700;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--orange-dark);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(239, 107, 70, 0.42);
  outline-offset: 3px;
}

@media (max-width: 940px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 2.2rem;
  }

  .learning-grid {
    grid-template-columns: 185px minmax(0, 1fr);
  }

  .progress-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem 2rem;
    align-items: end;
  }

  .progress-overview {
    margin: 0.8rem 0 0;
  }

  .progress-panel dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }

  .progress-panel dl div {
    display: grid;
    gap: 0.3rem;
  }

  .reset-button {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0.1rem 0 0;
  }

  .steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .site-header,
  .hero,
  .learning-section,
  .guide-section,
  .site-footer {
    width: min(100% - 2rem, 1180px);
  }

  .site-header {
    min-height: 72px;
  }

  .brand {
    gap: 0.48rem;
    font-size: 0.84rem;
  }

  .brand img {
    width: 34px;
    height: 34px;
  }

  .top-nav {
    gap: 0.85rem;
    font-size: 0.78rem;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    min-height: 0;
    padding: 3rem 0 3.2rem;
  }

  .hero h1 {
    font-size: clamp(3rem, 15vw, 4.1rem);
  }

  .hero-description {
    font-size: 0.98rem;
  }

  .hero-progress {
    max-width: none;
  }

  .section-heading {
    display: grid;
    gap: 1rem;
  }

  .section-heading .next-button {
    justify-self: start;
  }

  .learning-section,
  .guide-section {
    padding-top: 3.4rem;
    padding-bottom: 3.7rem;
  }

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

  .study-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.6rem 1rem;
  }

  .search-label,
  .search-box,
  .control-tip {
    grid-column: 1 / -1;
  }

  .control-tip {
    margin: 0.05rem 0 0.5rem;
  }

  .mini-note {
    margin-top: 0;
  }

  .word-card {
    min-height: 465px;
  }

  .progress-panel {
    display: block;
  }

  .progress-panel dl {
    grid-template-columns: 1fr;
    margin-top: 1.35rem;
  }

  .progress-panel dl div {
    display: flex;
  }

  .reset-button {
    display: inline-block;
    margin-top: 1.1rem;
  }

  .guide-intro {
    max-width: 33rem;
  }

  .site-footer {
    display: grid;
    gap: 1.1rem;
  }
}

@media (max-width: 430px) {
  .top-nav a:nth-child(3) {
    display: none;
  }

  .hero-actions,
  .word-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions .text-button {
    justify-self: start;
  }

  .word-display h3 {
    font-size: 2.75rem;
  }

  .spelling-check form {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .steps li {
    min-height: 0;
  }
}

/* CET4 账户与注册码管理 */
textarea {
  font: inherit;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 1.35rem;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.account-name {
  max-width: 9rem;
  overflow: hidden;
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-login,
.header-logout {
  padding: 0.5rem 0.72rem;
  color: var(--teal-dark);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.header-login:hover,
.header-login:focus-visible,
.header-logout:hover,
.header-logout:focus-visible {
  color: var(--white);
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.admin-link {
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.admin-link:hover,
.admin-link:focus-visible {
  color: var(--orange-dark);
}

.auth-gate {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  overflow-y: auto;
  background: rgba(10, 45, 41, 0.58);
  backdrop-filter: blur(6px);
}

.auth-gate[hidden] {
  display: none;
}

.auth-card {
  width: min(100%, 31.5rem);
  padding: clamp(1.5rem, 4vw, 2.35rem);
  background: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 1.35rem;
  box-shadow: 0 24px 70px rgba(8, 38, 35, 0.28);
}

.auth-card h2,
.admin-card h2 {
  margin: 0.7rem 0 0;
  color: var(--ink);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  letter-spacing: -0.035em;
}

.auth-description,
.admin-card > p:not(.card-kicker):not(.auth-message),
.access-note {
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
  font-size: 0.91rem;
  line-height: 1.75;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.35rem;
  margin: 1.45rem 0 1.25rem;
  background: var(--teal-pale);
  border-radius: 0.8rem;
}

.auth-tab {
  min-height: 2.5rem;
  padding: 0.4rem 0.5rem;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 0.58rem;
  font-size: 0.85rem;
  font-weight: 800;
}

.auth-tab.is-active {
  color: var(--teal-dark);
  background: var(--white);
  box-shadow: 0 4px 12px rgba(8, 74, 68, 0.1);
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-form[hidden] {
  display: none;
}

.field {
  display: grid;
  gap: 0.42rem;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.72rem 0.82rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 0.68rem;
  outline: none;
  font-size: 0.93rem;
  font-weight: 500;
  line-height: 1.45;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field textarea {
  min-height: 10rem;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 122, 114, 0.14);
}

.auth-form .button {
  width: 100%;
  margin-top: 0.2rem;
}

.auth-switch-button {
  justify-self: start;
  margin-top: -0.45rem;
}

.auth-message {
  min-height: 1.35rem;
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.55;
}

.auth-message.is-error {
  color: #b4412b;
}

.auth-message.is-success {
  color: var(--teal-dark);
}

body.auth-locked {
  overflow: hidden;
}

.admin-page {
  width: min(1180px, calc(100% - 3rem));
  min-height: calc(100vh - 250px);
  margin: 0 auto;
  padding: clamp(3.1rem, 7vw, 5.7rem) 0;
}

.admin-hero {
  max-width: 44rem;
  margin-bottom: 2.2rem;
}

.admin-hero h1 {
  margin: 0.8rem 0 0;
  color: var(--ink);
  font-size: clamp(2.25rem, 5vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -0.06em;
}

.admin-hero > p:not(.eyebrow) {
  margin: 1.1rem 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.8;
}

.admin-session-note {
  color: var(--teal-dark) !important;
  font-size: 0.88rem !important;
  font-weight: 800;
}

.admin-card {
  padding: clamp(1.35rem, 3vw, 2rem);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  box-shadow: 0 16px 38px rgba(20, 56, 51, 0.07);
}

.admin-login {
  width: min(100%, 32rem);
}

.admin-denied {
  width: min(100%, 38rem);
}

.admin-denied .button {
  margin-top: 1.3rem;
}
.admin-products {
  margin-bottom: 1.25rem;
  padding: clamp(1.35rem, 3vw, 2rem);
  background: rgba(234, 246, 243, 0.76);
  border: 1px solid rgba(8, 122, 114, 0.2);
  border-radius: 1.15rem;
  box-shadow: 0 16px 38px rgba(20, 56, 51, 0.06);
}

.admin-products-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.25rem;
}

.admin-products-heading h2 {
  margin: 0.7rem 0 0;
  color: var(--ink);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.15;
}

.admin-products-heading > p {
  max-width: 31rem;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.65;
}

.admin-products-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.35rem;
}

.admin-product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.15rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
}

.admin-product-card.is-current {
  border-color: rgba(8, 122, 114, 0.44);
  box-shadow: inset 0 0 0 1px rgba(8, 122, 114, 0.08);
}

.admin-product-type {
  margin: 0;
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 800;
}

.admin-product-card h3 {
  margin: 0.58rem 0 0;
  color: var(--ink);
  font-size: 1.12rem;
  line-height: 1.25;
}

.admin-product-card > p:not(.admin-product-type) {
  margin: 0.65rem 0 1rem;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.62;
}

.admin-product-card .button {
  width: 100%;
  margin-top: auto;
  padding: 0.66rem 0.78rem;
  text-align: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(18rem, 0.86fr) minmax(25rem, 1.4fr);
  gap: 1.25rem;
  align-items: start;
}

.admin-card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.admin-card-heading .text-button {
  flex: 0 0 auto;
  margin-top: -0.3rem;
}

.generated-codes {
  margin-top: 1.25rem;
  padding: 1rem;
  background: #fff7e9;
  border: 1px solid #f2d8a7;
  border-radius: 0.85rem;
}

.generated-codes p {
  margin: 0 0 0.8rem;
  color: #825116;
  font-size: 0.84rem;
  line-height: 1.65;
}

.generated-code-list {
  display: grid;
  gap: 0.55rem;
}

.generated-code-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
}

.generated-code-item input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 2.85rem;
  padding: 0.72rem 0.82rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.81rem;
  letter-spacing: 0.02em;
}

.generated-code-copy {
  min-height: 2.85rem;
  padding: 0.55rem 0.9rem;
}

.admin-code-list {
  min-width: 0;
}

.table-note {
  margin: 0.9rem 0 1rem !important;
  color: var(--ink-soft);
  font-size: 0.81rem !important;
}

.code-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.82rem;
}

.code-table-wrap:focus-visible {
  outline: 3px solid rgba(8, 122, 114, 0.18);
  outline-offset: 2px;
}

.code-table-wrap table {
  width: 100%;
  min-width: 38rem;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.code-table-wrap th,
.code-table-wrap td {
  padding: 0.82rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.code-table-wrap th {
  color: var(--ink-soft);
  background: #f6faf8;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.code-table-wrap tr:last-child td {
  border-bottom: 0;
}

.code-hint {
  max-width: 15rem;
  overflow: hidden;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-status {
  font-weight: 800;
  white-space: nowrap;
}

.code-status.is-ready {
  color: var(--teal-dark);
}

.code-status.is-used {
  color: #7b6652;
}

.code-status.is-expired,
.code-status.is-revoked {
  color: #b4412b;
}

.table-action {
  padding: 0.38rem 0.55rem;
  color: #b4412b;
  background: transparent;
  border: 1px solid rgba(180, 65, 43, 0.35);
  border-radius: 0.48rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.table-action:hover:not(:disabled),
.table-action:focus-visible {
  color: var(--white);
  background: #b4412b;
  border-color: #b4412b;
}

.empty-code-row {
  padding: 2rem !important;
  color: var(--ink-soft);
  text-align: center !important;
}

@media (max-width: 700px) {
  .header-tools {
    gap: 0.65rem;
  }

  .account-actions {
    gap: 0.42rem;
  }

  .header-login,
  .header-logout {
    padding: 0.42rem 0.58rem;
    font-size: 0.73rem;
  }

  .admin-link {
    font-size: 0.73rem;
  }

  .auth-gate {
    align-items: start;
    padding: 1rem;
  }

  .auth-card {
    margin: 1.2rem 0;
  }

  .admin-page {
    width: min(100% - 2rem, 1180px);
  }

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

@media (max-width: 430px) {
  .header-tools {
    gap: 0.45rem;
  }

  .account-name {
    display: none;
  }

  .top-nav {
    gap: 0.55rem;
  }

  .header-login,
  .header-logout {
    padding: 0.4rem 0.5rem;
    font-size: 0.68rem;
  }

  .admin-link {
    font-size: 0.68rem;
  }

  .auth-tabs {
    grid-template-columns: 1fr;
  }

  .admin-card-heading {
    display: grid;
  }

  .admin-card-heading .text-button {
    justify-self: start;
    margin: 0;
  }
}
@media (max-width: 700px) {
  .admin-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .admin-products-heading {
    display: block;
  }

  .admin-products-heading > p {
    margin-top: 0.9rem;
  }

  .admin-products-grid {
    grid-template-columns: 1fr;
  }
}
