:root {
  color-scheme: light;
  font-family: Inter, "Noto Sans JP", "Noto Sans", system-ui, -apple-system, sans-serif;
  --ink: #102a33;
  --muted: #64747a;
  --surface: rgba(255, 255, 255, 0.92);
  --line: #dce7e8;
  --teal: #007f78;
  --teal-dark: #075b59;
  --coral: #ea6a47;
  --danger: #b83b43;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 5%, rgba(38, 181, 162, 0.18), transparent 35%),
    radial-gradient(circle at 95% 30%, rgba(234, 106, 71, 0.15), transparent 34%),
    #f2f7f6;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }

.shell { width: min(760px, 100%); margin: 0 auto; padding: 24px 18px calc(32px + env(safe-area-inset-bottom)); }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px;
  color: white; font-weight: 900; letter-spacing: -1px;
  background: linear-gradient(145deg, var(--teal), #14a895);
  box-shadow: 0 10px 24px rgba(0, 127, 120, 0.22);
}
.eyebrow { margin: 0 0 2px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: 0.14em; }
h1 { margin: 0; font-size: clamp(22px, 5vw, 30px); line-height: 1.15; }
.subtitle { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

.status-card, .auth-card, .control-card, .transcript-card {
  background: var(--surface); border: 1px solid rgba(218, 231, 231, 0.9); border-radius: 22px;
  box-shadow: 0 12px 36px rgba(23, 59, 65, 0.07); backdrop-filter: blur(12px);
}
.status-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 17px; }
.status-card > div:first-child { display: flex; align-items: center; gap: 9px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #9aabad; box-shadow: 0 0 0 5px rgba(154,171,173,.12); }
.status-dot.live { background: #13a176; box-shadow: 0 0 0 5px rgba(19,161,118,.14); animation: pulse 1.5s infinite; }
.status-dot.error { background: var(--danger); }
.quota { text-align: right; }
.quota span { display: block; color: var(--muted); font-size: 11px; }
.quota strong { font-variant-numeric: tabular-nums; font-size: 18px; }

.auth-card { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 12px; margin-top: 14px; padding: 16px; }
label { color: var(--muted); font-size: 12px; font-weight: 700; }
input { width: 100%; margin-top: 6px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: white; color: var(--ink); }
input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,127,120,.12); }

.control-card { margin-top: 14px; padding: 22px; text-align: center; }
.language-route { display: flex; justify-content: center; align-items: center; gap: 22px; margin: 2px 0 20px; }
.language-route span:not(.arrows) { display: flex; flex-direction: column; }
.language-route b { font-size: 17px; }
.language-route small { color: var(--muted); }
.arrows { color: var(--coral); font-size: 28px; font-weight: 800; }
.start-button {
  width: min(360px, 100%); min-height: 76px; display: flex; justify-content: center; align-items: center; gap: 14px;
  margin: 0 auto; border: 0; border-radius: 22px; color: white;
  background: linear-gradient(135deg, var(--teal-dark), var(--teal));
  box-shadow: 0 12px 25px rgba(0, 127, 120, 0.25); transition: transform .15s ease;
}
.start-button:hover { transform: translateY(-1px); }
.start-button b, .start-button small { display: block; }
.start-button b { font-size: 19px; }
.start-button small { margin-top: 2px; opacity: .84; }
.mic { width: 19px; height: 19px; display: grid; place-items: center; color: #ff9f83; font-size: 18px; }
.session-actions { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.secondary, .danger, .ghost { border-radius: 12px; padding: 10px 13px; font-weight: 750; }
.secondary { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.danger { border: 1px solid #f3c5c8; background: #fff6f6; color: var(--danger); }
.ghost { border: 1px solid rgba(0,127,120,.18); background: rgba(255,255,255,.7); color: var(--teal-dark); }
.timer { margin: 16px 0 0; color: var(--teal-dark); font-size: 28px; font-weight: 850; font-variant-numeric: tabular-nums; }

.transcripts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.transcript-card { overflow: hidden; min-height: 180px; }
.transcript-card header { padding: 13px 15px; border-bottom: 1px solid var(--line); }
.transcript-card header span, .transcript-card header small { display: block; }
.transcript-card header span { font-weight: 850; }
.transcript-card header small { color: var(--muted); font-size: 11px; }
.translated header { background: rgba(0,127,120,.06); }
.transcript-body { max-height: 300px; overflow-y: auto; padding: 15px; line-height: 1.7; white-space: pre-wrap; }
.muted-text { color: #8a989c; }
.notice { margin: 16px 5px 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(520px, calc(100% - 32px)); padding: 13px 16px; border-radius: 14px; color: white; background: #263d44; box-shadow: 0 12px 32px rgba(0,0,0,.2); z-index: 10; }
.focus-exit { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 30; border: 1px solid rgba(255,255,255,.22); border-radius: 12px; padding: 9px 12px; color: white; background: rgba(16,42,51,.88); }
.focus-mode { overflow: hidden; }
.focus-mode .topbar, .focus-mode .status-card, .focus-mode .auth-card, .focus-mode .control-card, .focus-mode .notice { display: none; }
.focus-mode .shell { width: 100%; height: 100dvh; padding: 10px; }
.focus-mode .transcripts { height: calc(100dvh - 20px); margin: 0; }
.focus-mode .transcript-card { min-height: 0; display: flex; flex-direction: column; }
.focus-mode .transcript-body { flex: 1; max-height: none; font-size: clamp(22px, 3.2vw, 42px); line-height: 1.55; }
.hidden { display: none !important; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(19,161,118,0); } }

@media (max-width: 620px) {
  .shell { padding-top: 18px; }
  .auth-card { grid-template-columns: 1fr 1fr; }
  .auth-card button { grid-column: 1 / -1; }
  .transcripts { grid-template-columns: 1fr; }
  .status-card { align-items: flex-start; }
  .quota { min-width: 110px; }
  .focus-mode .transcripts { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .focus-mode .transcript-card { min-height: 0; }
  .focus-mode .transcript-body { font-size: clamp(18px, 5vw, 30px); }
}
