:root {
  --bg: #f4f8f6;
  --card: rgba(255, 255, 255, 0.72);
  --line: rgba(148, 163, 184, 0.35);
  --text: #1f2937;
  --muted: #5b6878;
  --primary: #7cc6ff;
  --accent: #75c98b;
  --app-subtitle-size: clamp(0.72rem, 1.5vw, 0.82rem);
  --lang-toolbar-label-size: clamp(0.6rem, 1.22vw, 0.68rem);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background-color: #eaf2ee;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
    url("https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=1800&q=80");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  -webkit-filter: blur(72px);
  will-change: transform;
}

.bg-blob--uk {
  width: min(78vw, 360px);
  height: min(78vw, 360px);
  top: -14%;
  left: -12%;
  background: radial-gradient(
    circle at 32% 28%,
    rgba(200, 16, 46, 0.2) 0%,
    rgba(1, 33, 105, 0.16) 52%,
    transparent 72%
  );
}

.bg-blob--es {
  width: min(74vw, 340px);
  height: min(74vw, 340px);
  top: -8%;
  right: -14%;
  background: radial-gradient(
    circle at 62% 36%,
    rgba(252, 196, 0, 0.18) 0%,
    rgba(198, 12, 48, 0.13) 48%,
    transparent 70%
  );
}

.bg-blob--mint {
  width: min(62vw, 280px);
  height: min(62vw, 280px);
  top: 6%;
  left: 26%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(124, 198, 255, 0.22) 0%,
    rgba(117, 201, 139, 0.14) 55%,
    transparent 72%
  );
}

@media (max-width: 720px) {
  .bg-blob--uk {
    width: 92vw;
    height: 52vw;
    top: -6%;
    left: -18%;
  }

  .bg-blob--es {
    width: 88vw;
    height: 48vw;
    top: -2%;
    right: -22%;
  }

  .bg-blob--mint {
    width: 76vw;
    height: 40vw;
    top: 10%;
    left: 12%;
  }
}

.page {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  min-height: 100vh;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.card {
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 24px;
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.12), 0 4px 16px rgba(255, 255, 255, 0.3) inset;
}

.app-shell {
  position: relative;
  width: min(1120px, 100%);
  height: auto;
  max-height: calc(100vh - 8px);
  padding: 6px 10px 8px;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  flex-shrink: 0;
}

.lang-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 4px;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.lang-toolbar__group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.lang-toolbar__group--study {
  flex: 1 1 auto;
  min-width: min(100%, 12rem);
}

.lang-toolbar__icon {
  font-size: 0.88rem;
  line-height: 1;
  flex-shrink: 0;
}

.lang-toolbar__label {
  margin: 0;
  font-size: var(--lang-toolbar-label-size);
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  letter-spacing: 0.015em;
}

.lang-toolbar__divider {
  width: 1px;
  height: 1.25em;
  background: rgba(148, 163, 184, 0.45);
  flex-shrink: 0;
  margin: 0 2px;
}

.ui-lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.85);
}

.ui-lang-btn {
  margin: 0;
  border: 0;
  background: transparent;
  color: #334155;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.ui-lang-btn:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.95);
}

.ui-lang-btn.is-active {
  background: rgba(124, 198, 255, 0.42);
  color: #11496b;
  box-shadow: 0 1px 6px rgba(76, 172, 255, 0.18);
}

.study-lang-select--toolbar {
  min-width: 7.5rem;
  max-width: 11rem;
  width: auto;
  flex: 0 1 auto;
  padding: 3px 8px;
  font-size: 0.64rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.app-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
  flex-shrink: 0;
}

.app-header {
  flex: 1;
  min-width: 0;
}

.header-compact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  line-height: 1.2;
}

.header-compact-row h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5.5vw, 2.65rem);
  font-weight: 800;
  color: #19324a;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.header-sep {
  width: 1px;
  height: 0.9em;
  background: rgba(148, 163, 184, 0.55);
  flex-shrink: 0;
}

.header-compact-row .subtitle {
  margin: 0;
  font-size: var(--app-subtitle-size);
  font-weight: 600;
  color: #3d5166;
  white-space: nowrap;
}

.header-lang {
  font-size: clamp(0.65rem, 1.3vw, 0.74rem);
  color: var(--muted);
  white-space: nowrap;
}

.header-lang code {
  font-size: 0.95em;
}

.study-lang-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.study-lang-tab {
  margin: 0;
  border: 0;
  background: transparent;
  color: #334155;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: clamp(0.62rem, 1.2vw, 0.72rem);
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.study-lang-tab:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.65);
}

.study-lang-tab.is-active {
  background: rgba(124, 198, 255, 0.42);
  color: #11496b;
  box-shadow: 0 2px 8px rgba(76, 172, 255, 0.18);
}

.header-status {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: clamp(0.65rem, 1.2vw, 0.72rem);
  font-weight: 600;
  color: #2a4a62;
  background: rgba(124, 198, 255, 0.2);
  border: 1px solid rgba(76, 172, 255, 0.28);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-wrap {
  position: relative;
  flex-shrink: 0;
}

.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  color: #1e3a52;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.settings-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
}

.settings-btn svg {
  width: 20px;
  height: 20px;
}

.settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(280px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

.settings-panel.hidden {
  display: none;
}

.settings-panel h3 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #243243;
}

.settings-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: #3f4e5f;
  cursor: pointer;
}

.settings-panel input {
  accent-color: #4c9eff;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 1 auto;
  min-height: auto;
  overflow: visible;
}

.dashboard-row.cols-2 {
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.55fr);
}

.dashboard-row.cols-2 .panel-block:not(#comparisonCard):not([data-section="result"]) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dashboard-row {
  display: grid;
  gap: 4px;
}

@media (max-width: 820px) {
  .dashboard-row.cols-2 {
    grid-template-columns: 1fr;
  }

  .page {
    align-items: center;
    justify-content: center;
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .app-shell {
    height: auto;
    max-height: none;
    overflow-y: auto;
  }
}

.panel-block {
  margin-top: 0;
}

.panel-block > label,
.panel-block > h2 {
  margin-bottom: 3px;
  font-size: 0.78rem;
}

.panel-block h2 {
  margin-top: 0;
  font-size: 0.88rem;
}

.panel-block.result {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.section-hidden {
  display: none !important;
}

.subtitle {
  margin: 0;
  color: #6b7c8f;
  letter-spacing: 0.02em;
}

.lead {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 58ch;
  line-height: 1.75;
}

.badge {
  display: inline-block;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #205d85;
  border: 1px solid rgba(76, 172, 255, 0.35);
  background: rgba(124, 198, 255, 0.22);
}

.input-block {
  margin-top: 0;
}

label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  color: #233244;
  font-size: 0.78rem;
}

.compose-text-wrap {
  position: relative;
}

.compose-word-count {
  position: absolute;
  right: 10px;
  bottom: 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
  line-height: 1;
  opacity: 0.88;
}

textarea,
#referenceText {
  width: 100%;
  padding: 10px 58px 28px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  font-size: clamp(1rem, 2.4vw, 1.0625rem);
  line-height: 1.5;
  resize: none;
  min-height: 3.25em;
  max-height: none;
  height: auto;
  overflow: hidden;
  field-sizing: content;
}

.recorder {
  margin-top: 0;
}

.recorder-compact .status {
  margin: 2px 0 0;
  font-size: 12px;
}

.recorder-compact .meta {
  margin-top: 2px;
  font-size: 10px;
}

select {
  width: 100%;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.controls.dense .btn {
  padding: 6px 10px;
  font-size: 12px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: 0.18s ease;
}

.btn.is-playing {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.45);
  color: #9f1239;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--primary);
  color: #11496b;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.75);
  border-color: var(--line);
  color: var(--text);
}

.btn.accent {
  background: var(--accent);
  color: #1d5130;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.status {
  margin: 12px 0;
  color: #3f4e5f;
}

.result {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.hidden {
  display: none;
}

.recognized {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.88);
  line-height: 1.4;
  min-height: 36px;
  font-size: 12px;
  max-height: 52px;
  overflow-y: auto;
}

.meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

h2 {
  color: #243243;
}

#feedbackList {
  margin: 12px 0 0;
  padding-left: 18px;
}


.comparison-hero > h2 {
  font-size: 0.95rem;
  font-weight: 700;
}

.accuracy-block {
  margin-bottom: 4px;
  flex-shrink: 0;
}

.accuracy-head {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #2a4058;
}

.accuracy-head span {
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  font-weight: 700;
  color: #11496b;
  letter-spacing: -0.02em;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #75c98b, #7cc6ff);
  transition: width 0.35s ease;
}

.overlay-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  padding: 10px;
}

.base-layer,
.highlight-layer {
  margin: 0;
  line-height: 1.65;
  font-size: clamp(0.82rem, 1.35vw, 0.92rem);
  word-break: break-word;
}

.base-layer {
  color: rgba(31, 41, 55, 0.42);
}

.highlight-layer {
  position: absolute;
  inset: 10px;
  color: transparent;
}

.token {
  display: inline-block;
  margin-right: 4px;
  margin-bottom: 4px;
  padding: 2px 5px;
  border-radius: 6px;
  font-weight: 500;
}

.token.exact {
  background: rgba(34, 197, 94, 0.35);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.65);
}

.token.near {
  background: rgba(250, 204, 21, 0.35);
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.7);
}

.token.miss {
  background: rgba(239, 68, 68, 0.35);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.7);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  flex-shrink: 0;
}

.sample-block .cefr-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.sample-block .cefr-tab {
  flex: 1 1 auto;
  min-width: 5rem;
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.55);
  color: #1f2937;
  border-radius: 8px;
  padding: 4px 8px;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sample-block .cefr-tab:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.sample-block .cefr-tab.is-active {
  background: rgba(124, 198, 255, 0.35);
  border-color: rgba(76, 172, 255, 0.55);
  color: #11496b;
  box-shadow: 0 4px 14px rgba(76, 172, 255, 0.2);
}

.sample-block .sample-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.sample-block .sample-row select {
  flex: 1 1 180px;
  min-width: 0;
}

.sample-block .sample-random {
  flex: 0 0 auto;
  white-space: nowrap;
}

.compose-ocr-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 4px;
  margin-bottom: 2px;
}

.ocr-import-btn {
  width: 100%;
  min-width: 0;
  justify-content: center;
  padding-inline: 8px;
  font-size: 11px;
  line-height: 1.25;
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(148, 163, 184, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.compose-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 5px;
  margin-top: 5px;
}

.grammar-compact h2 {
  font-size: 0.88rem;
}

.grammar-compact .recognized {
  max-height: 56px;
  line-height: 1.55;
}

.grammar-compact #grammarExplainList {
  margin: 4px 0 0;
  padding-left: 14px;
  font-size: 10.5px;
  line-height: 1.35;
  max-height: min(28vh, 108px);
  overflow-y: auto;
  color: #465466;
}

.grammar-compact #grammarExplainList .grammar-tip-item {
  margin: 0 0 4px;
  padding-left: 2px;
}

.grammar-compact #grammarExplainList .grammar-tip-item:last-child {
  margin-bottom: 0;
}

.grammar-compact #grammarExplainList .grammar-tip-english {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed rgba(148, 163, 184, 0.45);
  color: #334155;
  line-height: 1.55;
}

.grammar-tip-english-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #0369a1;
}

.grammar-save-btn {
  width: 100%;
  margin-top: 6px;
  font-size: 13px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(148, 163, 184, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.grammar-save-btn:disabled {
  opacity: 0.5;
}

.grammar-compact.grammar-flash {
  animation: grammarFlash 0.65s ease;
}

@keyframes grammarFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(124, 198, 255, 0.45);
  }
  100% {
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.12), 0 4px 16px rgba(255, 255, 255, 0.3) inset;
  }
}

.grammar-history {
  margin-top: 4px;
  flex-shrink: 0;
}

.grammar-history-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 12px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #233244;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.grammar-history-count {
  min-width: 1.4em;
  text-align: center;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.72rem;
  background: rgba(124, 198, 255, 0.25);
  color: #1e3a5f;
}

.grammar-history-panel {
  margin-top: 4px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 4px 6px;
}

.grammar-history-panel.hidden {
  display: none;
}

.grammar-history-empty {
  margin: 4px 2px 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.grammar-history-empty.hidden {
  display: none;
}

.grammar-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 132px;
  overflow-y: auto;
}

.grammar-history-item {
  display: flex;
  align-items: stretch;
  gap: 4px;
  margin-bottom: 4px;
}

.grammar-history-item:last-child {
  margin-bottom: 2px;
}

.grammar-history-restore {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  padding: 5px 8px;
  text-align: left;
  cursor: pointer;
}

.grammar-history-restore:hover {
  background: rgba(255, 255, 255, 0.92);
}

.grammar-history-date {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 2px;
}

.grammar-history-preview {
  display: block;
  font-size: 11px;
  color: #1f2937;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grammar-history-delete {
  flex: 0 0 auto;
  width: 28px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 9px;
  background: rgba(254, 226, 226, 0.65);
  color: #b91c1c;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.grammar-history-delete:hover {
  background: rgba(254, 202, 202, 0.9);
}

#grammarCorrectedText .grammar-change {
  color: #b71c1c;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.22);
  border-radius: 4px;
  padding: 1px 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.panel-block.sample-block,
.panel-block[data-section="compose"],
.panel-block.grammar-compact,
.panel-block.grammar-history {
  flex-shrink: 0;
}

.dashboard-row.results-row [data-section="result"] h2,
.comparison-hero > h2 {
  font-size: 0.82rem;
  margin-bottom: 2px;
}

.dashboard-row.results-row [data-section="result"] .recognized {
  font-size: 12px;
  line-height: 1.4;
  padding: 6px 8px;
}

.dashboard-row.results-row #comparisonCard .base-layer,
.dashboard-row.results-row #comparisonCard .highlight-layer {
  font-size: 12px;
  line-height: 1.4;
}

/* 判定結果エリア全体: 枠内スクロール禁止・内容の高さまで伸長 */
.dashboard-row.results-row {
  flex: 0 1 auto;
  min-height: auto;
  max-height: none;
  height: auto;
  overflow: visible;
  align-items: start;
}

.dashboard-row.results-row [data-section="result"],
.dashboard-row.results-row [data-section="result"] .recognized,
.dashboard-row.results-row #comparisonCard,
.dashboard-row.results-row #comparisonCard .accuracy-block,
.dashboard-row.results-row #comparisonCard .overlay-wrap,
.dashboard-row.results-row #comparisonCard .legend,
.dashboard-row.results-row #comparisonCard .base-layer,
.dashboard-row.results-row #comparisonCard .highlight-layer {
  max-height: none;
  min-height: auto;
  height: auto;
  overflow: visible;
}

.dashboard-row.results-row [data-section="result"].panel-block,
.dashboard-row.results-row #comparisonCard.panel-block {
  display: block;
  flex: none;
  align-self: start;
}

.dashboard-row.results-row #comparisonCard .overlay-wrap {
  position: relative;
}

@media (max-width: 720px) {
  .lang-toolbar {
    gap: 4px 8px;
    padding: 4px 6px;
  }

  .lang-toolbar__divider {
    display: none;
  }

  .lang-toolbar__group {
    flex: 1 1 calc(50% - 4px);
  }

  .lang-toolbar__group--study {
    flex: 1 1 100%;
  }

  .study-lang-select--toolbar {
    max-width: none;
    flex: 1 1 auto;
  }

  .header-compact-row .subtitle,
  .header-lang {
    white-space: normal;
  }

  .header-status {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }
}

.chip {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.chip.exact {
  background: rgba(34, 197, 94, 0.2);
}

.chip.near {
  background: rgba(250, 204, 21, 0.22);
}

.chip.miss {
  background: rgba(239, 68, 68, 0.22);
}

body.gate-locked {
  overflow: hidden;
}

.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.gate-overlay.hidden {
  display: none;
}

.gate-card {
  width: min(360px, 100%);
  padding: 28px 24px 22px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18), 0 2px 12px rgba(255, 255, 255, 0.45) inset;
  text-align: center;
}

.gate-card h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  color: #19324a;
}

.gate-card p {
  margin: 0 0 18px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.gate-code-input {
  width: 100%;
  max-width: 200px;
  margin: 0 auto 14px;
  display: block;
  text-align: center;
  letter-spacing: 0.45em;
  font-size: 1.6rem;
  font-weight: 700;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(255, 255, 255, 0.92);
  color: #1e293b;
}

.gate-code-input:focus {
  outline: none;
  border-color: rgba(124, 198, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(124, 198, 255, 0.25);
}

.gate-submit-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 28px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7cc6ff, #75c98b);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(124, 198, 255, 0.35);
}

.gate-submit-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.gate-error {
  margin: 12px 0 0;
  font-size: 0.82rem;
  color: #dc2626;
  min-height: 1.2em;
}

.admin-code-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 2100;
  transform: translate(-50%, -12px);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(25, 50, 74, 0.88);
  color: #f8fafc;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.admin-code-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.admin-code-toast.hidden {
  display: none;
}

/* Admin page */
.admin-page {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 10px 12px;
}

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

.admin-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  margin-bottom: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.admin-top-bar__brand {
  min-width: 0;
}

.admin-top-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.admin-settings-unlock {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.admin-settings-password {
  width: 4.5rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.78rem;
  color: #19324a;
}

.admin-settings-unlock-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(14, 165, 233, 0.35);
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.74rem;
  font-weight: 700;
  color: #0369a1;
  cursor: pointer;
}

.admin-settings-unlock-btn:hover {
  background: rgba(224, 242, 254, 0.95);
}

.admin-settings-lock-message {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.72rem;
  color: #b91c1c;
}

.admin-settings-lock-message.hidden {
  display: none;
}

.admin-settings-gated {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.admin-settings-gated.hidden {
  display: none;
}

.admin-page-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #19324a;
  letter-spacing: 0.01em;
}

.admin-dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: start;
}

.admin-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08), 0 1px 6px rgba(255, 255, 255, 0.5) inset;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.admin-card--span-2 {
  grid-column: span 2;
}

.admin-card--span-full {
  grid-column: 1 / -1;
}

.admin-eyebrow {
  display: none;
}

.admin-card__title,
.admin-card h1,
.admin-card h2 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  color: #19324a;
  line-height: 1.25;
}

.admin-lead {
  margin: 0;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.35;
}

.admin-lead code {
  font-size: 0.66rem;
}

.admin-lock-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  margin-top: 2px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(255, 255, 255, 0.55);
}

.admin-lock-status {
  min-width: 0;
}

.admin-lock-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 800;
  color: #19324a;
}

.admin-lock-hint {
  display: block;
  margin-top: 1px;
  font-size: 0.64rem;
  color: var(--muted);
  line-height: 1.3;
}

.admin-toggle {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  cursor: pointer;
}

.admin-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.admin-toggle-track {
  display: inline-flex;
  align-items: center;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.45);
  transition: background 0.25s ease;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.12);
}

.admin-toggle-thumb {
  width: 20px;
  height: 20px;
  margin-left: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  transition: transform 0.25s ease, background 0.25s ease;
}

.admin-toggle input:checked + .admin-toggle-track {
  background: linear-gradient(135deg, #7cc6ff, #75c98b);
}

.admin-toggle input:checked + .admin-toggle-track .admin-toggle-thumb {
  transform: translateX(20px);
}

.admin-toggle input:focus-visible + .admin-toggle-track {
  outline: 2px solid rgba(124, 198, 255, 0.65);
  outline-offset: 2px;
}

.admin-meta {
  margin: 2px 0 0;
  font-size: 0.66rem;
  color: #475569;
}

.admin-meta strong {
  letter-spacing: 0.2em;
  color: #19324a;
}

.admin-status {
  margin: 0;
  min-height: 1.1em;
  font-size: 0.74rem;
  font-weight: 700;
  color: #0369a1;
}

.admin-back-link {
  font-size: 0.76rem;
  font-weight: 700;
  color: #0369a1;
  text-decoration: none;
  white-space: nowrap;
}

.admin-back-link:hover {
  text-decoration: underline;
}

.admin-mode-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.admin-mode-legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-mode-options {
  display: grid;
  gap: 4px;
  margin-bottom: 2px;
}

.admin-mode-options--grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-mode-options--compact {
  margin-bottom: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.admin-mode-option:hover {
  border-color: rgba(14, 165, 233, 0.45);
  background: rgba(255, 255, 255, 0.72);
}

.admin-mode-option input {
  margin-top: 3px;
  accent-color: #0284c7;
  flex-shrink: 0;
}

.admin-mode-option:has(input:checked) {
  border-color: rgba(2, 132, 199, 0.55);
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.18), 0 10px 24px rgba(14, 165, 233, 0.12);
  background: rgba(240, 249, 255, 0.82);
}

.admin-mode-option-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-mode-option-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #19324a;
}

.admin-mode-option-desc {
  font-size: 0.66rem;
  color: var(--muted);
  line-height: 1.35;
}

.admin-ai-hint {
  margin: 4px 0 0;
}

.admin-lang-options {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
}

.admin-lang-options--grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-lang-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 700;
  color: #19324a;
}

.admin-lang-option input {
  accent-color: #0284c7;
}

.admin-lang-option:has(input:checked) {
  border-color: rgba(2, 132, 199, 0.55);
  background: rgba(240, 249, 255, 0.82);
}

.admin-link-gen-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 6px;
}

.admin-link-gen-form {
  display: grid;
  gap: 5px;
}

.admin-link-gen-field {
  display: grid;
  gap: 3px;
}

.admin-card__title-en {
  font-size: 0.82em;
  font-weight: 700;
  color: #64748b;
}

.admin-select-field {
  display: grid;
  gap: 3px;
  margin-top: 2px;
}

.admin-select-field-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #334155;
}

.admin-lang-dropdown {
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.88);
  overflow: hidden;
}

.admin-lang-dropdown-summary {
  position: relative;
  padding: 6px 28px 6px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #19324a;
  cursor: pointer;
  list-style: none;
  line-height: 1.35;
}

.admin-lang-dropdown-summary::after {
  content: "▾";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: #64748b;
}

.admin-lang-dropdown[open] .admin-lang-dropdown-summary::after {
  content: "▴";
}

.admin-lang-dropdown-summary::-webkit-details-marker {
  display: none;
}

.admin-lang-dropdown[open] .admin-lang-dropdown-summary {
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.admin-lang-checklist {
  display: grid;
  gap: 2px;
  padding: 4px;
}

.admin-lang-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  color: #19324a;
}

.admin-lang-check:hover {
  background: rgba(240, 249, 255, 0.7);
}

.admin-lang-check:has(input:checked) {
  background: rgba(224, 242, 254, 0.85);
}

.admin-lang-check input {
  accent-color: #0284c7;
  flex-shrink: 0;
}

.admin-lang-save-btn {
  margin-top: 4px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(14, 165, 233, 0.35);
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.74rem;
  font-weight: 700;
  color: #0369a1;
  cursor: pointer;
}

.admin-lang-save-btn:hover:not(:disabled) {
  background: rgba(224, 242, 254, 0.95);
}

.admin-lang-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.admin-card--compact {
  gap: 3px;
  padding: 6px 8px;
}

.admin-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.admin-lock-panel--inline {
  flex: 1 1 12rem;
  margin-top: 0;
}

.admin-meta--inline {
  margin: 0;
  white-space: nowrap;
}

.admin-mode-options--stack {
  grid-template-columns: 1fr;
  margin-bottom: 0;
}

.admin-settings-gated > .admin-card--span-2 {
  grid-column: 1 / -1;
}

.admin-mode-options--ai {
  margin-bottom: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-mode-option--rated .admin-mode-option-body {
  gap: 2px;
}

.admin-mode-option--rated .admin-mode-option-title {
  font-size: 0.7rem;
  line-height: 1.2;
}

.admin-mode-ratings {
  display: grid;
  gap: 2px;
}

.admin-mode-rating-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.admin-mode-rating-label {
  flex: 0 0 2.1rem;
  font-size: 0.56rem;
  font-weight: 700;
  color: #64748b;
  line-height: 1;
}

.admin-mode-rating-bar {
  display: flex;
  flex: 1;
  gap: 2px;
  min-width: 2.75rem;
}

.admin-mode-rating-seg {
  flex: 1;
  min-width: 3px;
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
}

.admin-mode-rating-seg.is-filled {
  background: linear-gradient(90deg, #7cc6ff, #75c98b);
}

.admin-card--tts {
  gap: 3px;
  padding: 6px 8px;
  height: 100%;
}

.admin-tts-panel {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 0;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.88);
}

.admin-tts-spacer {
  margin-top: 4px;
  min-height: calc(0.74rem + 12px);
  flex-shrink: 0;
}

.admin-tts-status {
  flex: 1;
  min-width: 0;
  font-size: 0.66rem;
  font-weight: 700;
  color: #475569;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-mode-option--compact {
  padding: 4px 6px;
  gap: 5px;
}

.admin-mode-option--compact .admin-mode-option-title {
  font-size: 0.72rem;
}

.admin-mode-option--compact .admin-mode-option-desc {
  font-size: 0.62rem;
}

.admin-card--row1 {
  justify-content: flex-start;
  align-self: stretch;
}

.admin-card--row1 .admin-card-row {
  flex: 1;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.admin-card--row1 .admin-lock-panel--inline {
  flex: none;
  width: 100%;
}

.admin-card--row1 .admin-ui-lang-row {
  flex: 1;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.admin-card--row1 .admin-ui-lang-chip {
  justify-content: flex-start;
  width: 100%;
}

.admin-card--row1 .admin-section-chips {
  flex: 1;
  align-content: flex-start;
}

.admin-ui-lang-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.admin-ui-lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.66rem;
  font-weight: 700;
  color: #19324a;
  cursor: pointer;
  white-space: nowrap;
}

.admin-ui-lang-chip input {
  accent-color: #0284c7;
  flex-shrink: 0;
}

.admin-ui-lang-chip:has(input:checked) {
  border-color: rgba(2, 132, 199, 0.55);
  background: rgba(224, 242, 254, 0.85);
}

.admin-section-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.admin-section-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.66rem;
  font-weight: 700;
  color: #19324a;
  cursor: pointer;
  white-space: nowrap;
}

.admin-section-chip input {
  accent-color: #0284c7;
  flex-shrink: 0;
}

.admin-section-chip:has(input:checked) {
  border-color: rgba(2, 132, 199, 0.55);
  background: rgba(224, 242, 254, 0.85);
}

.admin-link-gen-form--inline {
  display: contents;
}

.admin-link-gen-row .admin-link-gen-field {
  flex: 0 0 6.5rem;
  min-width: 0;
}

.admin-link-gen-row .admin-link-gen-copy-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.admin-link-gen-preview--inline {
  flex: 1 1 0;
  min-width: 0;
  max-width: 16rem;
  margin: 0;
}

.admin-card-select {
  margin-top: 2px;
}

.admin-link-gen-field-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #334155;
}

.admin-link-gen-select {
  width: 100%;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.88);
  font-size: 0.72rem;
  font-weight: 700;
  color: #19324a;
  cursor: pointer;
}

.admin-link-gen-select:focus-visible {
  outline: 2px solid rgba(124, 198, 255, 0.65);
  outline-offset: 2px;
}

.admin-link-gen-preview-wrap {
  display: grid;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.55);
}

.admin-link-gen-preview-label {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
}

.admin-link-gen-preview {
  display: block;
  margin: 0;
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px dashed rgba(148, 163, 184, 0.55);
  background: rgba(248, 250, 252, 0.9);
  font-size: 0.68rem;
  line-height: 1.4;
  word-break: break-all;
  color: #0f4c75;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.admin-link-gen-copy-btn {
  justify-self: start;
  margin: 0;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #7cc6ff, #75c98b);
  color: #0f2f46;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(76, 172, 255, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.admin-link-gen-copy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(76, 172, 255, 0.28);
}

.admin-link-gen-copy-btn:focus-visible {
  outline: 2px solid rgba(124, 198, 255, 0.75);
  outline-offset: 2px;
}

.admin-link-gen-toast {
  margin: 6px 0 0;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #166534;
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.admin-link-gen-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-link-gen-toast.hidden {
  display: none;
}

@media (max-width: 1024px) {
  .admin-dashboard,
  .admin-settings-gated {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-card--span-2 {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .admin-page {
    padding: 10px 10px 16px;
  }

  .admin-top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-top-bar__actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-dashboard,
  .admin-settings-gated {
    grid-template-columns: 1fr;
  }

  .admin-card--span-2,
  .admin-card--span-full {
    grid-column: span 1;
  }

  .admin-mode-options--grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .admin-link-gen-row {
    flex-wrap: wrap;
  }

  .admin-link-gen-preview--inline {
    flex: 1 1 100%;
    max-width: none;
  }
}

.study-lang-select-wrap {
  display: inline-flex;
  align-items: center;
}

.study-lang-select {
  min-width: 9.5rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.72);
  color: #19324a;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.study-lang-select:focus-visible {
  outline: 2px solid rgba(2, 132, 199, 0.45);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pronunciation-advice-btn {
  margin: 0 0 10px;
  width: 100%;
}

.pronunciation-advice {
  margin: 10px 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pronunciation-advice-label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #0369a1;
}

.pronunciation-advice-text {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #19324a;
  white-space: pre-wrap;
}

.pronunciation-advice-en-label {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(148, 163, 184, 0.45);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #0369a1;
}

.pronunciation-advice-en {
  display: block;
  margin-top: 4px;
  color: #334155;
}

.pronunciation-advice.is-loading .pronunciation-advice-text {
  color: var(--muted);
  font-style: italic;
}

.dashboard-row.results-row #comparisonCard .pronunciation-advice {
  flex-shrink: 0;
}

/* Splash screen (startup motion — matches Vibe Speak News intro) */
@keyframes splashIntroFade {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  28% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  78% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px) scale(1.02);
  }
}

@keyframes splashOrbFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -12px, 0);
  }
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1.5rem;
  background: linear-gradient(to bottom right, #f0f9ff, #ffffff, #ecfdf5);
  pointer-events: auto;
}

.splash-screen__bg {
  position: absolute;
  inset: 0;
  transform: scale(1.1);
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
    url("https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=1800&q=80");
  background-size: cover;
  background-position: center;
}

.splash-screen__veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.splash-screen__veil--1 {
  background: linear-gradient(
    to bottom right,
    rgba(255, 255, 255, 0.7),
    rgba(240, 249, 255, 0.55),
    rgba(236, 253, 245, 0.65)
  );
}

.splash-screen__veil--2 {
  background: rgba(255, 255, 255, 0.2);
}

.splash-vibe-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(64px);
  -webkit-filter: blur(64px);
  animation: splashOrbFloat 2.8s ease-in-out infinite;
}

.splash-vibe-orb--left {
  top: 3.5rem;
  left: -4rem;
  width: 12rem;
  height: 12rem;
  background: rgba(186, 230, 253, 0.45);
}

.splash-vibe-orb--right {
  right: -3rem;
  bottom: 4rem;
  width: 14rem;
  height: 14rem;
  background: rgba(167, 243, 208, 0.45);
  animation-delay: 0.35s;
}

.splash-intro-card {
  position: relative;
  z-index: 1;
  text-align: center;
  animation: splashIntroFade 2.1s ease both;
}

.splash-intro-glass-label {
  margin: 0 0 0.5rem;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(13, 148, 136, 0.88);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 8px rgba(255, 255, 255, 0.25);
}

.splash-intro-glass-logo {
  margin: 0;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: clamp(2.25rem, 8vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  background: linear-gradient(
    168deg,
    rgba(56, 189, 248, 0.82) 0%,
    rgba(3, 105, 161, 0.96) 30%,
    rgba(15, 118, 110, 0.98) 62%,
    rgba(4, 120, 87, 1) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 0.3px rgba(255, 255, 255, 0.22);
  paint-order: stroke fill;
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.45))
    drop-shadow(0 4px 14px rgba(14, 116, 144, 0.2))
    drop-shadow(0 1px 3px rgba(3, 105, 161, 0.15));
}

.splash-intro-glass-sub {
  margin: 0.75rem 0 0;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(100, 116, 139, 0.92);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5),
    0 0 6px rgba(255, 255, 255, 0.2);
}

.splash-screen.hidden {
  display: none;
}

.splash-screen.is-hiding {
  pointer-events: none;
}

body.splash-active .page,
body.splash-active .bg-blobs {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .splash-screen {
    display: none !important;
  }

  body.splash-active .page,
  body.splash-active .bg-blobs {
    visibility: visible;
  }
}
