:root {
  color-scheme: light;
  --paper: #f5efe1;
  --ink: #251d16;
  --muted-ink: #675849;
  --line: #d9cbb6;
  --accent: #8b342b;
  --serif: "Noto Serif CJK SC", "Songti SC", SimSun, serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
body[data-theme="career"] { --accent: #245262; }
body[data-theme="peace"] { --accent: #3e5946; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1216px;
  margin: 0 auto;
  min-height: 85px;
  padding: 0 28px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font: 700 1.03rem var(--serif);
  letter-spacing: .11em;
}

.brand-seal {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border: 1px solid currentColor;
  border-radius: 3px;
  color: var(--accent);
  font-size: 1.18rem;
  letter-spacing: 0;
}

.card-title {
  color: var(--muted-ink);
  font-size: .875rem;
  letter-spacing: .13em;
}

.name-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: min(690px, calc(100svh - 112px));
  max-width: 1160px;
  margin: 0 auto 27px;
  border: 1px solid var(--line);
}

.name-panel {
  align-self: center;
  padding: clamp(34px, 6vw, 94px);
}

.eyebrow {
  color: var(--accent);
  margin: 0 0 15px;
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .14em;
}

h1 { margin: 0; font-family: var(--serif); }
.name-panel h1 {
  font-size: clamp(2.25rem, 4.7vw, 4.25rem);
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.28;
  white-space: pre-line;
}

.title-rule {
  display: block;
  width: 36px;
  margin: 29px 0 31px;
  height: 1px;
  background: var(--accent);
}

.name-panel label {
  display: block;
  font-size: .875rem;
  font-weight: 650;
  margin: 0 0 9px;
}

.name-panel input {
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  border-radius: 3px;
  border: 1px solid #b8a789;
  background: #fffaf1;
  color: var(--ink);
}

.name-panel input::placeholder { color: var(--muted-ink); }
.name-note, .form-error {
  margin: 10px 0 0;
  color: var(--muted-ink);
  font-size: .875rem;
  line-height: 1.6;
}
.form-error { color: #9c2b22; }

.primary-button {
  margin-top: 22px;
  padding: 12px 20px;
  min-height: 50px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: white;
  font-weight: 650;
}

.name-panel .primary-button { width: 100%; }
.primary-button:hover:not(:disabled) { filter: brightness(.89); }

.cover {
  position: relative;
  overflow: hidden;
  min-height: 100%;
  margin: 0;
  background: #302820;
}

.cover img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
}

.status-page {
  text-align: center;
  padding: max(50px, 13vh) 24px 64px;
}
.status-page p { color: var(--muted-ink); line-height: 1.6; }
.preview-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.preview-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.preview-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

body.is-playing { background: #171614; color: #f6edda; }
.is-playing .site-header {
  min-height: calc(62px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}
.is-playing .brand-seal, .is-playing .card-title { color: #d9bc8a; }

.video-page {
  --stage-height: calc(100svh - 74px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  display: grid;
  place-items: center;
  min-height: calc(100svh - 62px - env(safe-area-inset-top, 0px));
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.video-stage {
  position: relative;
  isolation: isolate;
  width: min(100%, calc(var(--stage-height) * 9 / 16));
  aspect-ratio: 9 / 16;
  container-type: inline-size;
  overflow: hidden;
  background: #231f1a;
}

.video-stage video, .video-shade, .tail-sparkles, .ending-blessing {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.video-stage video { object-fit: contain; }
.video-shade {
  pointer-events: none;
  background: linear-gradient(transparent 51%, rgb(18 14 10 / .72));
}
.tail-sparkles, .ending-blessing { pointer-events: none; }
.video-page:focus { outline: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.video-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
}

.tail-sparkles:not([hidden]) ~ .video-controls {
  inset-inline: min(14px, 3.5cqw);
  justify-content: space-between;
}

.video-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid #d8bf9c;
  border-radius: 24px;
  background: rgb(16 13 10 / .82);
  color: #fff2d9;
  font-size: .875rem;
}
.video-button:focus-visible { outline-color: #ffdf9d; }
.video-save {
  background: #f1d7a4;
  color: #2f2216;
  font-weight: 650;
  text-decoration: none;
}
.video-error {
  position: absolute;
  margin: 0;
  inset: 66px 12px auto;
  text-align: center;
  padding: 8px;
  border-radius: 3px;
  background: rgb(16 13 10 / .84);
}

@media (min-width: 761px) and (max-width: 1215px) {
  .name-page { margin-inline: 28px; }
}

@media (max-width: 760px) {
  .site-header {
    min-height: calc(66px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 20px 0;
  }
  .name-page { grid-template-columns: 1fr; border-inline: 0; }
  .name-panel { padding: 32px max(24px, 8vw) 42px; }
  .cover { grid-row: 1; min-height: clamp(175px, 30svh, 265px); }
  .cover img { object-position: 50% 30%; }
  .title-rule { margin-block: 20px 23px; }
}
