/* 考試時間展示 — exam-hall cabinet on a dark green wall */

:root {
  --felt: #15241d;
  --felt-deep: #0e1814;
  --felt-lift: #1e3329;
  --wood: #3a2214;
  --wood-mid: #5c3a22;
  --wood-edge: #2a160c;
  --brass: #b8954a;
  --brass-light: #e6d09a;
  --brass-dark: #7a5c28;
  --paper: #f8f1e3;
  --paper-edge: #e4d6bc;
  --ink: #1c140e;
  --ink-soft: #3d3228;
  --cream: #f3ead8;
  --title: "Noto Serif TC", "Noto Serif CJK TC", "PMingLiU", "Songti TC", serif;
  --ui: "Noto Sans HK", "Noto Sans TC", "PingFang HK", "Microsoft JhengHei", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  min-height: 100dvh;
  color: var(--cream);
  background:
    radial-gradient(ellipse 90% 80% at 50% 0%, #24382e 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 80% 100%, #1a2c24 0%, transparent 50%),
    var(--felt);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 45%, rgba(8, 12, 10, 0.45) 100%);
  z-index: 0;
}

.room {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: clamp(0.6rem, 1.6vh, 1.4rem) clamp(0.8rem, 2.2vw, 2rem) clamp(0.7rem, 1.8vh, 1.5rem);
}

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  padding: 0.15rem 0.35rem 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--brass) 45%, transparent);
  margin-bottom: clamp(0.6rem, 1.5vh, 1.1rem);
}

.masthead h1 {
  margin: 0;
  font-family: var(--title);
  font-weight: 700;
  font-size: clamp(1.35rem, 2.4vw + 0.6rem, 2.15rem);
  letter-spacing: 0.18em;
  color: var(--brass-light);
  line-height: 1.2;
}

.date-line {
  margin: 0;
  font-family: var(--title);
  font-size: clamp(0.95rem, 1.1vw + 0.6rem, 1.25rem);
  color: var(--cream);
  opacity: 0.88;
  letter-spacing: 0.06em;
}

.cabinet {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 47%) minmax(0, 1fr);
  gap: clamp(0.8rem, 2vw, 1.8rem);
  align-items: stretch;
  background:
    linear-gradient(160deg, #4a2c1a 0%, #2c1810 38%, #3e2416 70%, #23140c 100%);
  border: 1px solid #7a5230;
  box-shadow:
    inset 0 1px 0 rgba(230, 208, 154, 0.22),
    inset 0 0 0 5px #2a160c,
    inset 0 0 0 6px #b8954a,
    0 18px 40px rgba(0, 0, 0, 0.45);
  padding: clamp(0.85rem, 2vh, 1.5rem) clamp(0.9rem, 2vw, 1.6rem);
}

.clock-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 0.2rem 0.2rem 0;
}

.clock-stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
  padding: 0.4rem;
}

.clock-case {
  width: min(100cqw, 100cqh);
  aspect-ratio: 1;
  height: auto;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.4));
}

.clock-case svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

#numerals text {
  font-family: "Cinzel", "Palatino Linotype", "Book Antiqua", "Noto Serif TC", serif;
  font-weight: 700;
  fill: #1c140e;
  text-anchor: middle;
  dominant-baseline: middle;
  letter-spacing: 0.02em;
}

#numerals[data-style="arabic"] text {
  font-family: "Libre Baskerville", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0;
}

.digital-block {
  margin-top: clamp(0.45rem, 1.2vh, 0.9rem);
  text-align: center;
  color: var(--cream);
}

#digital {
  display: block;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-family: "Cinzel", "Noto Serif TC", ui-monospace, monospace;
  font-weight: 600;
  font-size: clamp(1.35rem, 2.6vw, 2.15rem);
  letter-spacing: 0.12em;
  color: var(--brass-light);
  line-height: 1.1;
}

.tz {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: color-mix(in srgb, var(--cream) 70%, transparent);
}

.info-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  gap: 0.7rem;
}

.paper {
  flex: 1;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 18%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(140, 110, 70, 0.03) 3px,
      rgba(140, 110, 70, 0.03) 4px
    ),
    var(--paper);
  border: 1px solid var(--paper-edge);
  box-shadow:
    inset 0 0 0 8px #f3ead8,
    inset 0 0 0 9px #c4b089,
    0 8px 22px rgba(0, 0, 0, 0.28);
  padding: 0.15rem;
  display: flex;
}

#board-text {
  flex: 1;
  width: 100%;
  min-height: 8rem;
  margin: 0;
  border: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  padding: clamp(1rem, 2.4vh, 1.6rem) clamp(1.1rem, 2.4vw, 1.8rem);
  line-height: 1.45;
  font-weight: 600;
  outline: none;
  caret-color: var(--ink);
}

#board-text:focus {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brass-dark) 55%, transparent);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.7rem;
  flex-shrink: 0;
}

.controls button {
  appearance: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: 9.6rem;
  padding: 0.58rem 1.15rem 0.5rem;
  background: #2a1a12;
  color: var(--cream);
  border: 1px solid var(--brass);
  box-shadow: inset 0 1px 0 rgba(230, 208, 154, 0.25);
  font-family: var(--ui);
  text-align: left;
}

.controls button:hover {
  background: #3a2418;
  border-color: var(--brass-light);
}

.controls button:active {
  transform: translateY(1px);
}

.controls button:focus-visible {
  outline: 2px solid var(--brass-light);
  outline-offset: 2px;
}

.btn-name {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.btn-meta {
  font-size: 0.86rem;
  color: var(--brass-light);
  letter-spacing: 0.04em;
}

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

@media (max-width: 820px), (max-aspect-ratio: 7/8) {
  .cabinet {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .clock-panel {
    flex: 0 0 auto;
    padding-top: 0.2rem;
  }

  .clock-stage {
    flex: 0 0 auto;
    height: auto;
    container-type: normal;
  }

  .clock-case {
    width: min(72vw, 42vh, 380px);
  }

  .paper {
    min-height: 12rem;
  }

  .masthead {
    justify-content: center;
    text-align: center;
  }

  .masthead h1 {
    letter-spacing: 0.12em;
    width: 100%;
  }

  .date-line {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .controls button:active {
    transform: none;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .masthead {
    margin-bottom: 0.4rem;
    padding-bottom: 0.4rem;
  }

  .masthead h1 {
    font-size: 1.2rem;
  }

  .tz {
    display: none;
  }

  .digital-block {
    margin-top: 0.25rem;
  }

  #digital {
    font-size: 1.1rem;
  }
}
