:root {
  color-scheme: dark;
  --ink: #172b23;
  --paper: #f7efdb;
  --serif: Georgia, "Songti SC", "STSong", "SimSun", serif;
  color: var(--paper);
  background: var(--ink);
  font: 16px/1.5 "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.landing {
  --gap: clamp(5px, .65vw, 11px);
  --row-height: calc((100svh - 3 * var(--gap)) / 4);
  min-height: 100svh;
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
}

.gallery, .veil { position: absolute; inset: 0; pointer-events: none; }
.gallery { display: grid; grid-template: repeat(4, 1fr) / minmax(0, 1fr); gap: var(--gap); }
.reel { display: flex; overflow: hidden; }
.strip {
  display: flex;
  flex: none;
  transform: translateX(var(--offset));
}
.landing.motion-ready .strip {
  animation: drift var(--duration) linear var(--delay) infinite var(--direction, normal);
  will-change: transform;
}
.landing.paused .strip, body:has(dialog[open]) .strip { animation-play-state: paused; }
.frames {
  display: flex;
  flex: none;
  gap: var(--gap);
  padding-inline-end: var(--gap);
}
.tile {
  height: var(--row-height);
  flex: none;
  display: block;
  border-radius: clamp(5px, .7vw, 12px);
  overflow: hidden;
  background: #273a2d;
}
.tile.scene {
  width: max(calc(var(--row-height) * 1.94), 23vw);
  object-fit: cover;
}
.word-card {
  width: max(calc(var(--row-height) * .68), 10vw);
  margin: 0;
  position: relative;
  container-type: inline-size;
}
.word-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.word-card figcaption {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: clamp(2px, 1.8cqi, 4px);
  padding: clamp(16px, 19cqi, 42px) clamp(6px, 7cqi, 18px) clamp(5px, 7cqi, 16px);
  background: linear-gradient(transparent, #101b16d9 53%, #101b16f5);
  color: var(--paper);
  text-shadow: 0 1px 5px #070e09;
}
.word-card strong {
  font: italic 600 clamp(12px, 15cqi, 28px)/1.04 Georgia, serif;
  overflow-wrap: anywhere;
}
.word-card figcaption span {
  color: #e6d9bf;
  font-size: clamp(9px, 7.5cqi, 13px);
  letter-spacing: .06em;
}

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.veil {
  background:
    radial-gradient(ellipse clamp(330px, 42vw, 840px) clamp(205px, 34svh, 410px) at center,
      #10251bef 0%, #10251bd9 32%, #10251b81 61%, #10251b00 100%),
    linear-gradient(#10231a19, #10231a29);
}
.entry { position: relative; padding: 12px; }
.brand {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 1.65vw, 28px);
  font: 600 clamp(3.1rem, 5vw, 6rem)/1 var(--serif);
  text-shadow: 0 4px 24px #0a1712a0;
}
.brand img {
  width: clamp(96px, 11vw, 196px);
  max-width: 43vw;
  height: auto;
  object-fit: contain;
}
.brand-name { display: grid; gap: .12em; text-align: center; }
.brand-name > span { letter-spacing: .07em; margin-inline-end: -.07em; }
.brand-name small { font: italic 400 .37em/1.15 Georgia, serif; }
.actions {
  position: absolute;
  top: calc(100% + clamp(12px, 2.8svh, 28px));
  left: 50%;
  translate: -50% 0;
  display: flex;
  gap: clamp(10px, 1.4vw, 25px);
}
.button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 22px;
  min-height: 44px;
  font-weight: 600;
  transition: background-color .18s, color .18s, border-color .18s;
}
.actions .button { width: clamp(112px, 11vw, 174px); }
.primary { background: var(--paper); color: var(--ink); }
.primary:hover { background: #fff8e8; }
.secondary { background: #1533269e; border-color: #f7efdbc4; color: var(--paper); }
.secondary:hover { background: #274b38; border-color: var(--paper); }
.motion {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: #132820dc;
  border: 1px solid #f7efdb8a;
  border-radius: 50%;
}
.motion span { width: 12px; height: 14px; border-inline: 3px solid; }
.motion[aria-pressed="true"] span {
  width: 0;
  height: 0;
  border: 7px solid transparent;
  border-left: 11px solid currentColor;
  border-right: 0;
  margin-left: 3px;
}

.panel {
  color-scheme: light;
  width: min(430px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  padding: clamp(22px, 5vw, 38px);
  color: #211f1a;
  background: #fcf7eb;
  border: 1px solid #c9b99c;
  border-radius: 12px;
  box-shadow: 0 18px 80px #04120d70;
}
.panel::backdrop { background: #081710ac; backdrop-filter: blur(4px); }
.panel h2 { color: var(--ink); font: 600 2rem/1.2 var(--serif); margin: 0 40px 24px 0; }
.close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: 28px/1 Georgia, serif;
}
.close:hover { background: #eee5d3; }
form { display: grid; gap: 8px; }
label { font-weight: 600; }
input { min-width: 0; color: #221f1a; background: #fffdf7; padding: 10px; border: 1px solid #95876d; border-radius: 6px; }
input + label { margin-top: 7px; }
.panel .primary { color: var(--paper); background: #244537; }
.panel .primary:hover { background: #315746; }
button:disabled { cursor: wait; opacity: .68; }
#guidance, #message { margin: 0; font-size: .875rem; }
#guidance { color: #595041; }
#message { color: #8e3526; }
#message.success { color: #315746; }
#message:empty { display: none; }
.verification-fields { display: grid; gap: 8px; }
.verification-input { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 8px; }
.verification-input button {
  padding: 8px 10px;
  background: #ede7d8;
  color: #244537;
  border: 1px solid #bcae95;
  border-radius: 6px;
  font-size: .875rem;
}
#submit { margin-top: 9px; }
.switch { color: #254638; background: transparent; border: 0; padding: 9px 0; margin-top: 8px; text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid #f8e7b8; outline-offset: 4px; }
.panel :focus-visible { outline-color: #8c532b; outline-offset: 2px; }

@media (max-width: 650px) {
  .tile.scene { width: max(calc(var(--row-height) * 1.5), 23vw); }
  .veil {
    background: radial-gradient(ellipse 86% 34% at 50% 50%, #10251bf5 28%, #10251bc1 58%, #10251b13 100%);
  }
  .brand {
    font-size: clamp(2.55rem, 12vw, 3.6rem);
    gap: 12px;
  }
  .brand img { width: clamp(84px, 26vw, 128px); }
  .actions {
    width: min(calc(100vw - 44px), 320px);
    gap: 10px;
  }
  .actions .button { flex: 1; width: auto; min-height: 48px; }
  .panel {
    max-height: calc(100dvh - 24px);
    padding: 22px 18px;
    overscroll-behavior: contain;
  }
  .panel h2 { font-size: 1.7rem; margin-bottom: 18px; }
  .panel :is(input, .verification-input button, .switch) { min-height: 44px; }
  .panel input { font-size: 16px; }
}

@media (max-height: 420px) {
  .brand { font-size: 2.6rem; }
  .brand img { width: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  .landing.motion-ready .strip { animation: none; will-change: auto; }
  .motion { display: none; }
  .button { transition: none; }
}
