/* デジタル受付デモ 共通スタイル（業種テーマはCSS変数で上書き） */
:root {
  --paper: #F0EFEB;
  --surface: #FFFFFF;
  --surface-2: #FAFAF8;
  --ink: #1A1A1A;
  --sub: #707070;
  --line: #E2DFD7;
  --line-strong: #C9C5BA;

  /* テーマ（デフォルト=病院ティール。各業種HTMLで上書き） */
  --acc-700: #2F6B69;
  --acc-500: #4E8F8D;
  --acc-200: #BBD6D4;
  --acc-100: #E2EEED;
  --acc-50:  #F0F6F5;
  --acc-gold: #C9A227;

  --fs-speech: clamp(1.2rem, 0.95rem + 1.1vw, 1.65rem);
  --fs-option: clamp(1rem, 0.92rem + 0.4vw, 1.15rem);
  --radius: 12px;
  --ease: cubic-bezier(0.25, 0.8, 0.4, 1);

  --font-ja: 'A P-OTF A1ゴシック Std', 'A1ゴシック', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN',
             'PingFang SC', 'Apple SD Gothic Neo', 'Noto Sans CJK JP', sans-serif;
  --font-en: 'Avenir Next', 'Avenir', -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--font-ja);
  font-feature-settings: 'palt' 1;
  text-autospace: normal;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
}

.en {
  font-family: var(--font-en);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* 紙の質感 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  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='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 50;
}

:focus-visible {
  outline: 3px solid var(--acc-700);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== スプラッシュ ===== */
#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  cursor: pointer;
  transition: opacity 0.45s var(--ease);
}
#splash.hide { opacity: 0; pointer-events: none; }
#splash .sp-char {
  width: min(46vw, 300px);
  animation: idle-bob 4.2s ease-in-out infinite;
}
#splash .sp-char img { width: 100%; height: auto; display: block; }
#splash .sp-brand { text-align: center; }
#splash .sp-brand b { font-size: clamp(1.3rem, 4vw, 1.9rem); font-weight: 700; letter-spacing: 0.08em; display: block; }
#splash .sp-brand span { font-size: 0.66rem; color: var(--sub); letter-spacing: 0.16em; }
#splash .sp-touch {
  margin-top: 8px;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--acc-700);
  background: var(--surface);
  border: 1px solid var(--acc-200);
  border-radius: 99px;
  padding: 16px 40px;
  animation: pulse 2.4s ease-in-out infinite;
  min-height: 44px;
  text-align: center;
}
#splash .sp-langs { font-size: 0.74rem; color: var(--sub); letter-spacing: 0.14em; }

/* ===== Header ===== */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.logo-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--acc-700);
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #fff;
}
.clinic-name { line-height: 1.25; min-width: 0; }
.clinic-name b { font-size: 1rem; font-weight: 700; letter-spacing: 0.04em; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clinic-name span { font-size: 0.58rem; color: var(--sub); letter-spacing: 0.12em; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 99px;
  overflow: hidden;
  background: var(--surface);
}
.lang-switch button {
  font-family: var(--font-ja);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sub);
  background: none;
  border: none;
  padding: 9px 13px;
  cursor: pointer;
  min-height: 40px;
  transition: background 0.2s, color 0.2s;
}
.lang-switch button:hover { background: var(--surface-2); }
.lang-switch button[aria-pressed="true"] {
  background: var(--acc-700);
  color: #fff;
}

.icon-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-ja);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--acc-700);
  background: var(--acc-50);
  border: 1px solid var(--acc-200);
  border-radius: 99px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.2s var(--ease);
  min-height: 40px;
}
.icon-btn[aria-pressed="false"] { color: var(--sub); background: var(--surface); border-color: var(--line); }
.icon-btn:hover { background: var(--acc-100); }
.icon-btn[aria-pressed="false"]:hover { background: var(--surface-2); }
.icon-btn .off-slash { display: none; }
.icon-btn[aria-pressed="false"] .off-slash { display: block; }
.icon-btn.listening {
  background: var(--acc-700);
  color: #fff;
  border-color: var(--acc-700);
  animation: pulse 1.2s ease-in-out infinite;
}
.icon-btn:disabled { opacity: 0.4; cursor: default; }

.datetime { text-align: right; line-height: 1.3; }
.datetime .time {
  font-family: var(--font-en);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

/* ===== Main ===== */
main {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(20px, 3.5vh, 48px) clamp(20px, 4vw, 48px);
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: clamp(28px, 4vw, 60px);
  align-items: center;
}

/* --- キャラクター（レイヤーPNG） --- */
.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.halo {
  position: absolute;
  top: 46%; left: 50%;
  width: min(420px, 92%);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--acc-50) 0%, rgba(255, 255, 255, 0) 68%);
  z-index: 0;
}
.char {
  position: relative;
  z-index: 1;
  width: min(100%, 330px);
  animation: idle-bob 4.2s ease-in-out infinite;
}
.char.nod { animation: idle-bob 4.2s ease-in-out infinite, nod 0.6s var(--ease) 1; }
.char img {
  width: 100%;
  height: auto;
  display: block;
}
.char img.layer {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.char img.layer.show { opacity: 1; }

@keyframes idle-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes nod {
  0%, 100% { scale: 1; }
  40% { scale: 1 0.97; translate: 0 5px; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.status-chip {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--acc-700);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 8px 20px;
}
.status-chip i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--acc-500);
  animation: pulse 2s ease-in-out infinite;
}

/* --- 対話エリア --- */
.dialog-area { min-width: 0; }
.speaker-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  padding-left: 18px;
  border-left: 3px solid var(--acc-500);
}
.speaker-label b { font-size: 0.92rem; font-weight: 700; letter-spacing: 0.1em; }
.speaker-label span { font-size: 0.6rem; color: var(--sub); }

#speech {
  font-size: var(--fs-speech);
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: 0.02em;
  min-height: calc(1.75em * 3.2);
  cursor: default;
  text-wrap: balance;
}
#speech .caret {
  display: inline-block;
  width: 2px; height: 1em;
  background: var(--acc-500);
  margin-left: 2px;
  vertical-align: -0.12em;
  animation: caret-blink 0.9s steps(1) infinite;
}
@keyframes caret-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.dept-chip {
  display: inline-flex;
  margin-top: 14px;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--acc-700);
  background: var(--acc-50);
  border: 1px solid var(--acc-200);
  border-radius: 99px;
  padding: 9px 24px;
}

/* 補助ビジュアル */
.visual-block { margin-top: 24px; }
.scanbox {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 26px;
  max-width: 430px;
}
.reader { position: relative; width: 96px; height: 78px; flex-shrink: 0; }
.reader .device {
  position: absolute;
  bottom: 0;
  width: 96px; height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.reader .device::after {
  content: '';
  position: absolute;
  top: 7px; left: 50%;
  transform: translateX(-50%);
  width: 64px; height: 4px;
  border-radius: 2px;
  background: var(--acc-200);
}
.reader .card {
  position: absolute;
  top: 0; left: 50%;
  width: 56px; height: 36px;
  transform: translateX(-50%);
  background: var(--acc-100);
  border: 1px solid var(--acc-200);
  border-radius: 5px;
  animation: card-tap 2.4s var(--ease) infinite;
}
.reader .card::after {
  content: '';
  position: absolute;
  top: 7px; left: 7px;
  width: 14px; height: 10px;
  background: var(--acc-500);
  border-radius: 2px;
  opacity: 0.55;
}
@keyframes card-tap {
  0% { transform: translateX(-50%) translateY(-12px); opacity: 0; }
  30%, 70% { transform: translateX(-50%) translateY(8px); opacity: 1; }
  100% { transform: translateX(-50%) translateY(8px); opacity: 0; }
}
.scan-meta { flex: 1; min-width: 0; }
.scanbar { height: 5px; background: var(--acc-50); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.scanbar i { display: block; height: 100%; width: 0; background: var(--acc-500); border-radius: 3px; animation: scan-fill 2.3s linear forwards; }
@keyframes scan-fill { to { width: 100%; } }
.scantext { font-size: 0.84rem; color: var(--sub); letter-spacing: 0.08em; }

ul.info-list {
  list-style: none;
  max-width: 470px;
  border-top: 1px solid var(--line-strong);
}
ul.info-list li {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 0.96rem;
}
ul.info-list li b {
  font-family: var(--font-en);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--acc-700);
  min-width: 34px;
  flex-shrink: 0;
}
ul.info-list li .emoji { font-size: 1.3rem; min-width: 34px; text-align: center; }
ul.info-list li.hl { background: var(--acc-50); }
ul.info-list li .price { margin-left: auto; font-weight: 700; color: var(--acc-700); font-family: var(--font-en); }
ul.info-list li .star-mark { color: var(--acc-700); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; }

.wifi-card {
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wifi-card div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.wifi-card dt { font-size: 0.8rem; color: var(--sub); letter-spacing: 0.08em; }
.wifi-card dd { font-family: var(--font-en); font-size: 1.15rem; font-weight: 700; letter-spacing: 0.06em; }

/* --- 選択肢 --- */
#options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 13px;
  margin-top: 32px;
}
.opt {
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  font-family: var(--font-ja);
  font-size: var(--fs-option);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 18px;
  min-height: 62px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  animation: opt-in 0.45s var(--ease) forwards;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}
@keyframes opt-in { to { opacity: 1; transform: translateY(0); } }
.opt:hover { border-color: var(--acc-500); background: var(--acc-50); transform: translateY(-2px); }
.opt:active { transform: translateY(0); }
.opt .ico {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--acc-50);
  color: var(--acc-700);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.opt.primary { background: var(--acc-700); border-color: var(--acc-700); color: #fff; }
.opt.primary .ico { background: rgba(255, 255, 255, 0.16); color: #fff; }
.opt.primary:hover { background: var(--acc-500); border-color: var(--acc-500); }
.opt.wide { grid-column: 1 / -1; }

.sub-actions { margin-top: 20px; min-height: 28px; }

/* ===== 音声対話 ===== */
.user-said {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--sub);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 8px 18px;
  margin-bottom: 16px;
  width: fit-content;
  max-width: 100%;
  animation: opt-in 0.3s var(--ease);
}
.user-said svg { width: 15px; height: 15px; color: var(--acc-500); flex-shrink: 0; }
.user-said span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mic-area {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.mic-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-ja);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--acc-700);
  background: var(--surface);
  border: 2px solid var(--acc-500);
  border-radius: 99px;
  padding: 14px 30px;
  min-height: 52px;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.mic-btn:hover { background: var(--acc-50); transform: translateY(-2px); }
.mic-btn.listening {
  background: var(--acc-700);
  border-color: var(--acc-700);
  color: #fff;
  animation: pulse 1.2s ease-in-out infinite;
}
.mic-hint { font-size: 0.76rem; color: var(--sub); letter-spacing: 0.04em; }
.text-btn {
  font-family: var(--font-ja);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sub);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  letter-spacing: 0.06em;
  transition: color 0.2s;
}
.text-btn:hover { color: var(--ink); }
.text-btn::before { content: '← '; }

/* ===== チケット ===== */
dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  background: transparent;
  max-width: min(92vw, 400px);
  width: 100%;
  margin: auto;
}
dialog::backdrop { background: rgba(26, 26, 26, 0.35); }
.ticket-wrap { display: flex; flex-direction: column; gap: 16px; }
.ticket {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 28px 30px 24px;
  text-align: center;
  animation: ticket-print 0.55s var(--ease);
}
@keyframes ticket-print {
  from { transform: translateY(32px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.t-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.t-head b { font-size: 0.98rem; font-weight: 700; letter-spacing: 0.3em; text-indent: 0.3em; }
.t-head span { font-size: 0.56rem; color: var(--sub); letter-spacing: 0.16em; }
.t-num-label { font-size: 0.76rem; color: var(--sub); letter-spacing: 0.12em; margin-bottom: 4px; }
.t-num {
  font-family: var(--font-en);
  font-size: 4rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--acc-700);
  margin-bottom: 16px;
}
.t-rows { display: flex; flex-direction: column; gap: 9px; text-align: left; margin-bottom: 20px; }
.t-rows > div { display: flex; justify-content: space-between; gap: 14px; font-size: 0.86rem; }
.t-rows dt { color: var(--sub); font-weight: 400; flex-shrink: 0; }
.t-rows dd { font-weight: 700; text-align: right; }
.t-cut { border-top: 1.5px dashed var(--line-strong); margin: 0 -30px 16px; }
.t-bar {
  height: 32px;
  background: repeating-linear-gradient(90deg,
    var(--ink) 0 2px, transparent 2px 5px,
    var(--ink) 5px 8px, transparent 8px 10px,
    var(--ink) 10px 11px, transparent 11px 16px);
  opacity: 0.8;
  margin: 0 16px;
}
/* ホテル＝カードキー風 */
.ticket.keycard { border: 1px solid var(--acc-200); background: linear-gradient(135deg, var(--surface) 60%, var(--acc-50)); }
.ticket.keycard .t-num { letter-spacing: 0.1em; }
.ticket.keycard .t-bar { display: none; }
.ticket.keycard .t-cut { border-top-style: solid; border-color: var(--acc-gold); opacity: 0.6; }
.ticket.keycard .t-head b { color: var(--acc-700); }

.ticket-close {
  font-family: var(--font-ja);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
  background: var(--acc-700);
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.ticket-close:hover { background: var(--acc-500); transform: translateY(-2px); }

/* ===== Footer ===== */
footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px clamp(16px, 3vw, 40px);
  border-top: 1px solid var(--line);
  font-size: 0.66rem;
  color: var(--sub);
  letter-spacing: 0.05em;
}
footer .en { font-size: 0.58rem; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  main {
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
    padding-top: 16px;
  }
  .stage { flex-direction: row; justify-content: center; gap: 12px; }
  .char { width: min(38vw, 190px); }
  .halo { width: 280px; }
  #speech { min-height: calc(1.75em * 3); }
  #options { grid-template-columns: 1fr; }
  .datetime { display: none; }
  footer { flex-direction: column; gap: 4px; text-align: center; }
  .clinic-name span { display: none; }
}
@media (min-width: 521px) and (max-width: 860px) {
  #options { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .opt { opacity: 1; transform: none; }
}
