/* VOICE: friendly, calm, instantly useful at a shop counter
   IDEA: a laminated "point-and-show" card a traveler holds up to staff
   PICTURE: the phrase cards themselves, each with a drawn icon; tapping one fills the screen
   COLOUR and TYPE: 藍 indigo ground, paper-white cards, vermilion accent; Zen Kaku Gothic New for Japanese, Hanken Grotesk for latin
   LAYOUT: top bar (language) → scene tabs → card grid → full-screen show mode */
:root{color-scheme:light dark;
--bg:light-dark(#f4f1ea,#10151f);--ink:light-dark(#18202e,#eef1f6);--sub:light-dark(#5a6475,#a5afbf);
--card:light-dark(#ffffff,#1a2230);--line:light-dark(#e2ddd2,#2a3446);
--ai:#1f3a68;--ai2:#2b4d86;--shu:#e8492a;--shu-soft:light-dark(#fde9e3,#3a1f1a);--tile:#fbe4dc}
:root[data-theme=light]{color-scheme:light}:root[data-theme=dark]{color-scheme:dark}
*{box-sizing:border-box;min-width:0}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.55 "Hanken Grotesk","Noto Sans",system-ui,sans-serif;overflow-x:clip}
.jp{font-family:"Zen Kaku Gothic New","Hiragino Sans","Noto Sans JP",sans-serif}
header{background:var(--ai);color:#fff;padding:18px max(5vw,16px) 0}
.top{display:flex;flex-wrap:wrap;gap:12px 20px;align-items:center;justify-content:space-between;max-width:1240px;margin:0 auto}
.brand{display:flex;gap:12px;align-items:center}
.brand svg{width:44px;height:44px;flex:none}
.bn{display:block;font-size:clamp(22px,3vw,30px);line-height:1.1;margin:0;font-weight:700;color:#fff;text-decoration:none}
.ph{font-size:clamp(22px,3vw,30px);line-height:1.2;margin:0 0 6px;font-weight:700;text-wrap:balance}.intro{margin:0 0 14px;color:var(--sub);max-width:70ch}
.tag{margin:2px 0 0;color:#c9d6ee;font-size:14px}
.scenes{display:flex;gap:4px;max-width:1240px;margin:18px auto 0;overflow-x:auto}
.scenes a{text-decoration:none;flex:none;font:700 17px/1.2 inherit;font-family:inherit;color:#c9d6ee;background:var(--ai2);border:0;border-radius:12px 12px 0 0;min-height:52px;padding:8px 22px;cursor:pointer;display:flex;gap:10px;align-items:center;flex:none}
.scenes a small{font:500 13px/1 "Zen Kaku Gothic New",sans-serif;opacity:.8}
.scenes a[aria-current=page]{background:var(--bg);color:var(--ink)}
.scenes svg{width:30px;height:30px;background:#fff;border-radius:8px;padding:3px;flex:none}
main{max-width:1240px;margin:0 auto;padding:20px max(5vw,16px) 40px}
.hint{display:block;background:var(--shu-soft);border-radius:12px;padding:12px 16px;margin:0 0 18px;font-size:15px}
.hint b{color:var(--shu)}
[hidden]{display:none!important}
.warn{background:light-dark(#fff4d6,#3a3117);font-weight:600}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,290px),1fr));gap:14px}
.card{background:var(--card);border:1px solid var(--line);border-radius:18px;padding:16px;display:grid;grid-template-columns:64px minmax(0,1fr);gap:4px 14px;align-items:start;box-shadow:0 1px 0 var(--line)}
.ic{grid-row:span 3;width:64px;height:64px;border-radius:16px;background:var(--tile);display:grid;place-items:center}
.ic svg{width:42px;height:42px}
.tr{font-weight:700;font-size:17px;line-height:1.3;margin:0}
.ja{font-size:22px;font-weight:700;line-height:1.35}
.ro{color:var(--sub);font-size:14px;font-style:italic}
.acts{grid-column:1/-1;display:flex;gap:8px;margin-top:10px}
.tr a{color:inherit;text-decoration:none}.tr a:hover{text-decoration:underline}
.btn{font:700 15px/1 inherit;font-family:inherit;min-height:44px;border-radius:12px;padding:0 16px;cursor:pointer;display:inline-flex;gap:8px;align-items:center;justify-content:center}
.show{flex:1;background:var(--shu);color:#fff;border:0}
.say{background:transparent;color:var(--ink);border:1.5px solid var(--line)}
.btn svg{width:20px;height:20px}
button:focus-visible{outline:3px solid #ffb703;outline-offset:2px}
.note{color:var(--sub);font-size:13px;margin-top:26px}
footer .fl{margin-bottom:6px}footer a{color:inherit}
footer{border-top:1px solid var(--line);padding:22px max(5vw,16px);color:var(--sub);font-size:14px;text-align:center}
/* show mode */
#stage{color-scheme:light;position:fixed;inset:0;overflow-y:auto;-webkit-overflow-scrolling:touch;background:#fff;color:#111;z-index:10;display:none;flex-direction:column;padding:max(12px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
body.lock{overflow:hidden;background:#fff}
#stage.on{display:flex}
.st-top{display:flex;justify-content:space-between;align-items:center;gap:10px}
.st-for{font:700 14px/1.3 "Zen Kaku Gothic New",sans-serif;background:var(--ai);color:#fff;border-radius:999px;padding:8px 14px}
.close{background:#eee;color:#111;border:0;white-space:nowrap;flex:none}
.st-body{flex:none;padding:clamp(6px,1.5vh,24px) 0 4px;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;text-align:center;gap:clamp(4px,1vh,12px)}
.st-ic{width:clamp(48px,7vh,90px);height:clamp(48px,7vh,90px);border-radius:22px;flex:none;background:#fde9e3;display:grid;place-items:center}
.st-ic svg{width:66%;height:66%}
.st-ja{font:900 clamp(26px,min(8.5vw,5.4vh),64px)/1.2 "Zen Kaku Gothic New",sans-serif;text-wrap:balance;margin:0}
.st-tr{font-size:clamp(16px,2.6vh,22px);color:#333;margin:0}
.st-ro{font-size:15px;color:#555;font-style:italic;margin:0}
.st-row{display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap}
#stage .say{color:#1f3a68;border:2px solid #1f3a68;background:#fff;min-height:40px;padding:0 14px}
#stage .say svg{width:22px;height:22px}
.ans{border-top:1px solid #ddd;padding-top:10px;flex:none}
.ans p{margin:0 0 8px;text-align:center;font:700 14px/1.3 "Zen Kaku Gothic New",sans-serif;color:#333}
#ans{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
#ans button{font:700 15px/1.2 "Zen Kaku Gothic New",sans-serif;min-height:50px;border-radius:14px;border:2px solid #1f3a68;background:#eef2f9;color:#111;cursor:pointer;padding:6px}
#ans button span{display:block;font:600 12px/1.2 "Hanken Grotesk",sans-serif;color:#333;margin-top:3px}
.reply{flex:none;min-height:20px;text-align:center;font-weight:700;font-size:19px;color:var(--shu);margin:4px 0 4px}
@media(max-width:600px){.ja{font-size:20px}.scenes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;padding-bottom:14px;overflow:visible}.scenes a{border-radius:12px;flex-direction:column;gap:3px;padding:8px 4px;font-size:14px;text-align:center;justify-content:center}.scenes a small{font-size:11px}.scenes a[aria-current=page]{background:#fff;color:#1f3a68}}
.reply b{display:block;font-size:20px;line-height:1.3;color:var(--shu)}.reply small{display:block;font:500 13px/1.3 "Zen Kaku Gothic New",sans-serif;color:#555}
.kp{margin-top:8px}.kp-show{display:flex;justify-content:center;align-items:baseline;gap:6px;font:900 26px/1.2 "Hanken Grotesk",sans-serif;color:#111;border:2px solid #1f3a68;border-radius:12px;padding:6px;margin-bottom:6px}.kp-show span+span{font:700 16px "Zen Kaku Gothic New",sans-serif}
.kp-keys{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}.kp-keys button{min-height:44px;border-radius:10px;border:1.5px solid #1f3a68;background:#fff;color:#111;font:700 18px "Hanken Grotesk",sans-serif;cursor:pointer;padding:0}.kp-keys .ok{background:#1f3a68;color:#fff;font:700 14px "Zen Kaku Gothic New",sans-serif}
.voice{display:flex;gap:6px;margin-top:10px}.voice input{flex:1;min-height:46px;font-size:16px;border:2px solid #1f3a68;border-radius:12px;padding:0 10px;color:#111;background:#fff;min-width:0}
.mic,.vgo{flex:none;min-height:46px;border-radius:12px;border:0;cursor:pointer;font:700 15px "Zen Kaku Gothic New",sans-serif}.mic{width:50px;background:#e8492a;color:#fff;display:grid;place-items:center}.mic svg{width:24px;height:24px}.mic.on{background:#1f3a68;animation:blink 1s infinite}@keyframes blink{50%{opacity:.6}}.vgo{padding:0 14px;background:#1f3a68;color:#fff}
.vnote{margin:6px 0 0;font-size:11px;color:#666;text-align:center}
@media(prefers-reduced-motion:no-preference){#stage.on .st-body{animation:pop .25s ease-out}@keyframes pop{from{transform:scale(.96);opacity:0}}}

/* language menu */
.lng{position:relative}
.lng summary{list-style:none;cursor:pointer;display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 16px;border:1.5px solid #6f88b5;border-radius:999px;color:#fff;font-weight:600;font-size:15px}
.lng summary::-webkit-details-marker{display:none}
.lng summary svg{width:18px;height:18px}
.lng[open] summary{background:#fff;color:var(--ai)}
.lng-list{position:absolute;right:0;top:calc(100% + 6px);z-index:5;background:var(--card);border:1px solid var(--line);border-radius:14px;padding:6px;min-width:210px;box-shadow:0 10px 30px #0004;display:grid}
.lng-list a{color:var(--ink);text-decoration:none;padding:10px 12px;border-radius:10px;min-height:44px;display:flex;align-items:center}
.lng-list a:hover,.lng-list a[aria-current=true]{background:var(--shu-soft)}
.lng-list a[aria-current=true]{font-weight:700}
/* tools */
.tools{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 18px}
.srch{flex:1 1 260px;display:flex;align-items:center;gap:8px;background:var(--card);border:1.5px solid var(--line);border-radius:12px;padding:0 12px;min-height:46px}
.srch svg{width:20px;height:20px;flex:none;color:var(--sub)}
.srch input{flex:1;border:0;background:transparent;color:var(--ink);font:16px inherit;font-family:inherit;min-height:44px;outline:none}
.tb{display:inline-flex;align-items:center;gap:8px;min-height:46px;padding:0 14px;border-radius:12px;border:1.5px solid var(--line);background:var(--card);color:var(--ink);font:700 15px inherit;font-family:inherit;cursor:pointer}
.tb svg{width:20px;height:20px;flex:none}
.tb[aria-pressed=true]{border-color:var(--shu);color:var(--shu)}
.offl{flex-basis:100%;margin:0;padding:10px 14px;border-radius:12px;background:light-dark(#fff4d6,#3a3117);font-size:14px;font-weight:600}
.alt-h{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 14px}
.alt-h h2{margin:0;font-size:22px}
.empty{color:var(--sub);padding:20px 0}
.sc-tag{grid-column:1/-1;font-size:12px;color:var(--sub);margin-top:-4px}
/* favorite star */
.fav{flex:none;width:44px;padding:0;background:transparent;color:var(--sub);border:1.5px solid var(--line)}
.fav svg{width:22px;height:22px}
.fav[aria-pressed=true]{color:#e0a100;border-color:#e0a100}
.fav[aria-pressed=true] svg path{fill:currentColor}
/* dialogs */
.dlg{position:fixed;inset:0;z-index:9;background:#0008;display:none;align-items:flex-end;justify-content:center;padding:12px}
.dlg.on{display:flex}
.dlg-box{background:var(--card);color:var(--ink);width:min(560px,100%);max-height:calc(100% - 12px);overflow-y:auto;border-radius:20px;padding:18px 18px max(18px,env(safe-area-inset-bottom))}
@media(min-width:700px){.dlg{align-items:center}}
.dlg-h{display:flex;justify-content:space-between;align-items:center;gap:10px}
.dlg-h h2{margin:0;font-size:21px}
.dlg-x{background:transparent;border:0;color:var(--ink);font-size:22px;width:44px;height:44px;cursor:pointer}
.dlg p{margin:6px 0 12px;color:var(--sub);font-size:15px}
.dlg textarea{width:100%;min-height:110px;font:16px/1.5 inherit;font-family:inherit;color:var(--ink);background:var(--bg);border:1.5px solid var(--line);border-radius:12px;padding:10px 12px;resize:vertical}
.dlg .go{width:100%;margin-top:12px;background:var(--shu);color:#fff;border:0;min-height:50px;font-size:16px}
.dlg .small{font-size:13px;margin:8px 0 0}
.dlg .err{color:var(--shu);font-weight:700;min-height:1.2em;margin:8px 0 0}
.alg{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.alg label,.opt label{display:flex;align-items:center;gap:8px;padding:10px;border:1.5px solid var(--line);border-radius:12px;cursor:pointer;min-height:44px;font-size:15px}
.alg input,.opt input{width:20px;height:20px;accent-color:#e8492a;flex:none}
.alg label:has(input:checked),.opt label:has(input:checked){border-color:var(--shu);background:var(--shu-soft)}
.opt{display:grid;gap:8px;margin-top:12px}
/* long text on the show screen */
.st-ja.long{font-size:clamp(20px,min(6vw,3.6vh),40px);text-align:left;white-space:pre-line}
.st-tr.long{white-space:pre-line;text-align:left}
/* phrase page */
.crumb{font-size:14px;color:var(--sub);margin:0 0 10px}.crumb a{color:inherit}
.phr{background:var(--card);border:1px solid var(--line);border-radius:22px;padding:22px;display:grid;gap:8px;justify-items:start}
.phr .big{font-size:clamp(30px,6vw,46px);font-weight:900;line-height:1.25;margin:0}
.phr .ro{font-size:17px}
.phr .acts{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}.phr .show{flex:0 1 220px}
.sec{margin-top:26px}.sec h2{font-size:20px;margin:0 0 10px}
.alist{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,240px),1fr));gap:8px;padding:0;margin:0;list-style:none}
.alist li{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:10px 12px}
.alist b{display:block;font-family:"Zen Kaku Gothic New",sans-serif}
.alist span{color:var(--sub);font-size:14px}
.mlist{columns:2 260px;padding-left:18px}.mlist li{margin:4px 0}.mlist a{color:var(--ink)}
@media(max-width:600px){.lng-list{left:0;right:auto}.srch{flex-basis:100%}.tb{flex:1 1 0;justify-content:center;gap:5px;padding:0 6px;font-size:13px;line-height:1.15;text-align:left}.tb svg{width:18px;height:18px}.lng summary{padding:0 12px;font-size:14px;min-height:40px}}
.alt-h .tb{flex:none}
