/* aihiko kiosk: large-screen UI readable from ~2 m. Sizes are in vmin so portrait and landscape both work. */
:root {
  --bg: #0d1220; --panel: #161d31; --panel2: #1e2741; --fg: #f4f6fb; --muted: #9aa6c4;
  --accent: #ffb547; --accent2: #4fd1c5; --danger: #ff6b6b;
  --r: 2vmin;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden; user-select: none; -webkit-user-select: none; }
body { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; }

#top { display: flex; align-items: center; gap: 2vmin; padding: 1.6vmin 3vmin; background: #0a0e19; }
.brand { display: flex; flex-direction: column; flex: 1; }
.shop-name { font-size: 3.2vmin; font-weight: 700; }
.shop-license { font-size: 1.6vmin; color: var(--muted); }
.badge { font-size: 2vmin; padding: .6vmin 1.6vmin; border-radius: 99px; background: var(--accent2); color: #062421; font-weight: 700; }
.clock { font-size: 3.6vmin; font-variant-numeric: tabular-nums; font-weight: 600; }

#stage { padding: 2vmin 3vmin 0; display: flex; flex-direction: column; min-height: 0; }
#stage-title { margin: 0 0 1.6vmin; font-size: 4vmin; font-weight: 800; color: var(--accent); }
#cards { flex: 1; min-height: 0; display: grid; gap: 2.4vmin; }
.empty { font-size: 4vmin; color: var(--muted); }

/* card */
.card { background: var(--panel); border-radius: var(--r); overflow: hidden; display: flex; min-height: 0; box-shadow: 0 1vmin 3vmin #0006; animation: pop .35s ease-out; }
@keyframes pop { from { transform: translateY(2vmin); opacity: 0; } }
.photo { position: relative; background: #222b44; overflow: hidden; }
.photo svg, .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rank { position: absolute; left: 1.4vmin; top: 1.4vmin; width: 7vmin; height: 7vmin; border-radius: 50%; background: var(--accent); color: #2a1a00; font-size: 4.4vmin; font-weight: 900; display: grid; place-items: center; }
.demo { position: absolute; right: 1.2vmin; bottom: 1.2vmin; font-size: 1.6vmin; background: #000a; padding: .3vmin 1vmin; border-radius: 1vmin; color: #ddd; }
.body { padding: 2vmin 2.4vmin; display: flex; flex-direction: column; gap: 1vmin; min-width: 0; }
.name { margin: 0; font-size: 3vmin; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rent { display: flex; align-items: baseline; gap: .8vmin; flex-wrap: wrap; }
.rent b { font-size: 9vmin; line-height: 1; color: var(--accent); font-weight: 900; letter-spacing: -.02em; }
.rent .unit { font-size: 3.4vmin; font-weight: 700; color: var(--accent); }
.rent .admin { font-size: 2.4vmin; color: var(--muted); margin-left: 1vmin; }
.meta { display: flex; gap: 1.6vmin; font-size: 3vmin; flex-wrap: wrap; align-items: baseline; }
.meta .layout { font-weight: 800; background: var(--panel2); padding: .2vmin 1.2vmin; border-radius: 1vmin; }
.meta .walk b { font-size: 4vmin; color: var(--accent2); }
.chips { display: flex; gap: .8vmin; flex-wrap: wrap; }
.chip { font-size: 2vmin; padding: .4vmin 1.2vmin; border-radius: 99px; border: .2vmin solid var(--accent2); color: var(--accent2); }
.total { font-size: 2.4vmin; color: var(--fg); }
.facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .6vmin 2vmin; font-size: 2vmin; }
.facts div { display: flex; gap: 1vmin; min-width: 0; }
.facts dt { color: var(--muted); white-space: nowrap; }
.facts dd { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legal { margin-top: auto; font-size: 1.6vmin; color: var(--muted); }

/* idle hero: one big rotating card */
body[data-view="idle"] #cards { grid-template-columns: 1fr; }
.card-hero { flex-direction: row; }
.card-hero .photo { flex: 1.1; }
.card-hero .body { flex: 1; justify-content: center; gap: 1.8vmin; }
.card-hero .name { font-size: 4.4vmin; white-space: normal; }
.card-hero .rent b { font-size: 15vmin; }
.card-hero .rent .unit { font-size: 5vmin; }
.card-hero .meta { font-size: 4vmin; }
.card-hero .facts { font-size: 2.4vmin; }

/* 3 recommendation cards */
body[data-view="cards"] #cards { grid-template-columns: repeat(3, 1fr); }
.card-card { flex-direction: column; }
.card-card .photo { height: 32%; flex: none; }
.card-card .facts { grid-template-columns: 1fr; }

/* detail */
body[data-view="detail"] #cards { grid-template-columns: 1fr; }
.card-detail { flex-direction: row; }
.card-detail .photo { flex: 1; }
.card-detail .body { flex: 1.2; gap: 1.6vmin; }
.card-detail .rent b { font-size: 12vmin; }
.card-detail .facts { font-size: 2.6vmin; grid-template-columns: 1fr; }

@media (orientation: portrait) {
  .card-hero, .card-detail { flex-direction: column; }
  .card-hero .photo, .card-detail .photo { flex: none; height: 40%; }
  body[data-view="cards"] #cards { grid-template-columns: 1fr; grid-template-rows: repeat(3, 1fr); }
  .card-card { flex-direction: row; }
  .card-card .photo { height: auto; width: 32%; }
  .card-card .rent b { font-size: 7vmin; }
}

/* talk panel */
#talk { display: flex; align-items: center; gap: 3vmin; padding: 2vmin 3vmin; min-height: 18vmin; background: linear-gradient(#0d122000, #0a0e19 30%); }
.indicator { display: flex; flex-direction: column; align-items: center; gap: 1vmin; width: 16vmin; flex: none; }
.indicator .label { font-size: 2.2vmin; color: var(--muted); text-align: center; min-height: 2.6vmin; }
.orb { --level: 0; width: 11vmin; height: 11vmin; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8ff3e9, var(--accent2) 45%, #135e58); display: flex; align-items: center; justify-content: center; gap: .9vmin; transform: scale(calc(1 + var(--level, 0) * .25)); transition: transform .08s; }
.orb i { width: 1vmin; height: 3vmin; background: #062421; border-radius: 1vmin; opacity: .8; }
#talk { --level: 0; }
#talk .orb { transform: scale(calc(1 + var(--level) * .25)); }
body[data-talk="thinking"] .orb { animation: spin 1.2s linear infinite; background: conic-gradient(var(--accent), var(--accent2), var(--accent)); }
body[data-talk="thinking"] .orb i { animation: dots 1s ease-in-out infinite; }
body[data-talk="speaking"] .orb { background: radial-gradient(circle at 35% 30%, #ffe1a3, var(--accent) 45%, #8a5400); }
body[data-talk="speaking"] .orb i { animation: eq .6s ease-in-out infinite alternate; }
body[data-talk="speaking"] .orb i:nth-child(2) { animation-delay: .2s; }
body[data-talk="speaking"] .orb i:nth-child(3) { animation-delay: .4s; }
body[data-talk="error"] .orb { background: var(--danger); }
body[data-talk="idle"] #talk { visibility: hidden; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes eq { from { height: 2vmin; } to { height: 6vmin; } }
@keyframes dots { 50% { opacity: .2; } }
#captions { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1vmin; }
#captions p { margin: 0; }
#captions .user { font-size: 2.6vmin; color: var(--muted); min-height: 1em; }
#captions .user:not(:empty)::before { content: "あなた："; }
#captions .ai { font-size: 3.6vmin; line-height: 1.35; max-height: 15vmin; overflow: hidden; white-space: pre-line; }

/* QR corner */
#qr { position: fixed; right: 3vmin; bottom: 22vmin; background: #fff; color: #111; border-radius: var(--r); padding: 1.6vmin; width: 26vmin; text-align: center; box-shadow: 0 1vmin 4vmin #000a; animation: pop .35s ease-out; }
#qr[hidden] { display: none; }
#qr .qr-img svg { width: 100%; height: auto; display: block; }
#qr p { margin: .8vmin 0 0; font-size: 2vmin; font-weight: 700; }

/* call to action (idle) */
#cta { position: fixed; left: 50%; bottom: 3vmin; transform: translateX(-50%); display: flex; align-items: center; gap: 2.4vmin; background: var(--accent); color: #2a1a00; padding: 2vmin 4vmin; border-radius: 99px; box-shadow: 0 1vmin 4vmin #000a; animation: breathe 2.4s ease-in-out infinite; white-space: nowrap; }
#cta p { margin: 0; font-size: 3.4vmin; font-weight: 800; line-height: 1.2; }
#cta small { font-size: 1.8vmin; opacity: .8; position: absolute; bottom: -3vmin; left: 0; right: 0; text-align: center; color: var(--muted); }
.mic-icon { width: 6vmin; height: 6vmin; border-radius: 50%; background: #2a1a00 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffb547'%3E%3Cpath d='M12 14a3 3 0 0 0 3-3V5a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.9V21h2v-3.1a7 7 0 0 0 6-6.9z'/%3E%3C/svg%3E") center/60% no-repeat; }
@keyframes breathe { 50% { transform: translateX(-50%) scale(1.04); } }
body.session #cta { display: none; }
body:not(.session) #talk { visibility: hidden; }

#textform { display: none; position: fixed; left: 3vmin; right: 3vmin; bottom: 1vmin; gap: 1vmin; }
body.text-mode #textform { display: flex; }
body.text-mode #cta { bottom: 9vmin; }
#textform input { flex: 1; font-size: 2.6vmin; padding: 1.2vmin 2vmin; border-radius: 1.4vmin; border: none; background: #fff; color: #111; user-select: text; -webkit-user-select: text; }
#textform button { font-size: 2.6vmin; padding: 0 3vmin; border-radius: 1.4vmin; border: none; background: var(--accent2); font-weight: 700; }
#settings-hotspot { position: fixed; top: 0; right: 0; width: 8vmin; height: 8vmin; z-index: 10; }
.fatal { color: var(--danger); font-size: 3vmin; padding: 4vmin; white-space: pre-wrap; }

/* ---------- web demo additions (app.aihiko.si); kiosk layout unchanged unless body.web / body.phone ---------- */
[hidden] { display: none !important; }
.demo-badge { display: inline-block; background: var(--danger); color: #fff; font-weight: 800; border-radius: 99px; padding: .05em .7em; font-size: .8em; letter-spacing: .05em; }
#attrib { position: fixed; right: 3vmin; top: 9.5vmin; display: flex; gap: 1vmin; align-items: center; font-size: 1.7vmin; color: var(--muted); z-index: 5; }
#micbtn, #talk-close, #qr .qr-close, #qr .qr-link { display: none; }
body.web #micbtn, body.phone #micbtn { display: flex; }
body.web #qr .qr-link, body.phone #qr .qr-link { display: block; }
body.web #qr .qr-close, body.phone #qr .qr-close { display: block; }
body.web.session #talk-close, body.phone.session #talk-close { display: block; }
#micbtn { align-items: center; gap: 1vmin; border: none; border-radius: 99px; background: var(--accent); color: #2a1a00; font-weight: 800; font-size: 2.4vmin; padding: .6vmin 2vmin .6vmin .6vmin; cursor: pointer; }
#micbtn .mic-icon { width: 4.6vmin; height: 4.6vmin; }
body.voice-on #micbtn { background: var(--danger); color: #fff; }
body.voice-on #micbtn .mic-label::after { content: "（停止）"; font-weight: 600; }
#talk { position: relative; }
#talk-close { position: absolute; top: 1vmin; right: 1.4vmin; border: none; background: #fff2; color: var(--fg); border-radius: 50%; width: 4.4vmin; height: 4.4vmin; font-size: 2.2vmin; cursor: pointer; }
#qr { z-index: 20; }
#qr .qr-close { position: absolute; top: .4vmin; right: .6vmin; border: none; background: none; font-size: 2.2vmin; color: #555; cursor: pointer; }
#qr .qr-link { margin-top: .6vmin; font-size: 1.8vmin; color: #0b6bcb; font-weight: 700; }
body.web.text-mode #cta { bottom: 10vmin; }
img.broken { visibility: hidden; }
#deck { display: none; }

/* ---------- phone layout: swipe browser + concierge bar ---------- */
body.phone { display: block; font-size: 15px; --bar: calc(64px + env(safe-area-inset-bottom)); }
body.phone #top, body.phone #stage, body.phone #cta, body.phone #attrib { display: none !important; }
body.phone #deck { display: flex; flex-direction: column; position: fixed; inset: 0 0 var(--bar) 0; padding-top: env(safe-area-inset-top); }
.deck-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 6px; }
.deck-brand { font-size: 20px; font-weight: 900; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.deck-brand .demo-badge { font-size: 11px; }
.deck-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.deck-filters { display: flex; gap: 8px; overflow-x: auto; padding: 4px 14px 8px; scrollbar-width: none; flex: none; }
.deck-filters::-webkit-scrollbar { display: none; }
.deck-filters select, .ai-clear { flex: none; appearance: none; -webkit-appearance: none; background: var(--panel2); color: var(--fg); border: 1px solid #fff2; border-radius: 99px; padding: 7px 14px; font-size: 14px; font-family: inherit; }
.deck-filters select:has(option:checked:not([value=""])) { border-color: var(--accent); color: var(--accent); }
#deck[data-mode="ai"] .deck-filters select { display: none; }
.ai-clear { background: var(--accent); color: #2a1a00; font-weight: 800; border: none; }
.deck-title { padding: 0 14px; font-weight: 800; color: var(--accent); font-size: 15px; }
.deck-title:empty { display: none; }
.deck-stack { position: relative; flex: 1; min-height: 0; margin: 6px 10px 0; }
.deck-empty { color: var(--muted); text-align: center; margin-top: 30%; padding: 0 20px; }
.scard { position: absolute; inset: 0; background: var(--panel); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 8px 24px #0008; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; will-change: transform; }
.scard.behind { transform: scale(.94) translateY(14px); opacity: .55; pointer-events: none; }
.scard.top { animation: deckin .2s ease-out; }
@keyframes deckin { from { transform: scale(.96); opacity: .6; } }
.scard.going-next { box-shadow: -10px 8px 30px #4fd1c555; }
.scard.going-prev { box-shadow: 10px 8px 30px #ffb54755; }
.sphoto { position: relative; flex: 0 0 50%; min-height: 0; background: #222b44; overflow: hidden; }
.sphoto img, .sphoto svg { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.sphoto img.floorplan { object-fit: contain; background: #fff; }
.sphoto .dots { position: absolute; top: 8px; left: 10px; right: 10px; display: flex; gap: 4px; }
.sphoto .dots i { flex: 1; height: 3px; border-radius: 2px; background: #fff5; }
.sphoto .dots i.on { background: #fff; }
.sphoto .ptag { position: absolute; left: 10px; bottom: 10px; background: #000a; color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.pnav { position: absolute; top: 0; bottom: 0; width: 34%; border: none; background: none; pointer-events: none; }
.pprev { left: 0; } .pnext { right: 0; }
.sbody { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 6px; }
.srent { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.srent b { font-size: 40px; line-height: 1; color: var(--accent); font-weight: 900; letter-spacing: -.02em; }
.srent .unit { font-size: 18px; font-weight: 800; color: var(--accent); }
.srent .admin { font-size: 14px; color: var(--muted); margin-left: 6px; }
.smeta { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; font-size: 16px; font-weight: 600; }
.smeta .layout { background: var(--panel2); padding: 1px 8px; border-radius: 6px; font-weight: 800; }
.smeta .walk b { color: var(--accent2); font-size: 20px; }
.sname { margin: 2px 0 0; font-size: 16px; font-weight: 700; line-height: 1.3; }
.sline { margin: 0; font-size: 13px; line-height: 1.4; }
.sline small { color: var(--muted); }
.sline.muted { color: var(--muted); }
.slink { margin-top: auto; align-self: flex-start; color: #2a1a00; background: var(--accent2); padding: 7px 14px; border-radius: 99px; font-weight: 800; text-decoration: none; font-size: 14px; }
.sdemo { font-size: 12px; color: var(--muted); }
.deck-nav { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px 2px; flex: none; }
.deck-nav button { width: 40px; height: 32px; border-radius: 99px; border: 1px solid #fff3; background: var(--panel2); color: var(--fg); font-size: 20px; line-height: 1; cursor: pointer; }
.deck-hint { font-size: 12px; color: var(--muted); }
.deck-attrib { font-size: 11px; color: var(--muted); text-align: center; padding: 2px 10px 4px; flex: none; }

body.phone #textform { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bar); padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); gap: 8px; background: #0a0e19; border-top: 1px solid #fff1; z-index: 15; }
body.phone #textform input { font-size: 16px; padding: 0 12px; border-radius: 12px; min-width: 0; }
body.phone #textform .send { font-size: 15px; padding: 0 14px; border-radius: 12px; }
body.phone #micbtn { font-size: 14px; padding: 4px 12px 4px 4px; flex: none; }
body.phone #micbtn .mic-icon { width: 36px; height: 36px; }
body.phone #talk { position: fixed; left: 8px; right: 8px; bottom: calc(var(--bar) + 8px); min-height: 0; padding: 12px 44px 12px 12px; gap: 12px; border-radius: 16px; background: #10172aee; backdrop-filter: blur(8px); box-shadow: 0 -4px 24px #0009; z-index: 14; max-height: 40vh; }
body.phone .indicator { width: 52px; }
body.phone .orb { width: 40px; height: 40px; gap: 3px; }
body.phone .orb i { width: 4px; height: 12px; }
body.phone .indicator .label { font-size: 11px; min-height: 0; }
body.phone #captions .user { font-size: 13px; }
body.phone #captions .ai { font-size: 15px; max-height: 30vh; overflow: auto; }
body.phone #talk-close { width: 28px; height: 28px; font-size: 14px; top: 8px; right: 8px; }
body.phone #qr { right: 10px; top: calc(56px + env(safe-area-inset-top)); bottom: auto; width: 150px; padding: 10px; border-radius: 12px; }
body.phone #qr p { font-size: 11px; }
body.phone #qr .qr-close { font-size: 14px; }
body.phone #qr .qr-link { font-size: 12px; }
@keyframes eqp { from { height: 6px; } to { height: 18px; } }
body.phone[data-talk="speaking"] .orb i { animation-name: eqp; }
