/* Screens: Overlays, Title, Notice Card, Plan Board, Memo, Caught, Result, Fin, Debug, Cine, Fade */

/* シート */
.ov {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 16px calc(env(safe-area-inset-bottom, 0px) + var(--tb) + 20px);
  overflow-y: auto;
  touch-action: pan-y;
  background: linear-gradient(to top, rgba(6, 7, 16, 0.94) 0%, rgba(6, 7, 16, 0.7) 50%, rgba(6, 7, 16, 0.25) 100%);
}

.ov > * {
  margin-top: auto;
}

.sheet {
  width: min(760px, 100%);
  display: grid;
  gap: 14px;
  min-width: 0;
  flex-shrink: 0;
}

.eyebrow {
  font: 14px var(--f-px);
  letter-spacing: 0.22em;
  color: var(--gold);
}

h2 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(30px, 8vw, 48px);
  line-height: 1.05;
  text-wrap: balance;
}

.lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}

.btnrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  border-radius: var(--r-btn);
  font-size: 17px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 20px;
  color: var(--paper-ink);
  background: var(--paper);
  border: 0;
  box-shadow: 0 4px 0 var(--paper-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  transition: transform 80ms ease, box-shadow 80ms ease, border-color 140ms ease, background-color 140ms ease;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--paper-line);
}

.btn.red {
  background: var(--cape);
  color: #fff;
  box-shadow: 0 4px 0 var(--cape-deep);
}

.btn.red:active {
  box-shadow: 0 2px 0 var(--cape-deep);
}

.btn.ghost {
  font-size: 13px;
  color: var(--text);
  background: rgba(14, 17, 34, 0.72);
  box-shadow: inset 0 1px 0 rgba(234, 184, 77, 0.16);
  border: 1px solid var(--line);
  padding: 9px 14px;
}

.btn.ghost:active {
  box-shadow: none;
}

@media (hover: hover) {
  .btn:not(:disabled):hover {
    filter: brightness(1.04);
  }
  .btn.ghost:not(:disabled):hover {
    border-color: var(--gold);
    color: var(--gold);
  }
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn[data-arm="1"] {
  background: var(--gold);
  color: var(--paper-ink);
  box-shadow: 0 4px 0 var(--gold-deep);
}

@media (min-width: 760px) {
  .ov {
    padding-left: 40px;
    padding-bottom: calc(36px + var(--tb) + env(safe-area-inset-bottom, 0px));
  }
}

/* はじめる前の画面 */
#gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 28px) 20px calc(env(safe-area-inset-bottom, 0px) + var(--tb) + 28px);
  background: radial-gradient(circle at 50% 46%, #1b1d45 0%, #0b0d1b 58%, #05060f 100%);
}

.g-kids {
  width: clamp(150px, 42vw, 200px);
  height: auto;
  align-self: start;
  opacity: 0.86;
}

#gateBtn {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 12px 34px 18px;
  background: none;
  border: 0;
  color: var(--paper);
}

.g-mono {
  width: clamp(168px, 44vmin, 250px);
  height: auto;
  overflow: visible;
}

.g-mono * {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.g-ring0 {
  stroke: rgba(234, 184, 77, 0.18);
  stroke-width: 9;
  fill: rgba(140, 160, 255, 0.05);
}

.g-ring {
  stroke: var(--gold);
  stroke-width: 9;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transform: rotate(-90deg);
  transform-origin: 100px 92px;
  transition: stroke-dashoffset 0.25s linear;
}

.g-eye {
  fill: #9fdc3c;
  transform-origin: 100px 92px;
  transform: scaleY(0.04);
  transition: transform 0.5s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.g-pupil {
  fill: #0b0d1b;
  opacity: 0;
  transition: opacity 0.15s 0.1s;
}

.g-hi {
  fill: #fff;
  opacity: 0;
  transition: opacity 0.2s 0.25s;
}

.g-chain {
  stroke: var(--gold);
  stroke-width: 3;
  stroke-dasharray: 1 7;
}

#gate.ready .g-eye {
  transform: none;
}

#gate.ready .g-pupil,
#gate.ready .g-hi {
  opacity: 1;
}

.g-go {
  font-size: clamp(19px, 5vw, 24px);
  letter-spacing: 0.1em;
  color: var(--dim);
}

#gate.ready .g-go {
  color: var(--paper);
}

.g-snd {
  align-self: end;
}

/* 丸く開いてタイトルへ */
#gate.open {
  pointer-events: none;
  animation: irisOpen 0.9s cubic-bezier(0.6, 0, 0.2, 1) forwards;
  -webkit-mask: radial-gradient(circle at 50% 46%, transparent var(--iris), #000 calc(var(--iris) + 1px));
  mask: radial-gradient(circle at 50% 46%, transparent var(--iris), #000 calc(var(--iris) + 1px));
}

@property --iris {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@keyframes irisOpen {
  0% { --iris: 0px; }
  35% { --iris: 13vmin; }
  50% { --iris: 12vmin; }
  100% { --iris: 130vmax; }
}

/* タイトル */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#title {
  background: linear-gradient(to top, rgba(6, 7, 16, 0.94) 0%, rgba(6, 7, 16, 0.5) 42%, rgba(6, 7, 16, 0) 66%);
}

#title .sheet {
  width: min(620px, 100%);
  gap: 12px;
}

.logo {
  margin: 0;
  line-height: 0;
  font-size: 0;
}

.lg {
  width: min(100%, 430px);
  height: auto;
  overflow: visible;
}

.lg-sh {
  fill: #0b0718;
  stroke: #0b0718;
  stroke-width: 5.4;
  stroke-linejoin: round;
}

.lg-ol {
  fill: #1b1030;
  stroke: #1b1030;
  stroke-width: 5.4;
  stroke-linejoin: round;
}

.lg-twa, .lg-mono { fill: url(#lgF); }
.lg-kai, .lg-wave { fill: #e2414a; }
.lg-en { fill: #f2d9a0; }
.lg .l { transform-box: fill-box; transform-origin: 50% 100%; }

.t-main .btn {
  font-size: 20px;
  min-height: 56px;
  padding: 12px 30px;
}

.t-main #newBtn:not(.red) {
  font-size: 16px;
  min-height: 48px;
  padding: 10px 18px;
}

.t-sub {
  gap: 8px;
}

.t-sub .btn.ghost {
  font-size: clamp(13px, 3.7vw, 15px);
  padding: 9px clamp(8px, 2.6vw, 14px);
}

@media (min-width: 760px) and (min-height: 620px) {
  #title {
    background:
      linear-gradient(to right, rgba(9, 8, 32, 0.86) 0%, rgba(9, 8, 32, 0.5) 34%, rgba(9, 8, 32, 0) 60%),
      linear-gradient(to top, rgba(6, 7, 16, 0.7) 0%, rgba(6, 7, 16, 0) 34%);
    padding-left: max(48px, 5vw);
  }
  #title .sheet {
    gap: 16px;
    margin-bottom: auto;
  }
  .lg {
    width: min(44vw, 68vh, 640px);
    margin: 0 0 14px -8px;
  }
}

/* 背の低い画面：ロゴを小さくして、はみ出さないように */
@media (max-height: 560px) {
  .lg { width: min(100%, 46vh); }
}

#pauseHelp {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  width: fit-content;
  max-width: 100%;
  padding: 9px 11px;
  background: rgba(14, 17, 34, 0.78);
  border: 1px solid var(--line);
  border-top: 2px solid var(--line-brass);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.tag.tsay {
  font: 14px var(--f-jp);
  padding: 6px 11px 5px;
  border: 2px solid #120c1e;
  border-radius: 9px;
  box-shadow: 0 3px 0 rgba(6, 7, 16, 0.45);
  pointer-events: none;
  margin-top: -10px;
  z-index: 1;
}

.tag.tsay::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  margin-left: -7px;
  border: 7px solid transparent;
  border-bottom: 0;
  border-top-color: #120c1e;
}

.title-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  align-items: center;
  font: 12px/1.6 var(--f-body);
  color: var(--dim);
}

/* リンクの区切りは「 / 」。折り返しても行の頭に来ないように、前のリンクの後ろに付ける */
.slash {
  gap: 0;
}

.slash > *:not(:last-child)::after {
  content: "/";
  display: inline-block;
  margin: 0 0.7em;
  color: var(--dim);
  opacity: 0.75;
}

/* AMIX とトミナガハルキの間だけは「｜」（本人の指定・2026-12-02） */
.slash > .pair::after {
  content: "｜";
  margin: 0 .2em;
}


.title-links a {
  position: relative;
  display: inline-block;
  padding: 3px 0;   /* 折り返したときの行間を詰める（2026-12-04 本人）。押せる広さは ::before で上下に足す */
  color: var(--dim);
  text-decoration: none;
}

.title-links a::before {
  content: "";
  position: absolute;
  inset: -8px -4px;
}

.title-links a:hover {
  color: var(--gold);
}

/* 予告状 */
#card {
  align-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 55%, rgba(20, 22, 48, 0.55) 0%, rgba(6, 7, 16, 0.94) 70%);
}

#card .notice {
  position: relative;
  width: min(380px, 100%);
  background: var(--paper);
  color: var(--paper-ink);
  padding: 18px 22px 18px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.5), inset 0 0 0 4px var(--paper), inset 0 0 0 5px rgba(28, 24, 38, 0.14);
  border: 2px solid var(--paper-line);
  transform: rotate(-2deg);
  display: grid;
  gap: 10px;
  margin: auto;
  z-index: 1;
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, rgba(140, 110, 70, 0.13) 27px 28px);
}

.sig-logo {
  width: min(236px, 62vw);
  height: auto;
  opacity: 0.9;
}

.fin-logo {
  line-height: 0;
}

.fin-logo img {
  width: min(86vw, 46vh, 420px);
  height: auto;
  margin-left: -8px;
}

.notice .h {
  font-size: 24px;
  letter-spacing: 0.4em;
  text-align: center;
  border-bottom: 2px solid var(--paper-ink);
  padding-bottom: 6px;
}

.notice .h span {
  display: inline-block;
}

.notice p {
  margin: 0;
  text-align: justify;   /* 和文の本文は両端そろえ（最後の行は左） */
  font-size: 16px;
  line-height: 1.7;
  min-height: 3.4em;
  word-break: normal;   /* ふつうの和文の組み方（2026-12-03 本人。文節改行だと、長い文節が入りきらないとき行頭に約物が出た） */
  line-break: strict;   /* 行頭に 。、」ゃっ などを出さない */
  overflow-wrap: break-word;
}

.notice #cardRest {
  visibility: hidden;
  font-style: normal;
}

.notice .sig {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 15px;
}

.notice .mark {
  width: 34px;
  height: 26px;
  flex: none;
  overflow: visible;
}

.notice .mark path,
.notice .mark circle {
  fill: none;
  stroke: var(--paper-ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notice .mark .band {
  stroke: var(--cape);
}

.notice .swish {
  position: absolute;
  right: 0;
  bottom: -7px;
  width: 72%;
  height: 10px;
  overflow: visible;
}

.notice .swish path {
  fill: none;
  stroke: var(--cape);
  stroke-width: 2;
  stroke-linecap: round;
}

.notice .ps {
  font-size: 13px;
  color: #7a6a5a;
}

.notice .stamp {
  position: absolute;
  right: 10px;
  top: 8px;
  font-size: 19px;
  letter-spacing: 0.06em;
  color: var(--cape);
  border: 4px double var(--cape);
  padding: 5px 11px 4px;
  background: rgba(242, 233, 212, 0.55);
  transform: rotate(-8deg);
  opacity: 0;
  pointer-events: none;
}

.notice .stamp::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 3px solid var(--cape);
  opacity: 0;
}

.notice .hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -38px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--paper);
  opacity: 0;
  pointer-events: none;
}

#card .beams {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

#card .beam {
  position: absolute;
  bottom: -38vh;
  width: 30vmax;
  height: 150vmax;
  transform-origin: 50% 100%;
  background: linear-gradient(to top, rgba(255, 236, 190, 0.16), rgba(255, 236, 190, 0.04) 45%, rgba(255, 236, 190, 0) 70%);
  clip-path: polygon(47% 100%, 53% 100%, 100% 0, 0 0);
}

#card .beam.b1 {
  left: 6%;
  margin-left: -14vmax;
}

#card .beam.b2 {
  right: 6%;
  margin-right: -14vmax;
}

#card .spark,
#card .twinkle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -4px;
  background: var(--gold);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

#card .twinkle {
  left: auto;
  top: 12%;
  right: 14%;
  width: 22px;
  height: 22px;
  margin: 0;
}

/* 作戦ボード */
#plan {
  background: linear-gradient(to top, rgba(6, 7, 16, 0.95) 0%, rgba(6, 7, 16, 0.82) 100%);
}

#plan .sheet {
  width: min(1240px, 100%);
}

.plan-grid {
  display: grid;
  margin-top: 10px;
  gap: 14px 22px;
  min-width: 0;
}

.plan-map {
  position: relative;
  margin: 0;
  padding: 9px 9px 8px;
  background: #e9f0ff;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.45);
  transform: rotate(-0.7deg);
  align-self: start;
}

.plan-map::before,
.plan-map::after {
  content: "";
  position: absolute;
  top: -11px;
  width: 64px;
  height: 22px;
  background: rgba(242, 214, 140, 0.86);
}

.plan-map::before { left: -16px; transform: rotate(-38deg); }
.plan-map::after { right: -16px; transform: rotate(38deg); }

.plan-map canvas {
  display: block;
  width: 100%;
  height: auto;
}

.plan-map figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 14px;
  padding: 7px 4px 0;
  font: 13px/1.5 var(--f-body);
  color: #22376e;
}

.pm-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pm-key i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e2414a;
}

.pm-key .k-pr { border-radius: 0; background: #e0a41c; clip-path: polygon(20% 0, 50% 30%, 80% 0, 100% 20%, 70% 50%, 100% 80%, 80% 100%, 50% 70%, 20% 100%, 0 80%, 30% 50%, 0 20%); }
.pm-key .k-gd { width: 20px; height: 4px; border-radius: 0; background: repeating-linear-gradient(to right, #e66a5a 0 4px, transparent 4px 8px); }

#planMapNote {
  flex-basis: 100%;
}

.plan-pick {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.plan-go {
  position: sticky;
  bottom: calc(-1 * (env(safe-area-inset-bottom, 0px) + var(--tb) + 20px));
  z-index: 2;
  margin: 0 -16px;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + var(--tb) + 16px);
  padding-top: 22px;
  background: linear-gradient(to top, #06070f calc(100% - 20px), rgba(6, 7, 15, 0));
}

@media (min-width: 900px) {
  .plan-grid {
    grid-template-columns: minmax(380px, 0.92fr) minmax(0, 1.2fr);
    align-items: start;
  }
  .plan-go {
    position: static;
    margin: 0;
    padding: 0;
    background: none;
  }
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
}

.card {
  display: grid;
  align-content: start;
  gap: 4px;
  text-align: left;
  min-height: 44px;
  padding: 10px 11px 11px;
  background: var(--paper);
  color: var(--paper-ink);
  border: 2px solid transparent;
  border-bottom: 3px solid var(--paper-line);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  min-width: 0;
  transition: transform 80ms ease, border-color 140ms ease;
}

.card:not(:disabled):active {
  transform: translateY(2px);
}

@media (hover: hover) {
  .card:not(:disabled):hover {
    border-color: var(--gold);
  }
}

.card .n {
  font-size: 19px;
  line-height: 1.35;
}

.card .d {
  font: 14px/1.6 var(--f-body);
  color: #4f4254;
}

.card .q {
  font: 600 12px/1.2 var(--f-mono);
  letter-spacing: 0.1em;
  color: #7c6b58;
  display: inline-flex;
  align-items: center;
}

/* 作戦ボード：選んだカードは明るい紙と赤い帯、選んでいないカードは少し暗く */
#plan .card:not(:disabled) {
  border-width: 3px;
  background: #d3cab7;
  border-bottom-color: #ab9f88;
}

#plan .card .q {
  gap: 7px;
  min-height: 20px;
  letter-spacing: 0.04em;
}

#plan .card .q b {
  font: 700 14px/1.2 var(--f-body);
  letter-spacing: 0;
}

#plan .card .q em {
  margin-left: auto;
  font-style: normal;
  font-size: 14px;
}

#plan .card .ck {
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid #7c6b58;
  border-radius: 3px;
}

#plan .card .ck svg {
  width: 15px;
  height: 15px;
}

#plan .card .n {
  word-break: keep-all;   /* 中央そろえの短い文は文節で折り返す（js/ui/phrase.js）。ふつうの組み方だと「もどっ|て」と語の途中で割れた（2026-12-03） */
  line-break: strict;
  overflow-wrap: anywhere;
}

#plan .card .n .ic-tool {
  width: 21px;
  height: 21px;
  margin-right: 6px;
  vertical-align: -4px;
}

#plan .card[aria-pressed="true"] {
  background: #fffaf0;
  border-color: var(--cape);
  border-bottom-color: var(--cape-deep);
}

#plan .card[aria-pressed="true"] .q {
  display: flex;
  margin: -10px -11px 4px;
  padding: 7px 11px 7px 14px;
  background: var(--cape);
  color: #fff;
}

#plan .card[aria-pressed="true"] .ck {
  border-color: #fff;
  background: #fff;
  color: var(--cape);
}

.plan-pack {
  flex: 1 0 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  max-width: 560px;
}

.pk-h {
  font: 14px/1.2 var(--f-body);
  color: var(--dim);
}

.pk {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 38px;
  padding: 4px 8px;
  border: 2px dashed var(--line);
  border-radius: var(--r-btn);
  font: 13px/1.25 var(--f-body);
  color: var(--dim);
}

.pk.on {
  justify-content: flex-start;
  border: 2px solid var(--gold);
  background: #2a2340;
  color: #fff;
}

.pk svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--gold);
}

.pk b {
  min-width: 0;
  font-weight: 700;
}

.pk em {
  margin-left: auto;
  font: 600 13px/1 var(--f-mono);
  color: var(--gold);
}

.pk.new {
  animation: pkIn 0.32s cubic-bezier(0.2, 1.5, 0.4, 1);
}

@keyframes pkIn {
  from { transform: scale(0.82); }
}

@media (prefers-reduced-motion: reduce) {
  .pk.new { animation: none; }
}

.card:disabled {
  background: #3a3b55;
  color: #9ea2c9;
  border-bottom-color: #24253b;
  cursor: default;
}

.card:disabled .d {
  color: #9ea2c9;
}

.card:disabled .q {
  color: #9ea2c9;
}

.sec {
  display: grid;
  gap: 6px;
}

.sec .k {
  font: 14px var(--f-px);
  letter-spacing: 0.18em;
  color: var(--gold);
}

.sec .k span {
  font-family: var(--f-jp);
  letter-spacing: 0;
  color: var(--dim);
  margin-left: 6px;
}

/* メモ */
.memo {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.memo li {
  padding: 10px 12px 11px;
  background: var(--paper);
  color: var(--paper-ink);
  border-bottom: 2px solid var(--paper-line);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  display: grid;
  gap: 3px;
}

.memo li .t {
  font-size: 18px;
}

.memo li .d {
  font: 14px/1.6 var(--f-body);
  color: #4f4254;
}

.memo li.no {
  background: #2a2b48;
  color: #9ea2c9;
  border-bottom-color: #1c1d34;
}

.memo li.no .d {
  color: #9ea2c9;
}

/* 結果 */
.stats {
  --fs: 17px;
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 18px;
  align-items: baseline;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--line-brass);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  font-size: 17px;
}

.stats dt {
  color: var(--dim);
}

.stats dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.rank {
  display: inline-block;
  white-space: nowrap;   /* 「一流の怪盗」の「盗」だけが次の行に落ちていた */
  justify-self: start;
  padding: 3px 12px;
  border: 2px solid var(--gold);
  background: rgba(234, 184, 77, 0.12);
  transform: rotate(-2deg);
  transform-origin: left center;
  font-size: 26px;
  color: var(--gold);
}

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

.ev canvas {
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
  border: 1px solid var(--alert);
  background: #000;
}

.ev p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}

.ev b {
  font: 700 20px var(--f-px);
  color: var(--alert);
}

@media (max-width: 420px) {
  .ev {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

.chap {
  display: grid;
  gap: 6px;
}

.chap div {
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--line-brass);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  display: grid;
  gap: 3px;
}

.chap .k {
  font: 600 13px var(--f-mono);
  letter-spacing: 0.16em;
  color: var(--gold);
}

.chap .t {
  font-size: 18px;
}

.chap .d {
  font: 14px/1.6 var(--f-body);
  color: var(--dim);
}

.chap .secret {
  opacity: 0.62;
  border-top-color: var(--line);
}

.chap .best {
  font-size: 14px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* あそびかたモーダル */
#help .sheet {
  width: min(920px, 100%);
}

.help-grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 700px) {
  .help-grid {
    grid-template-columns: 1fr 1fr;
  }
  .help-card.wide {
    grid-column: 1 / -1;
  }
  .help-card.wide .help-eyes {
    grid-template-columns: repeat(3, 1fr);
  }
}

.help-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 13px 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--line-brass);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.help-card h3 {
  margin: 0;
  font: 400 16px/1.3 var(--f-jp);
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-card p,
.help-card li {
  margin: 0;
  font: 15px/1.65 var(--f-body);
  color: var(--text);
}

.help-card kbd {
  font: 600 11px/1.2 var(--f-mono);
  padding: 1px 5px;
  background: rgba(234, 184, 77, 0.16);
  border: 1px solid var(--line-brass);
  color: var(--gold);
}

.help-card ul {
  margin: 0;
  padding-left: 1.15em;
  display: grid;
  gap: 6px;
}

.help-eyes {
  display: grid;
  gap: 6px;
}

.help-pill {
  padding: 7px 10px;
  background: rgba(11, 13, 27, 0.85);
  border: 1px solid var(--line-brass);
  font: 14px/1.55 var(--f-body);
}

.help-pill.safe {
  border-color: rgba(116, 220, 196, 0.5);
}

.help-pill.hot {
  border-color: rgba(255, 79, 66, 0.6);
}

.help-pill > b:first-child {
  display: block;
  margin: 0 0 2px;
  color: var(--gold);
  font-family: var(--f-jp);
  font-weight: 400;
}

.help-pill b:not(:first-child) {
  font: 600 11px/1.2 var(--f-mono);
  color: var(--moon);
  white-space: nowrap;
}

.help-pill.safe > b:first-child {
  color: var(--safe);
}

.help-pill.hot > b:first-child {
  color: var(--alert);
}

/* デバッグ */
#dbgChip {
  position: fixed;
  left: calc(16px + env(safe-area-inset-left, 0px));
  right: auto;
  top: auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--tb) + 12px);
  transform: none;
  z-index: 9;
  font: 600 11px var(--f-mono);
  letter-spacing: 0.12em;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  color: #120c1e;
  background: var(--gold);
  border: 0;
  opacity: 0.85;
}

@media (pointer: coarse) {
  #dbgChip {
    left: auto;
    right: calc(10px + env(safe-area-inset-right, 0px));
    top: auto;
    bottom: calc(192px + var(--tb) + env(safe-area-inset-bottom, 0px));
    transform: none;
    min-height: 44px;
    min-width: 44px;
    padding: 8px 10px;
  }
}

html[data-input="touch"] #dbgChip {
  left: auto;
  right: calc(10px + env(safe-area-inset-right, 0px));
  top: auto;
  bottom: calc(192px + var(--tb) + env(safe-area-inset-bottom, 0px));
  transform: none;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 10px;
}

#app:has(.ov:not([hidden])) #dbgChip,
#app:has(#dlg:not([hidden])) #dbgChip,
#app:has(#radio:not([hidden])) #dbgChip,
body.cine #dbgChip {
  display: none;
}

#dbgInfo {
  position: fixed;
  left: calc(10px + env(safe-area-inset-left, 0px));
  top: 42%;
  z-index: 7;
  pointer-events: none;
  white-space: pre;
  font: 11px/1.45 var(--f-mono);
  color: #e8f0ff;
  background: rgba(6, 7, 16, 0.72);
  padding: 6px 8px;
  max-width: calc(100vw - 20px);
  overflow: hidden;
}

.dbg-note {
  font-size: 13px;
  color: var(--dim);
}

.dbg-note span {
  display: block;
  color: var(--gold);
  margin-top: 4px;
}

.dbg-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dbg-row .chip[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--gold);
}

.dbg-row .chip.act {
  border-color: var(--moon-deep);
  color: var(--moon);
}

#dbgScenes {
  display: grid;
  gap: 6px;
}

#dbgScenes details {
  background: var(--panel);
  border: 1px solid var(--line);
}

#dbgScenes summary {
  padding: 9px 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 14px;
  cursor: pointer;
  list-style: none;
}

#dbgScenes summary::-webkit-details-marker {
  display: none;
}

#dbgScenes summary::before {
  content: "+";
  display: inline-block;
  width: 1.2em;
  color: var(--gold);
}

#dbgScenes details[open] summary::before {
  content: "-";
}

.dbg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  padding: 0 10px 10px;
}

.dbg-sc {
  font-size: 13px;
  text-align: left;
  min-height: 44px;
  padding: 8px 10px 7px;
  background: var(--paper);
  color: var(--paper-ink);
  border: 0;
  box-shadow: 0 2px 0 var(--paper-line);
  transition: transform 80ms ease, box-shadow 80ms ease;
}

.dbg-sc:active {
  transform: translateY(2px);
  box-shadow: none;
}

.dbg-sc[data-cur="1"] {
  background: var(--gold);
}

#fin {
  background: linear-gradient(to top, rgba(6, 7, 16, 0.94) 0%, rgba(6, 7, 16, 0.55) 48%, rgba(6, 7, 16, 0) 78%);
}

#finText .hint {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--dim);
}

.chap .rp {
  justify-self: start;
  margin-top: 6px;
  font-size: 13px;
  min-height: 44px;
  padding: 8px 12px 7px;
}

/* ムービー (上下の帯・字幕・スキップ) */
#cine {
  position: fixed;
  inset: 0;
  z-index: 15;
  --bar: max(52px, 12vmin);
  --safe: calc(var(--tb) + env(safe-area-inset-bottom, 0px));
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#cine .bar {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--bar);
  background: #000;
}

#cine .bar.top {
  top: 0;
  transform-origin: top;
}

#cine .bar.bot {
  bottom: 0;
  height: calc(var(--bar) + var(--safe));
  transform-origin: bottom;
}

@media (max-aspect-ratio: 4/5) {
  #cine {
    --bar: max(60px, 10.5vh);
  }
}

#cineBlack {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

#cineCap {
  position: absolute;
  left: calc(18px + env(safe-area-inset-left, 0px));
  top: calc(var(--bar) + 14px);
  font: clamp(16px, 1.5vw, 21px) var(--f-jp);
  letter-spacing: 0.2em;
  color: var(--paper);
  opacity: 0;
  transition: opacity 0.8s;
  text-shadow: 0 2px 0 #000, 0 0 6px rgba(0, 0, 0, 0.6);
}

#cineCap.on {
  opacity: 1;
}

#cineCap.mid {
  left: 50%;
  top: auto;
  bottom: calc(var(--bar) + var(--safe) + 22px);
  transform: translateX(-50%);
  font-size: clamp(18px, 2vw, 26px);
  white-space: nowrap;
  letter-spacing: 0.14em;
}

#cineSub {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: calc(var(--bar) + var(--safe));
  box-sizing: border-box;
  padding: 8px 18px calc(8px + var(--safe));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  background: #000;
  font: clamp(18px, 1.6vw, 23px)/1.55 var(--f-jp);
  color: #f2f0e8;
}

#cineSub b {
  font-weight: 400;
  font-size: 16px;
  white-space: nowrap;
  flex: none;
}

#cineTxt {
  max-width: 34em;
  text-align: justify;   /* 和文の本文は両端そろえ（最後の行は左） */
  word-break: normal;   /* ふつうの和文の組み方（2026-12-03 本人。文節改行だと、長い文節が入りきらないとき行頭に約物が出た） */
  line-break: strict;   /* 行頭に 。、」ゃっ などを出さない */
  overflow-wrap: break-word;
}

#cineRest {
  visibility: hidden;
  font-style: normal;
}

@media (max-width: 600px) {
  #cineSub {
    flex-direction: column;
    align-items: flex-start;
    padding-top: 10px;
  }
  #cineSub b {
    font-size: 14px;
  }
  #cineTxt {
    max-width: 100%;
  }
}

#cineSkip {
  position: absolute;
  right: calc(14px + env(safe-area-inset-right, 0px));
  top: calc(var(--bar) / 2 - 24px);
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 2px 10px;
  font: 14px var(--f-jp);
  color: #9ea2c9;
}

#cineGaugeW {
  position: absolute;
  right: calc(14px + env(safe-area-inset-right, 0px));
  top: calc(var(--bar) / 2 + 10px);
  width: 96px;
  height: 2px;
  background: #26263a;
}

#cineGauge {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
}

body.cine #hud,
body.cine #tags,
body.cine #pad,
body.cine #toolbar,
body.cine #keys,
body.cine #topR,
body.cine #radio,
body.cine #callin,
body.cine #arrow,
body.cine #arrowD,
body.cine #dbgChip,
body.cine #dbgInfo,
body.cine #toast {
  visibility: hidden;
}

/* 暗転フェード */
#fade {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #05060f;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s steps(6);
}

#fade.on {
  opacity: 1;
  pointer-events: auto;
}

#fade p {
  margin: 0;
  font-size: 22px;
  color: var(--paper);
  letter-spacing: 0.2em;
  text-align: center;
  padding: 0 16px;
}

#fade p .fk {
  display: block;
  font-size: 14px;
  letter-spacing: 0.42em;
  opacity: 0.72;
  margin-bottom: 12px;
}

#fade p .ft {
  display: block;
  font-size: 24px;
  line-height: 1.5;
}

/* ことばの途中で折り返さない（称号・時間など） */
.nw {
  white-space: nowrap;
}
