:root {
  --bg: #eef3fb;
  --panel: rgba(252, 253, 255, 0.94);
  --ink: #0a235c;
  --muted: #5f6f95;
  --accent: #0d2f84;
  --accent-dark: #081f57;
  --line: rgba(10, 35, 92, 0.12);
  --success: #134d96;
  --danger: #b42318;
  --shadow: 0 28px 90px rgba(10, 35, 92, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(13, 47, 132, 0.16), transparent 24%),
    radial-gradient(circle at top right, rgba(73, 130, 255, 0.12), transparent 30%),
    linear-gradient(145deg, #eef3fb, #fbfcff 48%, #e6edf8);
}

.app-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  max-width: 920px;
}

.login-card-shell {
  max-width: 720px;
  margin: 0 auto;
}

.login-brand {
  display: grid;
  gap: 20px;
  align-items: center;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
}

.login-form {
  margin: 0;
  min-width: min(100%, 360px);
}

.login-submit {
  width: 100%;
  margin-top: 6px;
}

.page-header {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 22px;
  max-width: 860px;
}

.brand-logo {
  width: clamp(220px, 34vw, 420px);
  height: auto;
  display: block;
}

.brand-copy {
  max-width: 360px;
}

.brand-summary {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.eyebrow,
.section-tag,
.status-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--muted);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 0.98;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-top: 10px;
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
}

h3 {
  font-size: 1.45rem;
  margin-top: 10px;
}

.hero-copy,
.entry-copy,
.admin-summary {
  color: var(--muted);
  line-height: 1.6;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-stat {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
}

.result-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 8px;
}

.result-stat strong,
.timer-wrap strong {
  font-size: 1.05rem;
}

.main-panel {
  min-width: 0;
}

.card {
  padding: 28px;
}

.card-head {
  max-width: 720px;
}

.card.hidden,
.hidden {
  display: none;
}

.card.active {
  display: block;
}

.entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 720px);
  margin-top: 22px;
}

.entry-card {
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 248, 255, 0.98));
  border: 1px solid var(--line);
}

.rules-panel {
  margin: 18px 0 8px;
  padding: 18px 18px 18px 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(13, 47, 132, 0.08), rgba(13, 47, 132, 0.02));
  border: 1px solid var(--line);
}

.rules-title {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

.rules-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.rules-list li + li {
  margin-top: 8px;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  font-size: 0.88rem;
  color: var(--muted);
}

.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  background: rgba(255, 255, 255, 0.9);
  margin-bottom: 12px;
  color: var(--ink);
}

.text-input:focus {
  outline: 2px solid rgba(13, 47, 132, 0.2);
  border-color: rgba(13, 47, 132, 0.4);
}

.inline-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 0.88rem;
  margin: 2px 0 12px;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 16px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.primary-button {
  background: var(--accent);
  color: #f7faff;
}

.primary-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.secondary-button {
  background: rgba(10, 35, 92, 0.06);
  color: var(--ink);
}

.secondary-button:hover {
  background: rgba(10, 35, 92, 0.1);
}

.quiet-button {
  padding: 10px 14px;
  background: rgba(10, 35, 92, 0.05);
  color: var(--muted);
}

.quiet-button:hover {
  background: rgba(10, 35, 92, 0.1);
  color: var(--ink);
}

.admin-menu {
  position: relative;
  flex: 0 0 auto;
  z-index: 30;
}

.admin-menu summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(10, 35, 92, 0.08);
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.admin-menu[open] summary {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.admin-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  width: min(280px, calc(100vw - 48px));
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(252, 254, 253, 0.97);
  box-shadow: 0 18px 50px rgba(10, 35, 92, 0.16);
}

.admin-input {
  margin-bottom: 8px;
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.timer-wrap {
  text-align: right;
}

.progress-track {
  margin: 18px 0 24px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.08);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d2f84, #4c79df);
  transition: width 180ms ease;
}

.question-text {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  line-height: 1.35;
  margin-bottom: 18px;
}

.question-visual {
  font-family: "Courier New", monospace;
  white-space: pre-wrap;
  background: rgba(10, 35, 92, 0.04);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 18px;
  min-height: 72px;
}

.question-visual:empty {
  display: none;
}

.options {
  display: grid;
  gap: 12px;
}

.option {
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.option:hover {
  transform: translateY(-1px);
  border-color: rgba(13, 47, 132, 0.45);
}

.option.selected {
  background: rgba(13, 47, 132, 0.12);
  border-color: rgba(13, 47, 132, 0.65);
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
}

.result-stat.emphasis {
  background: linear-gradient(135deg, rgba(13, 47, 132, 0.14), rgba(255, 255, 255, 0.82));
}

.breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.breakdown-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
}

.breakdown-card strong,
.result-note strong {
  display: block;
  margin-bottom: 8px;
}

.result-note {
  margin-top: 20px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(10, 35, 92, 0.05);
  color: var(--muted);
  line-height: 1.7;
}

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

.conversation-status {
  margin-top: 22px;
}

.conversation-thread {
  display: grid;
  gap: 12px;
  margin: 22px 0;
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(232, 238, 251, 0.72), rgba(246, 249, 255, 0.94));
  border: 1px solid var(--line);
}

.chat-bubble {
  max-width: 82%;
  padding: 14px 16px;
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(10, 35, 92, 0.08);
}

.chat-bubble p {
  margin: 6px 0 0;
  line-height: 1.5;
}

.user-a {
  justify-self: start;
  background: #ffffff;
  border: 1px solid rgba(10, 35, 92, 0.08);
}

.user-b {
  justify-self: end;
  background: rgba(34, 136, 92, 0.16);
  border: 1px solid rgba(34, 136, 92, 0.24);
}

.current-line {
  outline: 2px solid rgba(34, 136, 92, 0.28);
}

.chat-author,
.chat-meta {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-meta {
  margin-top: 10px;
}

.speech-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--speech-badge-bg);
  border: 1px solid var(--speech-badge-border);
  color: var(--speech-badge-text);
}

.record-panel {
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 247, 255, 0.95));
}

.mic-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}

.mic-meter {
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(10, 35, 92, 0.08);
  border: 1px solid rgba(10, 35, 92, 0.1);
}

.mic-meter-fill {
  width: 2%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a7efc5, #22885c);
  transition: width 120ms linear;
}

.mic-level-value {
  min-width: 3.5rem;
  text-align: right;
  color: var(--ink);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.results-table th,
.results-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.results-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

@media (max-width: 640px) {
  .login-brand {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-block {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .brand-logo {
    width: min(320px, 72vw);
  }

  .admin-menu {
    align-self: flex-end;
  }

  .card {
    padding: 20px;
    border-radius: 22px;
  }

  .status-bar,
  .conversation-status,
  .result-grid,
  .breakdown,
  .entry-grid {
    grid-template-columns: 1fr;
  }

  .chat-bubble {
    max-width: 100%;
  }

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

  .nav-row {
    flex-direction: column;
  }

  .timer-wrap {
    text-align: left;
  }
}
