/* TRINITY トリニティ — shared tokens, type, header, buttons, departure board, toasts, footer */
@font-face { font-family: 'Dela'; src: url(/fonts/dela.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Mincho'; src: url(/fonts/mincho.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Mincho'; src: url(/fonts/mincho-b.woff2) format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Kaku'; src: url(/fonts/kaku.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Kaku'; src: url(/fonts/kaku-b.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Dot'; src: url(/fonts/dot.woff2) format('woff2'); font-display: swap; }

:root {
  --night: #05060c; --night2: #0a0c18; --ai: #141a3c; --ai2: #1e2758;
  --sakura: #ff9ec1; --sakura2: #ffd0e0; --sakura3: #ff5c95;
  --moon: #e9ecf5; --washi: #f3eee4; --mute: #a2a7c2; --dim: #62688a; --line: rgba(233, 236, 245, .12);
  --led: #ffb347; --led2: #ffd89a; --hino: #e8384f; --ok: #8ff0c0;
  --r: 18px; --pad: clamp(16px, 4.5vw, 40px);
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--night); }
body {
  min-height: 100svh; background: var(--night); color: var(--washi); overflow-x: hidden;
  font: 500 16px/1.7 'Kaku', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Noto Sans JP', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; line-break: strict;
}
html[data-lang="en"] body { line-height: 1.6; }
img, video, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.dela { font-family: 'Dela', 'Kaku', sans-serif; font-weight: 400; letter-spacing: .01em; }
.mincho { font-family: 'Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif; }
.dot { font-family: 'Dot', ui-monospace, monospace; letter-spacing: .04em; }
.wrap { width: min(1180px, 100% - 2 * var(--pad)); margin-inline: auto; }
::selection { background: var(--sakura); color: var(--night); }

/* paper grain over everything (very light) */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 90; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.petals { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* ------------------------------------------------------------------ header */
.top {
  position: fixed; inset: 0 0 auto; z-index: 70; display: flex; align-items: center; gap: 12px;
  padding: 12px var(--pad); transition: background .4s, backdrop-filter .4s, box-shadow .4s;
}
.top.solid { background: rgba(5, 6, 12, .72); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 1px 0 var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand svg { width: 34px; height: 34px; flex: none; animation: spin 18s linear infinite; }
.brand b { font-family: 'Dela', sans-serif; font-weight: 400; font-size: 17px; letter-spacing: .06em; }
.brand small { display: block; font-size: 10px; color: var(--sakura); letter-spacing: .3em; line-height: 1; margin-top: 2px; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 99px; padding: 3px; font-size: 12px; background: rgba(10, 12, 24, .5); }
.lang { flex: none; }
.lang span { padding: 4px 10px; border-radius: 99px; color: var(--mute); transition: .3s; white-space: nowrap; }
.lang span.on { background: var(--moon); color: var(--night); font-weight: 700; }
.top .btn { padding: 10px 16px; font-size: 14px; }
@media (max-width: 480px) { .top { gap: 8px; } .brand { gap: 8px; } .brand svg { width: 30px; height: 30px; } .brand b { font-size: 15px; } .brand small { display: none; } .lang { font-size: 11px; } .lang span { padding: 4px 8px; } .top .btn { padding: 9px 13px; font-size: 13px; } }

/* ------------------------------------------------------------------ buttons */
.btn {
  --b: var(--sakura); position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 26px; border-radius: 99px; text-decoration: none; font-weight: 700; letter-spacing: .04em;
  background: var(--b); color: #2a0614; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25) inset, 0 10px 40px -10px var(--sakura3);
  transition: transform .35s var(--ease), box-shadow .35s, background .3s; overflow: hidden; isolation: isolate; white-space: nowrap;
}
.btn::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%); transform: translateX(-120%); }
.btn:hover::before { transform: translateX(120%); transition: transform .8s var(--ease); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(255, 255, 255, .35) inset, 0 16px 50px -10px var(--sakura3); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.ghost { background: rgba(233, 236, 245, .06); color: var(--washi); box-shadow: 0 0 0 1px var(--line) inset; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn.ghost:hover { box-shadow: 0 0 0 1px rgba(255, 158, 193, .6) inset; }
.btn.moon { background: var(--moon); color: var(--night); box-shadow: 0 10px 40px -12px rgba(233, 236, 245, .6); }
.btn.big { padding: 19px 34px; font-size: 18px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ section heads */
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: .32em; color: var(--sakura); text-transform: uppercase; }
.eyebrow::before { content: ''; width: 26px; height: 1px; background: currentColor; }
.h2 { font-family: 'Dela', 'Kaku', sans-serif; font-weight: 400; font-size: clamp(34px, 7.4vw, 76px); line-height: 1.08; letter-spacing: .01em; margin: 14px 0 12px; }
html[data-lang="en"] .h2 { letter-spacing: -.005em; }
.lede { color: var(--mute); font-size: clamp(15px, 2.1vw, 18px); max-width: 560px; }
.pink { color: var(--sakura); }

/* ------------------------------------------------------------------ departure board (発車標) */
.board {
  position: relative; border-radius: 16px; padding: 14px; background: linear-gradient(#0c0d14, #07080d);
  box-shadow: 0 0 0 1px #23263a inset, 0 0 0 6px #0e1019, 0 0 0 7px #2a2e44, 0 40px 90px -30px #000;
}
.board::before { /* bolts */
  content: ''; position: absolute; inset: 6px; border-radius: 12px; pointer-events: none;
  background: radial-gradient(circle at 6px 6px, #3a3f5a 2px, transparent 3px) 0 0 / 100% 100% no-repeat,
    radial-gradient(circle at calc(100% - 6px) 6px, #3a3f5a 2px, transparent 3px), radial-gradient(circle at 6px calc(100% - 6px), #3a3f5a 2px, transparent 3px),
    radial-gradient(circle at calc(100% - 6px) calc(100% - 6px), #3a3f5a 2px, transparent 3px);
}
.bd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 8px 12px; border-bottom: 1px dashed #262a3e; }
.bd-head .dot { color: var(--led); font-size: clamp(15px, 2.6vw, 20px); text-shadow: 0 0 10px rgba(255, 179, 71, .55); }
.bd-clock { color: var(--ok) !important; text-shadow: 0 0 10px rgba(143, 240, 192, .5) !important; font-size: 15px !important; }
.bd-cols, .bd-row { display: grid; grid-template-columns: 1.3fr 2.4fr 1.4fr 1.2fr; gap: 10px; align-items: center; }
.bd-cols { padding: 10px 10px 6px; font-size: 11px; letter-spacing: .14em; color: #6f7591; }
.bd-rows { list-style: none; display: grid; gap: 6px; min-height: 120px; align-content: start; }
.bd-row {
  padding: 10px; border-radius: 8px; background: #0f111b; box-shadow: 0 1px 0 #1b1e2d inset, 0 -1px 0 #05060a inset;
  font-family: 'Dot', ui-monospace, monospace; font-size: clamp(13px, 2.2vw, 16px); color: var(--led); text-shadow: 0 0 8px rgba(255, 179, 71, .45);
  transform-origin: 50% 0; perspective: 600px; min-width: 0;
}
.bd-row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-row.lead { color: var(--moon); text-shadow: 0 0 10px rgba(233, 236, 245, .4); background: #12142a; }
.bd-row.lead .bd-st { color: var(--ok); text-shadow: 0 0 8px rgba(143, 240, 192, .55); animation: blink 1.4s steps(2) infinite; }
.bd-row .bd-who { display: flex; align-items: center; gap: 8px; color: var(--moon); text-shadow: none; font-family: 'Kaku', sans-serif; font-weight: 700; font-size: 14px; }
.bd-row .bd-who a { text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.bd-row .av { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; background: var(--avc, #333); color: #111; overflow: hidden; }
.bd-row .av img { width: 100%; height: 100%; object-fit: cover; }
.bd-row .amt { text-align: right; }
.bd-st { text-align: right; font-size: .92em; }
.bd-st a { color: var(--ok); text-shadow: 0 0 8px rgba(143, 240, 192, .5); text-decoration: none; }
.bd-st a:hover { text-decoration: underline; }
.bd-st.wait { color: #8a90ad; text-shadow: none; }
.bd-row.flip > * { animation: flap .55s var(--ease) both; }
.bd-row.flip > *:nth-child(2) { animation-delay: .06s; } .bd-row.flip > *:nth-child(3) { animation-delay: .12s; } .bd-row.flip > *:nth-child(4) { animation-delay: .18s; }
@keyframes flap { 0% { transform: rotateX(-95deg); opacity: 0; } 60% { transform: rotateX(12deg); opacity: 1; } 100% { transform: none; } }
@keyframes blink { 50% { opacity: .35; } }
.bd-empty { padding: 24px 10px; text-align: center; color: #7d83a3; font-family: 'Dot', monospace; }
.bd-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.bd-stats div { padding: 12px; border-radius: 10px; background: #0d0f19; box-shadow: 0 0 0 1px #1d2033 inset; text-align: center; }
.bd-stats b { display: block; font-family: 'Dot', monospace; font-weight: 400; font-size: clamp(20px, 4vw, 30px); color: var(--led); text-shadow: 0 0 12px rgba(255, 179, 71, .5); line-height: 1.2; }
.bd-stats span { font-size: 11px; letter-spacing: .14em; color: #7d83a3; }
.bd-more { display: block; margin: 12px auto 0; padding: 9px 18px; font-size: 13px; color: var(--mute); border-radius: 99px; box-shadow: 0 0 0 1px #262a3e inset; }
.bd-more:hover { color: var(--washi); }
.bd-more[hidden], [hidden] { display: none !important; }
@media (max-width: 640px) {
  .bd-cols { display: none; }
  .bd-row { grid-template-columns: 1fr auto; grid-template-areas: 'who st' 'amt time'; row-gap: 2px; }
  .bd-row .bd-who { grid-area: who; } .bd-row .bd-st { grid-area: st; } .bd-row .amt { grid-area: amt; text-align: left; } .bd-row .tm { grid-area: time; text-align: right; color: #7d83a3; text-shadow: none; font-size: 12px; }
  .bd-row.lead { grid-template-areas: 'tm st' 'who amt'; }
  .bd-row.lead .tm { grid-area: tm; text-align: left; color: var(--moon); font-size: inherit; }
  .bd-row.lead .bd-who { grid-area: who; } .bd-row.lead .amt { grid-area: amt; text-align: right; }
}

/* ------------------------------------------------------------------ route map (路線図): 1,000 passengers per station, last stop the moon */
.route { padding: 12px 6px 4px; border-bottom: 1px dashed #262a3e; }
.rt-title { font-size: 12px; letter-spacing: .12em; color: #7d83a3; padding: 0 4px 6px; }
.rt-line { list-style: none; display: flex; overflow-x: auto; padding: 34px 10px 10px; scroll-behavior: smooth; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.rt-st { position: relative; flex: 0 0 clamp(78px, 9vw, 96px); display: grid; justify-items: center; gap: 2px; padding-top: 10px; text-align: center; }
.rt-seg { position: absolute; left: -50%; right: 50%; top: 15px; height: 4px; border-radius: 2px; background: #22263a; overflow: hidden; }
.rt-st:first-child .rt-seg { display: none; }
.rt-seg i { display: block; height: 100%; background: linear-gradient(90deg, var(--sakura3), var(--sakura)); box-shadow: 0 0 10px var(--sakura3); }
.rt-dot { position: relative; z-index: 1; width: 14px; height: 14px; border-radius: 50%; background: #0c0d14; box-shadow: 0 0 0 3px #3a3f5a; margin-top: -1px; }
.rt-name { font-family: 'Kaku', sans-serif; font-weight: 700; font-size: 14px; color: #8a90ad; margin-top: 6px; white-space: nowrap; }
.rt-st small { font-family: 'Dot', monospace; font-size: 11px; color: #5d6384; white-space: nowrap; }
.rt-st.past .rt-dot { background: var(--sakura); box-shadow: 0 0 0 3px rgba(255, 158, 193, .35); }
.rt-st.past .rt-name { color: var(--washi); } .rt-st.past small { color: var(--sakura); }
.rt-st.now .rt-dot { width: 20px; height: 20px; margin-top: -4px; background: var(--led); box-shadow: 0 0 0 4px rgba(255, 179, 71, .3), 0 0 18px var(--led); animation: ping2 1.6s infinite; }
.rt-st.now .rt-name { color: var(--led); font-size: 16px; text-shadow: 0 0 10px rgba(255, 179, 71, .5); }
.rt-st.now small { color: var(--led2); }
.rt-st.now .rt-seg i { background: linear-gradient(90deg, var(--sakura), var(--led)); }
@keyframes ping2 { 70% { box-shadow: 0 0 0 12px rgba(255, 179, 71, 0), 0 0 18px var(--led); } }
.rt-train { position: absolute; top: -22px; left: 50%; translate: -50% 0; width: 46px; height: 16px; border-radius: 10px 14px 4px 4px; background: linear-gradient(#f3eee4, #c9cbd8); box-shadow: 0 0 14px rgba(233, 236, 245, .45); animation: hum 1.2s ease-in-out infinite; }
.rt-train::before { content: ''; position: absolute; left: 6px; right: 12px; top: 4px; height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, #1b2350 0 6px, transparent 6px 9px); }
.rt-train::after { content: ''; position: absolute; left: 0; right: 0; bottom: 3px; height: 2px; background: var(--sakura3); }
@keyframes hum { 50% { translate: -50% -1px; } }
.rt-st.moon .rt-dot { width: 22px; height: 22px; margin-top: -5px; background: radial-gradient(circle at 35% 35%, #fff, #c9cbd8 60%, #8a8fa8); box-shadow: 0 0 20px rgba(233, 236, 245, .6); }
.rt-st.moon .rt-name { color: var(--moon); }
.bd-row .stn { font-style: normal; font-family: 'Kaku', sans-serif; font-weight: 700; font-size: 11px; padding: 1px 7px; border-radius: 4px; background: rgba(255, 179, 71, .12); color: var(--led); flex: none; }

/* live counter */
.live-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 6px 14px; border-radius: 99px; font-size: 13px; color: var(--washi); background: rgba(10, 12, 24, .6); box-shadow: 0 0 0 1px rgba(255, 179, 71, .35) inset; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.live-chip:empty { display: none; }
.live-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: blink 1.6s steps(2) infinite; }
.live-chip b, .chips .live b { font-family: 'Dot', monospace; font-weight: 400; color: var(--led); font-size: 1.1em; }

/* ------------------------------------------------------------------ toast + live pops */
.toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 95; transform: translate(-50%, 140%);
  padding: 12px 18px; border-radius: 14px; background: rgba(20, 24, 50, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 0 1px rgba(255, 158, 193, .35) inset, 0 20px 50px -10px #000; font-size: 14px; max-width: min(92vw, 460px); transition: transform .5s var(--ease);
}
.toast.show { transform: translate(-50%, 0); }
.toast.bad { box-shadow: 0 0 0 1px rgba(232, 56, 79, .6) inset, 0 20px 50px -10px #000; }
.pops { position: fixed; left: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 80; display: grid; gap: 8px; pointer-events: none; width: min(340px, calc(100vw - 24px)); }
.pop {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.35;
  background: rgba(10, 12, 26, .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 0 0 1px rgba(143, 240, 192, .3) inset, 0 14px 30px -12px #000;
  animation: popin .6s var(--ease) both; pointer-events: auto;
}
.pop.out { animation: popout .5s ease both; }
.pop i { font-style: normal; font-size: 18px; }
.pop b { color: var(--sakura2); } .pop em { font-style: normal; color: var(--led); font-family: 'Dot', monospace; }
.pop a { color: var(--ok); text-decoration: none; margin-left: auto; font-size: 12px; white-space: nowrap; }
@keyframes popin { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes popout { to { opacity: 0; transform: translateX(-30px); } }

/* ------------------------------------------------------------------ footer */
.foot { position: relative; padding: 46px var(--pad) calc(36px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); text-align: center; color: var(--dim); font-size: 13px; background: var(--night); z-index: 2; }
.foot .brand { justify-content: center; margin: 0 0 12px; }
.foot nav { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.foot a { color: var(--mute); text-decoration: none; } .foot a:hover { color: var(--sakura); }

/* reveal on scroll */
[data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
[data-reveal].seen { opacity: 1; transform: none; }
html.lang-swap [data-t], html.lang-swap [data-th] { animation: swapin .45s ease; }
@keyframes swapin { from { opacity: 0; filter: blur(4px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
