:root {
  color-scheme: light;
  --ink: #25223a;
  --muted: #6f6982;
  --paper: #fffaf4;
  --card: rgba(255, 255, 255, 0.88);
  --line: rgba(73, 61, 103, 0.14);
  --purple: #7357d9;
  --purple-dark: #5239b8;
  --orange: #ff9f67;
  --green: #45aa86;
  --shadow: 0 22px 60px rgba(73, 49, 116, 0.12);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #fff7ee;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 8%, rgba(255, 207, 132, 0.25), transparent 32rem),
    radial-gradient(circle at 90% 24%, rgba(146, 124, 235, 0.18), transparent 30rem),
    linear-gradient(150deg, #fffaf5 0%, #fbf6ff 58%, #f5fbff 100%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.page-glow {
  position: fixed;
  z-index: -1;
  width: 20rem;
  height: 20rem;
  border-radius: 44% 56% 64% 36%;
  filter: blur(2px);
  opacity: 0.4;
  pointer-events: none;
}

.page-glow--one {
  top: -10rem;
  right: -6rem;
  background: #d6c8ff;
  transform: rotate(22deg);
}

.page-glow--two {
  bottom: -11rem;
  left: -8rem;
  background: #ffd7b5;
}

.shell {
  width: min(100% - 2rem, 760px);
  margin: 0 auto;
  padding: max(2rem, env(safe-area-inset-top)) 0 max(2rem, env(safe-area-inset-bottom));
}

.hero {
  padding: 1rem 0 2.2rem;
}

.eyebrow,
.step-label {
  color: var(--purple-dark);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(115, 87, 217, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
}

.hero__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 1.25rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.6rem;
  font-size: clamp(2.5rem, 9vw, 4.7rem);
  line-height: 1;
  letter-spacing: -0.07em;
}

.hero p {
  max-width: 32rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 3vw, 1.12rem);
  line-height: 1.75;
}

.hero-monster {
  position: relative;
  flex: 0 0 auto;
  width: 7rem;
  height: 6.2rem;
  border: 3px solid var(--ink);
  border-radius: 47% 53% 43% 57% / 58% 47% 53% 42%;
  background: #ffd369;
  box-shadow: 8px 9px 0 rgba(37, 34, 58, 0.09);
  transform: rotate(5deg);
}

.hero-monster::before,
.hero-monster::after {
  position: absolute;
  top: -1.25rem;
  width: 1.3rem;
  height: 2rem;
  border: 3px solid var(--ink);
  border-bottom: 0;
  border-radius: 80% 80% 0 0;
  background: #ffd369;
  content: "";
}

.hero-monster::before {
  left: 1rem;
  transform: rotate(-18deg);
}

.hero-monster::after {
  right: 0.8rem;
  transform: rotate(22deg);
}

.hero-monster__eye {
  position: absolute;
  top: 2rem;
  z-index: 1;
  width: 0.65rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--ink);
}

.hero-monster__eye:first-child {
  left: 2rem;
}

.hero-monster__eye:nth-child(2) {
  right: 2rem;
}

.hero-monster__mouth {
  position: absolute;
  bottom: 1.45rem;
  left: 50%;
  width: 1.3rem;
  height: 0.65rem;
  border: 3px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
}

.session-panel,
.results {
  border: 1px solid var(--line);
  border-radius: 1.8rem;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.session-panel {
  padding: clamp(1.25rem, 5vw, 2.2rem);
}

.section-heading,
.results__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

h2 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.45rem, 5vw, 2rem);
  letter-spacing: -0.035em;
}

form {
  margin-top: 1.7rem;
}

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

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
}

input {
  width: 100%;
  min-height: 3.35rem;
  padding: 0.8rem 1rem;
  border: 1.5px solid rgba(73, 61, 103, 0.22);
  border-radius: 1rem;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 4px rgba(115, 87, 217, 0.12);
}

input[aria-invalid="true"] {
  border-color: #d95050;
}

.primary-button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  min-height: 3.35rem;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 0.75rem 1.25rem;
  border-radius: 1rem;
  color: white;
  font-weight: 800;
  background: var(--ink);
  box-shadow: 0 8px 20px rgba(37, 34, 58, 0.18);
  transition: transform 150ms ease, background 150ms ease;
}

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

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

/* 身分確認後唯一要按的按鈕，加大讓學生更容易點（現場測試入口關閉後，
   「開始答題」是這個畫面唯一的操作）。 */
.start-button--large {
  width: 100%;
  min-height: 4.2rem;
  margin-top: 0.5rem;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.icon-button {
  width: 2.8rem;
  height: 2.8rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  font-size: 1.35rem;
  background: white;
}

.icon-button.is-spinning span {
  display: inline-block;
  animation: spin 800ms linear infinite;
}

.field-help,
.form-message {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  line-height: 1.55;
}

.field-help {
  color: var(--muted);
}

.form-message {
  min-height: 1.2rem;
  color: #b53737;
  font-weight: 700;
}

.results {
  margin-top: 1.25rem;
  padding: clamp(1.25rem, 5vw, 2.2rem);
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.connection-status__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #aaa4b6;
}

.connection-status[data-state="ok"] .connection-status__dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(69, 170, 134, 0.12);
}

.connection-status[data-state="loading"] .connection-status__dot {
  background: var(--orange);
  animation: pulse 1.2s ease-in-out infinite;
}

.connection-status[data-state="error"] .connection-status__dot {
  background: #d95050;
}

.session-summary {
  margin: 1.5rem 0 1rem;
  padding: 0.8rem 1rem;
  border-radius: 0.9rem;
  color: var(--muted);
  font-size: 0.82rem;
  background: rgba(115, 87, 217, 0.06);
  overflow-wrap: anywhere;
}

.session-summary strong {
  color: var(--ink);
}

.monster-list {
  display: grid;
  gap: 1rem;
}

.monster-card {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  min-height: 9.5rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: white;
}

.monster-card--finger-0 { --monster-color: #ffd7e3; }
.monster-card--finger-1 { --monster-color: #ccefdc; }
.monster-card--finger-2 { --monster-color: #ffe0bd; }
.monster-card--finger-3 { --monster-color: #c9eef1; }
.monster-card--finger-4 { --monster-color: #ddd3ff; }
.monster-card--finger-5 { --monster-color: #fff0ad; }

.monster-card__visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 9.5rem;
  background: var(--monster-color, #ded6ff);
  overflow: hidden;
}

.monster-card__visual::after {
  position: absolute;
  right: -2rem;
  bottom: -3rem;
  width: 7rem;
  height: 7rem;
  border: 1.5rem solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  content: "";
}

.monster-card__image {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.generating-orb {
  position: relative;
  z-index: 1;
  width: 4.8rem;
  height: 4.4rem;
  border: 3px solid var(--ink);
  border-radius: 48% 52% 44% 56%;
  background: rgba(255, 255, 255, 0.72);
  animation: float 1.8s ease-in-out infinite;
}

.generating-orb::before,
.generating-orb::after {
  position: absolute;
  top: 1.45rem;
  width: 0.48rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ink);
  content: "";
}

.generating-orb::before {
  left: 1.25rem;
}

.generating-orb::after {
  right: 1.25rem;
}

.monster-card__body {
  padding: 1.15rem 1.2rem;
}

.monster-card__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.monster-card__id {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.state-badge {
  flex: 0 0 auto;
  padding: 0.38rem 0.55rem;
  border-radius: 999px;
  color: #5b438c;
  font-size: 0.68rem;
  font-weight: 900;
  background: #eee9ff;
}

.state-badge[data-state="CREATED"] {
  color: #147252;
  background: #ddf7eb;
}

.monster-card h3 {
  margin: 1rem 0 0.35rem;
  font-size: 1.25rem;
}

.monster-card__description,
.monster-card__meta {
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.55;
}

.monster-card__description {
  margin-bottom: 0.85rem;
}

.monster-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  margin: 0;
}

.empty-state {
  padding: 2.4rem 1rem 1.4rem;
  text-align: center;
}

.empty-state__creature {
  display: grid;
  width: 5rem;
  height: 4.6rem;
  place-items: center;
  margin: 0 auto 1rem;
  border: 2px dashed rgba(73, 61, 103, 0.35);
  border-radius: 48% 52% 42% 58%;
  color: var(--muted);
  font-size: 1.8rem;
  font-weight: 800;
}

.empty-state h3 {
  margin-bottom: 0.35rem;
}

.empty-state p,
.noscript {
  color: var(--muted);
  line-height: 1.6;
}

.noscript {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  background: #fff0f0;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes float {
  50% { transform: translateY(-0.4rem) rotate(3deg); }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 1.15rem, 760px);
  }

  .hero {
    padding-top: 0.4rem;
  }

  .hero__title-row {
    align-items: flex-end;
    gap: 0.8rem;
  }

  .hero-monster {
    width: 4.8rem;
    height: 4.3rem;
    border-width: 2px;
  }

  .hero-monster::before,
  .hero-monster::after {
    top: -0.9rem;
    width: 0.85rem;
    height: 1.35rem;
    border-width: 2px;
  }

  .hero-monster__eye {
    top: 1.35rem;
    width: 0.45rem;
    height: 0.58rem;
  }

  .hero-monster__eye:first-child { left: 1.3rem; }
  .hero-monster__eye:nth-child(2) { right: 1.3rem; }
  .hero-monster__mouth { bottom: 0.9rem; border-width: 2px; }

  .input-row {
    grid-template-columns: 1fr;
  }

  .monster-card {
    grid-template-columns: 7.3rem minmax(0, 1fr);
  }

  .monster-card__visual {
    min-height: 11rem;
  }

  .monster-card__topline {
    align-items: flex-start;
    flex-direction: column;
  }

  footer {
    flex-direction: column;
    gap: 0.35rem;
  }
}

@media (max-width: 410px) {
  .monster-card {
    grid-template-columns: 1fr;
  }

  .monster-card__visual {
    min-height: 10rem;
  }
}








/* ========================================
   Scoop Panel - Premium Visual Design
   ======================================== */

.scoop-panel {
  margin-top: 2rem;
  padding: 2rem;
  border: none;
  border-radius: 24px;
  background: linear-gradient(145deg, #ffffff 0%, #f8f9ff 100%);
  box-shadow:
    0 20px 60px rgba(99, 102, 241, 0.12),
    0 8px 16px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
}

.scoop-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
}

.scoop-panel .section-heading h2 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

/* Instructions Card */
.scoop-instructions {
  margin: 1.75rem 0;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.instruction-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  animation: fadeInUp 0.4s ease-out forwards;
  opacity: 0;
}

.instruction-step:nth-child(1) { animation-delay: 0.1s; }
.instruction-step:nth-child(2) { animation-delay: 0.2s; }
.instruction-step:nth-child(3) { animation-delay: 0.3s; }

.instruction-step:last-child {
  margin-bottom: 0;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-number {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1.125rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  position: relative;
}

.step-number::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.3;
}

.instruction-step p {
  margin: 0;
  padding-top: 0.5rem;
  line-height: 1.7;
  color: #1e293b;
  font-size: 1.0625rem;
  font-weight: 500;
}

/* Premium Action Button */
.scoop-controls {
  margin: 2rem 0;
  display: flex;
  justify-content: center;
}

.scoop-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  padding: 1.25rem 2.5rem;
  min-height: 4rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  background-size: 200% 100%;
  border: none;
  border-radius: 50px;
  box-shadow:
    0 8px 24px rgba(99, 102, 241, 0.35),
    0 4px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.scoop-action-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.scoop-action-button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 12px 36px rgba(99, 102, 241, 0.45),
    0 6px 12px rgba(0, 0, 0, 0.15);
  background-position: 100% 0;
}

.scoop-action-button:hover::before {
  width: 300px;
  height: 300px;
}

.scoop-action-button:active {
  transform: translateY(-1px) scale(0.98);
  box-shadow:
    0 6px 18px rgba(99, 102, 241, 0.3),
    0 3px 6px rgba(0, 0, 0, 0.1);
}

.scoop-action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  background: #94a3b8;
}

.button-icon {
  font-size: 1.75rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.button-text {
  line-height: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Status Container */
.status-container {
  margin-top: 2rem;
}

/* Alert Messages */
.alert {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1.125rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.25rem;
  animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.alert-warning {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.1) 100%);
  border: 2px solid rgba(251, 191, 36, 0.4);
  color: #92400e;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.15);
}

.alert-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.alert-text {
  line-height: 1.6;
  font-weight: 600;
  font-size: 1rem;
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1.0625rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.status-icon {
  font-size: 1.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.status-text {
  line-height: 1;
}

.status-badge[data-state=idle] {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.15) 0%, rgba(100, 116, 139, 0.1) 100%);
  color: #475569;
  border: 2px solid rgba(148, 163, 184, 0.3);
}

.status-badge[data-state=ready] {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.15) 100%);
  color: #4338ca;
  border: 2px solid rgba(99, 102, 241, 0.4);
  animation: pulse-glow 2s ease-in-out infinite;
}

.status-badge[data-state=ok] {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(22, 163, 74, 0.15) 100%);
  color: #15803d;
  border: 2px solid rgba(34, 197, 94, 0.5);
  animation: celebrate 0.6s ease-out;
}

.status-badge[data-state=denied],
.status-badge[data-state=error],
.status-badge[data-state=unavailable] {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.1) 100%);
  color: #b91c1c;
  border: 2px solid rgba(239, 68, 68, 0.4);
}

@keyframes pulse-glow {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
  }
}

@keyframes celebrate {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* Footer */
.scoop-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid rgba(99, 102, 241, 0.1);
}

.help-text {
  margin: 0;
  font-size: 0.9375rem;
  color: #64748b;
  line-height: 1.7;
  text-align: center;
}

.help-text strong {
  color: #334155;
  font-weight: 700;
}

/* Mobile Responsive Optimization */
@media (max-width: 620px) {
  .scoop-panel {
    padding: 1.5rem;
    border-radius: 20px;
  }

  .scoop-panel .section-heading h2 {
    font-size: 1.375rem;
  }

  .scoop-instructions {
    padding: 1.25rem;
  }

  .instruction-step {
    gap: 0.875rem;
    margin-bottom: 1.125rem;
  }

  .step-number {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1rem;
  }

  .instruction-step p {
    font-size: 1rem;
    padding-top: 0.375rem;
  }

  .scoop-action-button {
    width: 100%;
    font-size: 1.125rem;
    padding: 1.125rem 2rem;
    min-height: 3.75rem;
  }

  .button-icon {
    font-size: 1.5rem;
  }

  .status-badge {
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
  }

  .status-icon {
    font-size: 1.375rem;
  }

  .help-text {
    font-size: 0.875rem;
  }
}

@media (max-width: 410px) {
  .scoop-panel {
    padding: 1.25rem;
    border-radius: 18px;
  }

  .scoop-panel .section-heading h2 {
    font-size: 1.25rem;
  }

  .scoop-instructions {
    padding: 1rem;
  }

  .step-number {
    width: 2rem;
    height: 2rem;
    font-size: 0.9375rem;
  }

  .instruction-step p {
    font-size: 0.9375rem;
  }

  .scoop-action-button {
    font-size: 1.0625rem;
    padding: 1rem 1.75rem;
    min-height: 3.5rem;
  }

  .alert {
    padding: 1rem 1.25rem;
    gap: 0.75rem;
  }

  .alert-icon {
    font-size: 1.375rem;
  }

  .alert-text {
    font-size: 0.9375rem;
  }

  .status-badge {
    font-size: 0.9375rem;
    padding: 0.75rem 1.25rem;
  }
}


/* Milestone 8 test contract: #scoop-status id selector present */
#scoop-status {
  /* Visual treatment applied via .status-badge class on the same element */
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Milestone 10 quiz interface */
.pair-code-display {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.5rem;
  color: #1f5f3a;
  background: #f2f7f0;
  border: 2px solid #1f5f3a;
  border-radius: 12px;
  text-align: center;
  padding: 1rem 0;
  margin-top: 0.5rem;
  font-variant-numeric: tabular-nums;
}
.hint {
  font-size: 0.9rem;
  color: #5a6a5a;
  margin-top: 0.5rem;
}
.quiz-test-panel { border-color: #c9a354; background: #fffaf0; }
.quiz-test-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.quiz-test-actions > button { flex: 1 1 14rem; }
.quiz-score { margin: 1.25rem 0; text-align: center; font-size: 1.35rem; color: #17643d; }
.quiz-score strong { font-size: 2.4rem; line-height: 1; }
.quiz-score span { color: #506050; }
select {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid #8a9a8a;
  border-radius: 8px;
  background: #fafbfa;
}
.quiz-progress {
  font-weight: 700;
  color: #1f5f3a;
}
.quiz-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}
.quiz-timer {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #1f5f3a;
}
.quiz-timer--urgent { color: #c0392b; }
.quiz-timer--done { color: #8a9a8a; }
.quiz-choice--locked {
  cursor: default;
}
.quiz-choice--correct {
  border-color: #1f7a44;
  background: #e6f6ec;
}
.quiz-choice--wrong {
  border-color: #c0392b;
  background: #fdecea;
}
.quiz-question {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1rem 0;
}
.quiz-choices {
  display: grid;
  gap: 0.75rem;
}
.quiz-choice {
  font: inherit;
  text-align: left;
  padding: 0.9rem 1rem;
  border: 1px solid #8a9a8a;
  border-radius: 10px;
  background: #fafbfa;
  cursor: pointer;
}
.choice-letter {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  line-height: 2rem;
  text-align: center;
  font-weight: 700;
  color: #fff;
  background: #1f5f3a;
  border-radius: 50%;
  margin-right: 0.75rem;
}
.quiz-feedback,
.quiz-done {
  font-size: 1.1rem;
  margin: 1rem 0;
}
.quiz-next-button {
  font: inherit;
  font-weight: 700;
  display: block;
  width: 100%;
  margin: 1rem 0 0;
  padding: 0.9rem 1rem;
  border: 0;
  border-radius: 10px;
  background: #1f5f3a;
  color: #fff;
  cursor: pointer;
}
.quiz-result {
  font-weight: 800;
  font-size: 1.2rem;
}
.quiz-result--correct { color: #1f7a44; }
.quiz-result--wrong { color: #c0392b; }
.quiz-result--timeout { color: #b8860b; }
/* Quiz answer log (quiz-log.html). */
.quiz-log-actions { display: flex; gap: 0.5rem; align-items: center; }
.quiz-log-actions a.secondary-button { text-decoration: none; display: inline-flex; align-items: center; }
.quiz-log-table-wrap { overflow-x: auto; margin: 0.5rem 0; }
.quiz-log-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.quiz-log-table th,
.quiz-log-table td {
  border-bottom: 1px solid #d8e2d8;
  padding: 0.45rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
.quiz-log-table th { position: sticky; top: 0; background: #f2f7f0; white-space: nowrap; }
.quiz-log-table td:nth-child(4) { max-width: 22rem; }  /* 題目欄 */
.quiz-log-result { font-weight: 800; white-space: nowrap; }
.quiz-log-result--correct { color: #1f7a44; }
.quiz-log-result--wrong { color: #c0392b; }
.quiz-log-result--timeout { color: #b8860b; }

/* Quiz result page — monster image with stacked accessory SVG layers. */
.result-stage {
  position: relative;
  width: min(100%, 460px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: #fff;
}
.result-stage img,
.result-stage svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.result-summary {
  display: grid;
  gap: 0.6rem;
  margin: 1.25rem 0;
}
.result-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 1rem;
}
.result-summary dt {
  color: var(--muted, #737987);
}
.result-summary dd {
  font-weight: 700;
  margin: 0;
}
.result-link {
  display: inline-block;
}

/* Quiz administrator — phone-first editor, then a denser desktop workspace. */
.quiz-admin-shell { max-width: 1180px; }
.quiz-admin-panel { min-width: 0; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1rem 0; }
.admin-toolbar .form-message { margin: 0; }
.admin-workspace { display: grid; gap: 1rem; }
.question-list-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.question-list-heading h2 { margin-bottom: 0.25rem; }
.question-count { color: #176b3a; font-weight: 800; white-space: nowrap; }
.question-list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0.5rem 0 1rem; }
.question-list-toolbar .checkbox-label { margin: 0; }
.question-list-toolbar .primary-button { min-height: 2.75rem; }
.question-editor { display: grid; gap: 0.9rem; }
.question-editor label { display: grid; gap: 0.4rem; font-weight: 700; min-width: 0; }
.question-editor textarea { min-height: 7rem; resize: vertical; }
.question-editor input, .question-editor textarea, .question-editor select { box-sizing: border-box; width: 100%; font: inherit; padding: 0.75rem; border: 1px solid #8a9a8a; border-radius: 8px; background: #fff; }
.question-editor .primary-button { min-height: 3rem; }
.question-list { display: grid; gap: 0.8rem; }
.question-admin-card { border: 1px solid #c7d2c7; border-radius: 10px; padding: 0.8rem 1rem; background: #fafbfa; }
.question-admin-card summary { cursor: pointer; display: flex; align-items: flex-start; gap: 0.6rem; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.question-summary-text { min-width: 0; }
.question-status { display: inline-flex; flex: 0 0 auto; align-items: center; border: 1px solid; border-radius: 999px; padding: 0.18rem 0.58rem; font-size: 0.76rem; font-weight: 800; line-height: 1.25; letter-spacing: 0.03em; }
.question-status--active { color: #176b3a; background: #e6f6eb; border-color: #62bd7e; }
.question-status--inactive { color: #9b2929; background: #fde9e9; border-color: #e18484; }
.question-admin-card[data-state="active"] { border-color: #b8d9c1; }
.question-admin-card[data-state="inactive"] { border-color: #e6bcbc; background: #fffafa; }
.question-admin-card form { margin-top: 1rem; }
.question-order-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.question-order-controls .field-help { margin-right: auto; }
.order-button { min-height: 2.5rem; padding: 0.45rem 0.7rem; }
.question-editor-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.question-editor-actions > button { flex: 1 1 12rem; }
.danger-button { min-height: 3rem; font: inherit; padding: 0.75rem 1rem; border: 1px solid #c94b4b; border-radius: 8px; color: #9b2929; background: #fff1f1; cursor: pointer; font-weight: 700; }
.danger-button:hover { background: #fde0e0; }
.danger-button:disabled { cursor: not-allowed; opacity: 0.65; }
.checkbox-label { display: block !important; line-height: 1.45; }
.checkbox-label input { width: auto; min-width: 1.2rem; min-height: 1.2rem; vertical-align: middle; }
.secondary-button { min-height: 2.75rem; font: inherit; padding: 0.6rem 0.9rem; border: 1px solid #55705a; border-radius: 8px; background: #fff; cursor: pointer; }

@media (min-width: 900px) {
  .admin-workspace { grid-template-columns: minmax(19rem, 0.7fr) minmax(0, 1.3fr); align-items: start; }
  .admin-create-panel { position: sticky; top: 1rem; }
  .admin-list-panel { min-width: 0; }
  .question-admin-card[open] .question-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .question-admin-card[open] .question-editor > :first-child,
  .question-admin-card[open] .question-editor > :nth-child(2),
  .question-admin-card[open] .question-editor > :nth-child(7),
  .question-admin-card[open] .question-editor > :nth-child(8) { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .quiz-admin-shell { padding-inline: max(1rem, env(safe-area-inset-left)); }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .admin-toolbar .secondary-button, .question-editor .primary-button { width: 100%; }
  .question-list-toolbar { align-items: stretch; flex-direction: column; }
  .question-list-toolbar .primary-button { width: 100%; }
  .question-admin-card { padding: 0.75rem; }
  .question-admin-card .question-editor-actions { flex-direction: column; }
  .question-admin-card .question-editor-actions > button { width: 100%; }
  .quiz-test-actions { flex-direction: column; }
  .quiz-test-actions > button { width: 100%; }
}
.form-message--error {
  color: #b03030;
}

/* Result page — original vs grown monster side by side. */
.result-pair-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}
.result-figure {
  margin: 0;
  text-align: center;
}
.result-figure .result-stage {
  width: 100%;
  max-width: 260px;
}
.result-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted, #737987);
}
.result-back {
  margin-top: 1rem;
}

@media (max-width: 620px) {
  .result-pair-grid {
    grid-template-columns: 1fr;
  }
}
