/* SUNABA title: the running sandbox stays visible behind a quiet graphic frame. */
@font-face {
  font-family: "SUNABA Brush";
  src: url("fonts/sunaba-brush.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: block;
  unicode-range: U+5834, U+7802;
}
body.at-title > :not(#modeVeil):not(#geoVeil):not(#view):not(.vignette):not(script) {
  visibility: hidden;
}
body.at-title #view,
body.at-title .vignette { visibility: visible !important; }
body.at-title #view { pointer-events: none; }

#modeVeil.title-veil {
  --title-ivory: #f8f2e7;
  --title-dim: #d0d3c7;
  --title-dark: #1c2724;
  --title-orange: #e9a350;
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  overflow-y: auto;
  padding: max(26px, env(safe-area-inset-top)) max(30px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(30px, env(safe-area-inset-left));
  color: var(--title-ivory);
  background:
    linear-gradient(180deg, rgba(19, 27, 24, .55) 0%, rgba(23, 28, 23, .17) 32%, rgba(18, 25, 23, .34) 61%, rgba(18, 24, 23, .75) 100%),
    linear-gradient(90deg, rgba(13, 24, 22, .27), transparent 42%, rgba(13, 24, 22, .13));
  text-shadow: 0 2px 20px rgba(5, 13, 12, .33);
  -webkit-font-smoothing: antialiased;
}
#modeVeil.title-veil.open { display: flex; }
#modeVeil.title-veil::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 12px;
  border: 1px solid rgba(248, 242, 231, .2);
  pointer-events: none;
}
#modeVeil.title-veil button { cursor: pointer; }
#modeVeil.title-veil.keyboard-nav button:focus-visible,
#modeVeil.title-veil.keyboard-nav input:focus-visible {
  outline: 3px solid var(--title-orange);
  outline-offset: 4px;
}

.title-top,
.title-bottom {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex: 0 0 auto;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", "Noto Sans Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.title-top { padding: 6px 8px 0; }
.title-bottom { padding: 0 8px 2px; align-items: flex-end; color: var(--title-dim); }
.title-top p,
.title-bottom p { margin: 0; }
.title-top .corner-meta,
.title-bottom .title-caption { text-align: right; opacity: .86; }
.title-top .brand-index::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 11px 1px 0;
  border-radius: 50%;
  background: var(--title-orange);
  box-shadow: 0 0 0 3px rgba(233, 163, 80, .16);
}

.title-landing,
.title-choose {
  width: 100%;
  min-height: 0;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  animation: title-rise .72s cubic-bezier(.2,.7,.2,1) both;
}
.title-landing { position: relative; isolation: isolate; padding: 24px 0 30px; transform: translateY(-2vh); }
.title-calligraphy {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 43%;
  width: max-content;
  color: #101a15;
  opacity: .28;
  font-family: "SUNABA Brush", cursive;
  font-size: min(43vw, 530px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.09em;
  white-space: nowrap;
  text-shadow: none;
  transform: translate(-50%, -50%) rotate(-8deg);
  pointer-events: none;
  user-select: none;
}
.title-eyebrow {
  margin: 0 0 clamp(24px, 5vh, 50px);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", "Noto Sans Mono", monospace;
  font-size: clamp(10px, 1.15vw, 12px);
  font-weight: 600;
  letter-spacing: .3em;
  line-height: 1.6;
  text-transform: uppercase;
  color: var(--title-ivory);
}
.title-eyebrow::before,
.title-eyebrow::after { content: "·"; padding: 0 1em; color: var(--title-orange); }
#titleName {
  width: min(78vw, 900px);
  max-width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 0 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}
.title-logo {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 5px 18px rgba(4, 11, 10, .35));
}
.title-copy {
  margin: clamp(22px, 4vh, 42px) 0 0 !important;
  color: var(--title-ivory);
  font-size: clamp(14px, 1.5vw, 18px) !important;
  font-weight: 500;
  line-height: 1.8 !important;
  letter-spacing: .13em;
}

.title-enter {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 44px;
  min-width: min(300px, 80vw);
  min-height: 72px;
  margin-top: clamp(34px, 7vh, 78px);
  padding: 0 24px 0 27px;
  border: 1px solid rgba(255, 255, 255, .86);
  border-radius: 2px;
  background: var(--title-ivory);
  color: var(--title-dark);
  box-shadow: 0 12px 30px rgba(9, 18, 17, .2);
  text-shadow: none;
  transition: transform .24s ease, background .24s ease, box-shadow .24s ease;
}
.title-enter::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--title-orange);
}
.title-enter:hover {
  transform: translateY(-3px);
  background: #fff9ee;
  box-shadow: 0 18px 36px rgba(9, 18, 17, .3);
}
.title-enter:active { transform: translateY(0); }
.title-enter .pixel-label {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", "Noto Sans Mono", monospace;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .24em;
  line-height: 1;
}
.title-enter .title-arrow { font-size: 27px; font-weight: 300; line-height: 1; color: #bd6f2f; }
.start-note {
  margin: 18px 0 0;
  font-family: ui-monospace, "SFMono-Regular", "Noto Sans Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .15em;
  line-height: 1.6;
  color: var(--title-dim);
}

.title-choose {
  max-width: 900px;
  padding: 4px 0 14px;
}
.title-back {
  align-self: flex-start;
  min-height: 42px;
  padding: 0 0 0 1px;
  border: 0;
  background: transparent;
  color: var(--title-ivory);
  font-family: ui-monospace, "SFMono-Regular", "Noto Sans Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .17em;
  text-transform: uppercase;
  text-shadow: inherit;
}
.title-back:hover { color: var(--title-orange); }
.title-choose .title-eyebrow { margin: 12px 0 9px; }
.title-choose h2 {
  margin: 0 0 28px;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 500;
  letter-spacing: .08em;
  line-height: 1.35;
}
.title-modes {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 24px);
}
.title-modes button {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto minmax(95px, 1fr) auto auto auto;
  align-items: end;
  min-height: 285px;
  padding: 20px 24px 22px;
  border: 1px solid rgba(248, 242, 231, .42);
  border-radius: 3px;
  background: rgba(20, 30, 27, .58);
  color: var(--title-ivory);
  text-align: left;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.title-modes button:hover,
.title-modes button[aria-checked="true"] {
  border-color: var(--title-ivory);
  background: rgba(25, 36, 31, .76);
  transform: translateY(-2px);
}
.title-modes button[aria-checked="true"]::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 54px;
  height: 3px;
  background: var(--title-orange);
}
.title-modes button:disabled { opacity: .38; cursor: not-allowed; }
.title-modes .mode-num {
  grid-column: 1 / -1;
  font-family: ui-monospace, "SFMono-Regular", "Noto Sans Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--title-orange);
}
.title-modes .mode-art {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 112px;
  opacity: .92;
}
.title-modes .mode-art svg {
  width: min(55%, 170px);
  max-height: 120px;
  overflow: visible;
  filter: drop-shadow(0 7px 12px rgba(0, 0, 0, .16));
}
.title-modes .mode-word {
  grid-column: 1;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", "Noto Sans Mono", monospace;
  font-size: clamp(23px, 3.3vw, 37px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: .06em;
}
.title-modes .mode-arrow {
  grid-column: 2;
  grid-row: 3 / 5;
  align-self: center;
  font-size: 25px;
  line-height: 1;
  color: var(--title-orange);
}
.title-modes .mode-ja {
  grid-column: 1;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--title-dim);
}
.title-modes .mode-desc {
  grid-column: 1 / -1;
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--title-dim);
}
.title-note {
  max-width: 620px;
  min-height: 22px;
  margin: 18px auto 0;
  color: var(--title-dim);
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: .04em;
}
.title-choose .title-enter { margin-top: 20px; min-height: 64px; }
.title-sound {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--title-ivory);
  cursor: pointer;
  text-transform: none;
  letter-spacing: .06em;
}
.title-sound input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--title-orange);
}

@keyframes title-rise {
  from { opacity: 0; translate: 0 15px; }
  to { opacity: 1; translate: 0 0; }
}
@media (max-width: 640px) {
  #modeVeil.title-veil { gap: 10px; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); }
  #modeVeil.title-veil::before { inset: 7px; }
  .title-top, .title-bottom { padding-left: 4px; padding-right: 4px; font-size: 9px; }
  .title-top .corner-meta { max-width: 145px; }
  .title-landing { padding: 20px 0 24px; }
  .title-eyebrow { margin-bottom: 26px; font-size: 9px; letter-spacing: .2em; }
  #titleName { width: min(94vw, 550px); }
  .title-copy { margin-top: 23px !important; font-size: 14px !important; }
  .title-enter { min-width: min(268px, 85vw); min-height: 66px; margin-top: 42px; }
  .title-choose { padding-top: 0; }
  .title-choose h2 { margin-bottom: 19px; }
  .title-modes { gap: 10px; }
  .title-modes button { min-height: 238px; padding: 15px 13px 16px; grid-template-rows: auto minmax(75px,1fr) auto auto auto; }
  .title-modes .mode-art { min-height: 80px; }
  .title-modes .mode-art svg { width: min(80%, 140px); max-height: 85px; }
  .title-modes .mode-word { font-size: clamp(18px, 5vw, 27px); }
  .title-modes .mode-desc { font-size: 10px; margin-top: 8px; }
  .title-note { font-size: 11px; margin-top: 13px; }
  .title-choose .title-enter { margin-top: 12px; }
}
@media (max-width: 370px) {
  .title-modes button { padding: 12px 10px 13px; min-height: 225px; }
  .title-modes .mode-word { font-size: 17px; letter-spacing: .01em; }
  .title-modes .mode-ja { font-size: 10px; }
  .title-modes .mode-desc { font-size: 9.5px; }
}
@media (max-height: 650px) {
  .title-landing { padding: 12px 0; }
  .title-eyebrow { margin-bottom: 15px; }
  #titleName { width: min(67vw, 720px); }
  .title-copy { margin-top: 14px !important; }
  .title-enter { margin-top: 22px; min-height: 58px; }
  .title-choose h2 { margin-bottom: 12px; }
  .title-modes button { min-height: 195px; grid-template-rows: auto minmax(54px,1fr) auto auto auto; }
  .title-modes .mode-art { min-height: 57px; }
  .title-modes .mode-art svg { max-height: 68px; }
  .title-modes .mode-desc { margin-top: 5px; }
  .title-note { margin-top: 8px; }
  .title-choose .title-enter { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .title-landing, .title-choose { animation: none; }
  .title-enter, .title-modes button { transition: none; }
}

.title-modes .mode-desc { white-space: pre-line; }
@media(max-width:640px){ .title-edition { display:none; } .title-top .brand-index{max-width:195px;} }

#modeVeil.title-veil:not(.keyboard-nav) button:focus, #modeVeil.title-veil:not(.keyboard-nav) input:focus { outline:none; }

.title-launch { display:flex; gap:14px; align-items:stretch; justify-content:center; margin-top:20px; }
.title-launch .title-enter { margin-top:0; }
.title-geo { min-height:64px; padding:0 24px; border:1px solid #f8f2e780; border-radius:2px; background:#18271e80; color:#f8f2e7; font:500 14px ui-monospace,monospace; letter-spacing:.08em; }
.title-geo:hover { background:#273b2dd9; border-color:#f8f2e7; }
.geo-menu-entry { width:100%; min-height:44px; border:0; border-radius:12px; background:#f0e5d2; color:#4a3a2a; font:inherit; padding:10px 16px; margin-bottom:8px; cursor:pointer; }
/* 取りこんだ地域の札（出典の表示を兼ねる）：読める大きさと濃さ。下端まん中の取っ手（幅 80px）に かからない幅 */
#geoPlaceBadge { position:fixed; bottom:calc(8px + env(safe-area-inset-bottom)); left:calc(10px + env(safe-area-inset-left)); box-sizing:border-box; max-width:min(340px, calc(50vw - 200px)); padding:4px 8px; border-radius:10px; background:rgba(28,22,14,.66); color:#fff8e9; font:11px/1.4 ui-monospace,monospace; text-decoration:none; overflow-wrap:anywhere; z-index:3; }
#geoPlaceBadge:hover { background:rgba(28,22,14,.82); text-decoration:underline; }
/* 下の帯は いつも出ている（2026-11-18 G）。広い画面は 帯の左に、せまい画面は 帯（と 道具の上の枡目）の上に */
@media (max-width:720px) and (min-height:461px) { #geoPlaceBadge { bottom:calc(var(--dockH, 72px) + 8px); max-width:calc(100vw - 24px); } }
@media (max-height:460px) { #geoPlaceBadge { max-width:calc(50vw - 196px); } }
@media(max-width:640px){ .title-launch {flex-direction:column;gap:8px;margin-top:12px;} .title-geo {min-height:44px;} }

/* Short screens (landscape phones, small windows). The landing/choose blocks never shrink under
   the header/footer: when they still do not fit, the title scrolls instead of overlapping. */
.title-landing,
.title-choose { flex-shrink: 0; }
@media (max-height: 760px) {
  /* the rotated brush glyphs must not add invisible scroll room below the title */
  .title-calligraphy { font-size: min(43vw, 530px, 54vh); }
}
@media (max-height: 700px) {
  .title-landing { transform: none; }
  .title-choose .title-eyebrow { margin: 2px 0 6px; }
  .title-choose h2 { margin-bottom: 12px; }
  .title-modes button { min-height: 172px; grid-template-rows: auto minmax(48px,1fr) auto auto auto; padding-top: 14px; padding-bottom: 16px; }
  .title-modes .mode-art { min-height: 50px; }
  .title-modes .mode-art svg { max-height: 58px; }
}
@media (max-height: 540px) {
  #modeVeil.title-veil {
    gap: 6px;
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .title-top { padding-top: 2px; }
  .title-top .corner-meta { display: none; }
  .title-edition,
  .title-bottom .title-caption { display: none; }
  .title-landing { padding: 2px 0; }
  .title-landing .title-eyebrow { display: none; }
  #titleName { width: min(62vw, 560px, 105vh); }
  .title-copy { margin-top: 10px !important; font-size: 13px !important; line-height: 1.5 !important; }
  .title-enter { margin-top: 14px; min-height: 50px; }
  .start-note { margin-top: 8px; }
  .title-choose { padding: 0; }
  .title-back { min-height: 34px; }
  .title-choose .title-eyebrow { display: none; }
  .title-choose h2 { margin: 0 0 10px; font-size: 19px; }
  .title-modes button { min-height: 0; grid-template-rows: auto auto auto auto; padding: 10px 14px 12px; }
  .title-modes .mode-art { display: none; }
  .title-modes .mode-word { font-size: 22px; margin-top: 4px; }
  .title-modes .mode-desc { margin-top: 5px; font-size: 11px; }
  .title-note { min-height: 0; margin-top: 6px; font-size: 11px; }
  .title-launch { margin-top: 8px; gap: 8px; }
  .title-choose .title-enter { min-height: 46px; }
  .title-geo { min-height: 46px; }
}
@media (max-height: 540px) and (min-width: 560px) {
  .title-launch { flex-direction: row; }
  .title-choose .title-enter { min-width: 0; gap: 28px; }
}
@media (max-height: 540px) and (max-width: 559px) {
  .title-launch .title-enter { min-height: 46px; }
  .title-geo { min-height: 40px; }
}
