:root,
[data-theme="light"] {
  /* Vignelli Canon: paper white, near-black ink, color as identifier */
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --ink: #0a0a0a;
  --ink-secondary: #4a4a4a;
  --ink-tertiary: #8a8a8a;
  --separator: rgba(10, 10, 10, 0.12);
  --fill: rgba(10, 10, 10, 0.05);
  /* Primary identifier: Vignelli vermilion */
  --accent: #f04e23;
  --accent-rgb: 240, 78, 35;
  --accent-strong: #d33a18;
  --accent-soft: rgba(240, 78, 35, 0.1);
  /* Secondary signifier: signal blue */
  --blue: #0039a6;
  --green: #1f8f4e;
  --indigo: var(--blue);
  --pink: var(--accent-strong);
  --bubble-translate: rgba(240, 78, 35, 0.07);
  --bubble-translate-border: rgba(240, 78, 35, 0.2);
  --group-radius: 1rem;
  /* Vignelli house face: Helvetica (true grotesque, not humanist fallback) */
  --v-face: "Helvetica Neue", Helvetica, Arial, "Liberation Sans",
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP",
    Meiryo, sans-serif;
  color-scheme: light;
  font-family: var(--v-face);
  -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-elevated: #1a1a1a;
  --ink: #f5f5f5;
  --ink-secondary: rgba(245, 245, 245, 0.72);
  --ink-tertiary: rgba(245, 245, 245, 0.42);
  --separator: rgba(255, 255, 255, 0.14);
  --fill: rgba(255, 255, 255, 0.07);
  --accent: #f4633c;
  --accent-rgb: 244, 99, 60;
  --accent-strong: #f04e23;
  --accent-soft: rgba(244, 99, 60, 0.16);
  --blue: #6f9be8;
  --indigo: var(--blue);
  --pink: var(--accent-strong);
  --bubble-translate: rgba(244, 99, 60, 0.14);
  --bubble-translate-border: rgba(244, 99, 60, 0.28);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  height: 100%;
  overflow: hidden;
  /* Vignelli: flat paper. Hierarchy carried by white space, scale and weight — not decoration. */
  background: var(--bg);
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* 笏笏 App Shell 笏笏 */

.app-shell {
  width: 100%;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

/* 笏笏 Auth View 笏笏 */

.auth-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2.5rem;
  padding: max(1rem, env(safe-area-inset-top)) 1.25rem max(1rem, env(safe-area-inset-bottom));
  transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 2;
}

.auth-view.is-hidden {
  display: none;
}

.auth-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.app-icon {
  width: 5rem;
  height: 5rem;
  display: grid;
  place-items: center;
}

.app-icon svg { width: 5rem; height: 5rem; }

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 .brand-accent,
.nav-title span {
  color: var(--blue);
  font-weight: 700;
}

.auth-subtitle {
  font-size: 0.9375rem;
  color: var(--ink-tertiary);
  font-weight: 500;
}

.auth-form-area {
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-footer {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--ink-tertiary);
  line-height: 1.5;
}

.auth-switch-link {
  align-self: center;
  border: none;
  background: none;
  color: var(--blue);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.auth-switch-link:active {
  opacity: 0.7;
}

.auth-secondary-btn {
  display: block;
  width: 100%;
  height: 2.75rem;
  border: 1px solid var(--separator);
  border-radius: 0.75rem;
  background: var(--fill);
  color: var(--ink-secondary);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.auth-secondary-btn:hover {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.25);
  color: var(--blue);
}

.auth-secondary-btn:active {
  transform: scale(0.98);
}

.user-auth-view,
.admin-auth-view {
  background:
    radial-gradient(circle at 20% 10%, rgba(var(--accent-rgb), 0.16), transparent 28rem),
    radial-gradient(circle at 80% 90%, rgba(var(--accent-rgb), 0.1), transparent 30rem),
    var(--bg);
}

.user-auth-card,
.admin-auth-card {
  width: min(100%, 26rem);
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  border-radius: 1.25rem;
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.user-auth-card .auth-form-area,
.admin-auth-card .auth-form-area {
  max-width: none;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

.password-field input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--ink-tertiary);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 1;
}

.password-toggle .icon-hide { display: none; }
.password-toggle.is-visible .icon-show { display: none; }
.password-toggle.is-visible .icon-hide { display: block; }

.password-toggle:active { opacity: 0.6; }

.form-row-separator {
  border-top: 1px solid var(--separator);
}

.form-row-submit {
  padding-top: 0.5rem;
  padding-bottom: 1rem;
}

.form-row-submit .app-button {
  width: 100%;
}

.form-group > .form-message {
  padding: 0 1rem;
  min-height: 1.25rem;
}

/* 笏笏 Forms 笏笏 */

.form-group {
  background: var(--bg-elevated);
  border-radius: var(--group-radius);
  overflow: hidden;
}

.form-row { padding: 0.875rem 1rem; }

.form-row label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 0.375rem;
}

.form-row input {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid var(--separator);
  border-radius: 0.625rem;
  background: var(--fill);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-row input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3.5px rgba(var(--accent-rgb), 0.15);
}

.input-with-action {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.input-with-action input {
  flex: 1;
  min-width: 0;
}

.input-action-btn {
  flex-shrink: 0;
  height: 2.75rem;
  padding: 0 0.875rem;
  border: 1px solid var(--separator);
  border-radius: 0.625rem;
  background: var(--bg);
  color: var(--blue);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.input-action-btn:hover {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.25);
}

.input-action-btn:active {
  transform: scale(0.98);
}

.form-message {
  min-height: 1.25rem;
  padding: 0 0.25rem;
  color: #ff3b30;
  font-size: 0.8125rem;
  font-weight: 500;
}

.app-button {
  display: block;
  width: 100%;
  height: 3.125rem;
  border: none;
  border-radius: 0.75rem;
  font-size: 1.0625rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}

.app-button:active { transform: scale(0.98); opacity: 0.85; }
.app-button.primary { background: var(--blue); color: #fff; }

/* 笏笏 Translator View 笏笏 */

.translator-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.translator-view.is-hidden {
  display: none;
}

.nav-bar {
  flex-shrink: 0;
  position: relative;
  display: grid;
  grid-template-columns: 3rem 1fr 3rem;
  align-items: center;
  padding: max(0.75rem, env(safe-area-inset-top, 0px)) clamp(0.75rem, 2vw, 1.5rem) 0.5rem;
  padding-left: max(clamp(0.75rem, 2vw, 1.5rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(0.75rem, 2vw, 1.5rem), env(safe-area-inset-right, 0px));
}

.nav-icon-button {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: var(--fill);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}

.nav-icon-button:active { transform: scale(0.9); opacity: 0.7; }

.hamburger {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  position: relative;
  z-index: 22;
  -webkit-tap-highlight-color: transparent;
}

.hamburger input {
  display: none;
}

.hamburger svg {
  height: 2rem;
  width: 2rem;
  transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger .line {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.2;
  transition: stroke-dasharray 600ms cubic-bezier(0.4, 0, 0.2, 1),
              stroke-dashoffset 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger .line-top-bottom {
  stroke-dasharray: 12 63;
}

.hamburger input:checked + svg {
  transform: rotate(-45deg);
}

.hamburger input:checked + svg .line-top-bottom {
  stroke-dasharray: 20 300;
  stroke-dashoffset: -32.42;
}

.nav-spacer { width: 3rem; height: 3rem; }

.nav-title {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.nav-title span { color: var(--blue); }

/* live pill */

.live-pill-wrap {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 0.15rem 0 0.5rem;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 7.25rem;
  justify-content: center;
  padding: 0.35rem 0.85rem;
  border-radius: 999rem;
  border: 1px solid transparent;
  background: var(--fill);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-secondary);
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--ink-tertiary);
  transition: background 0.3s;
}

.is-live .live-dot {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.5);
  animation: livePulse 1.6s ease-out infinite;
}

.is-live .live-pill {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 11%, var(--fill));
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}

/* 笏笏 Dual Panel (face-to-face) 笏笏 */

.dual-panel {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
  overflow: hidden;
}

.live-pill-wrap.is-hidden {
  display: none;
}

.translator-view.is-viewing-history .chat-list {
  flex: 1;
  min-height: 0;
}

.dual-panel.is-history {
  flex: 0 0 auto;
  grid-template-rows: auto;
}

.dual-panel.is-hidden {
  display: none;
}

.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  overflow: hidden;
}

.panel.is-hidden {
  display: none;
}

/* Color as identifier (chromotype): signal blue = partner, vermilion = self */
.panel-partner {
  background: var(--bg);
  border-top: 2px solid var(--blue);
  border-bottom: 1px solid var(--separator);
}

.panel-self {
  background: var(--bg);
  border-top: 2px solid var(--accent);
}

.panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.panel-badge {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  border-radius: 999rem;
}

.panel-badge-partner {
  background: rgba(0, 57, 166, 0.12);
  color: var(--blue);
}

.panel-badge-self {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
}

.panel-lang {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-secondary);
}

.panel-lang-select {
  width: auto;
  max-width: 7.5rem;
  margin-left: auto;
  flex: 0 1 auto;
  padding: 0.125rem 0.15rem;
  border: none;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 0.8125rem;
  font-weight: 700;
  text-align: right;
  appearance: none;
  cursor: pointer;
}

.panel-lang-select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.panel-lang-select:active {
  opacity: 0.7;
}

.panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
}

.panel-text {
  width: 100%;
  max-height: 100%;
  margin-inline: auto;
  font-size: clamp(1rem, 3.8vw, 1.28rem);
  font-weight: 700;
  line-height: 1.42;
  text-align: center;
  word-break: normal;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  text-wrap: pretty;
  hyphens: auto;
  color: var(--ink);
  overflow-y: auto;
  overflow-x: hidden;
  transition: font-size 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.panel-text.is-text-short {
  max-width: 20ch;
  font-size: clamp(1.2rem, 5vw, 1.65rem);
  line-height: 1.36;
}

.panel-text.is-text-medium {
  max-width: 17ch;
  font-size: clamp(1.05rem, 4.2vw, 1.4rem);
}

.panel-text.is-text-long {
  max-width: 15ch;
  font-size: clamp(0.96rem, 3.7vw, 1.18rem);
}

.panel-text.is-text-xlong {
  max-width: 13ch;
  font-size: clamp(0.92rem, 3.4vw, 1.06rem);
}

.panel-text.is-empty .panel-placeholder,
.panel-placeholder {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-tertiary);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.panel-text.is-typing {
  color: var(--ink-tertiary);
}

/* 翻訳文字の出現アニメーション（slot-text 風のスロット回転＋バウンス）。
   1字ずつ面の色（相手=青／日本語=オレンジ）で下からせり上がり、行き過ぎてから戻り、黒へ落ち着く。
   アニメ中だけ inline-block（transform 用）、終了後は inline へ戻して
   英単語が文字単位で折り返さないようにする。 */
.panel-text .slot-char {
  display: inline-block;
  white-space: inherit;
  vertical-align: bottom;
  animation: slotRoll 1170ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.panel-text .slot-char.is-settled {
  display: inline;
  white-space: inherit;
}

.panel-partner .panel-text .slot-char {
  animation: slotRoll 1170ms cubic-bezier(0.34, 1.56, 0.64, 1) both,
             slotInkBlue 1770ms ease both;
}

.panel-self .panel-text .slot-char {
  animation: slotRoll 1170ms cubic-bezier(0.34, 1.56, 0.64, 1) both,
             slotInkOrange 1770ms ease both;
}

@keyframes slotRoll {
  from { opacity: 0; transform: translateY(0.55em); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slotInkBlue {
  0%, 45% { color: var(--blue); }
  100% { color: var(--ink); }
}

@keyframes slotInkOrange {
  0%, 45% { color: var(--accent); }
  100% { color: var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  .panel-text .slot-char { display: inline; opacity: 1; }
}

/* 旅行シーンで AI が不当な金額・おかしい点を検知したときの赤字アドバイス。 */
.panel-advice {
  margin: 0.55rem auto 0;
  max-width: 90%;
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
  color: #d8261c;
  font-weight: 700;
  font-size: clamp(0.78rem, 3vw, 0.94rem);
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.panel-advice::before {
  content: "⚠";
  flex: none;
  font-size: 1.05em;
  line-height: 1.5;
}

.panel-advice.is-hidden {
  display: none;
}

.bubble-advice {
  margin: 0.45rem 0 0;
  color: #d8261c;
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1.55;
}

.bubble-advice::before {
  content: "⚠ ";
}

[data-theme="dark"] .panel-advice,
[data-theme="dark"] .bubble-advice {
  color: #ff5b4d;
}

/* 通貨換算（概算）。警告ではなく情報なので、中立的なピル表示にする。 */
.panel-fx {
  align-self: center;
  margin: 0.5rem auto 0;
  padding: 0.18rem 0.7rem;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink-secondary);
  font-weight: 700;
  font-size: clamp(0.78rem, 3vw, 0.92rem);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  text-align: center;
  overflow-wrap: anywhere;
}

.panel-fx.is-hidden {
  display: none;
}

.card-fx {
  margin: 0.45rem 0 0;
  color: var(--ink-secondary);
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.mic-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
  background: var(--bg-elevated);
  border-top: 1px solid var(--separator);
  border-bottom: 1px solid var(--separator);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}
.mic-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  min-height: 4.9rem;
}

.replay-button {
  grid-column: 3;
  justify-self: start;
  margin-left: 0.85rem;
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--blue);
  cursor: pointer;
}

.replay-button:active { transform: scale(0.9); opacity: 0.7; }

.replay-button.is-hidden { display: none; }

.translation-caution {
  max-width: min(92vw, 34rem);
  margin: 0.1rem auto 0;
  padding: 0 0.75rem;
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: center;
  color: var(--ink-tertiary);
}

.dual-panel.is-history .mic-bar {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  border-top: none;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
}

/* 笏笏 Chat List 笏笏 */

.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: min(100%, 40rem);
  margin: 0 auto;
  padding: 0.75rem clamp(1rem, 3vw, 1.25rem) 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.chat-list.is-hidden {
  display: none;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--ink-tertiary);
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 2rem 1rem;
  max-width: 18rem;
}

.chat-empty-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.875rem;
}

.chat-empty-steps {
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 0.25rem;
}

.chat-empty-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.875rem;
  line-height: 1.45;
}

.chat-empty-steps li::before {
  content: counter(step);
  counter-increment: step;
  flex-shrink: 0;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-top: 0.1rem;
}

.chat-empty-steps {
  counter-reset: step;
}

.history-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 clamp(1rem, 3vw, 1.5rem) 0.5rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  background: rgba(255, 149, 0, 0.12);
  border: 1px solid rgba(255, 149, 0, 0.28);
  color: var(--ink-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
}

.history-banner.is-hidden {
  display: none;
}

.history-banner-btn {
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--blue);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.125rem 0;
  white-space: nowrap;
}

.history-banner-btn:hover {
  text-decoration: underline;
}

.chat-empty .chat-empty-icon {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
}

/* 履歴の1ターン = 聞き取り（原文）と翻訳をまとめた1枚のカード。 */
.history-turn {
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  border-radius: 1rem;
  padding: 0.9rem 1.05rem 1rem;
  animation: bubbleIn 0.28s ease;
}

.history-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
}

.history-tag svg { flex-shrink: 0; }
.history-tag.is-translation { color: var(--blue); }

.history-source {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.history-source-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-secondary);
  word-break: break-word;
  white-space: pre-wrap;
}

.history-translation {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--separator);
}

.history-translation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.history-translation-text {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
  word-break: break-word;
  white-space: pre-wrap;
}

/* 陦鯉ｼ医ヰ繝悶Ν・峨・鬮倥＆縺・▲縺ｱ縺・ｒ菴ｿ縺・∝推繝峨ャ繝井ｸｭ蠢・°繧画ｬ｡縺ｮ繝峨ャ繝井ｸｭ蠢・∪縺ｧ
   騾泌・繧後★邵ｦ繝舌・繧貞ｼ輔￥縲ょ・蟷・1.9rem 縺ｮ荳ｭ蠢・= 0.95rem縲・
   繝峨ャ繝井ｸｭ蠢・= 荳翫°繧・0.975rem縲∬｡御ｸ狗ｫｯ縺九ｉ谺｡繝峨ャ繝井ｸｭ蠢・∪縺ｧ = 菴咏區0.85rem + 0.975rem */
.speak-button {
  border: none;
  background: none;
  color: var(--blue);
  display: inline-flex;
  padding: 0.15rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.speak-button:active { opacity: 0.5; }

.typing-dots span {
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  margin-right: 0.2rem;
  border-radius: 50%;
  background: var(--ink-tertiary);
  animation: typing 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

.mic-hint {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-secondary);
  text-align: center;
  max-width: 18rem;
  line-height: 1.4;
}

.translator-view.is-live .mic-hint {
  color: var(--pink);
}

.is-ptt .mic-hint {
  color: var(--blue);
}

.mic-fab {
  position: relative;
  width: 4.75rem;
  height: 4.75rem;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mic-fab-core {
  position: relative;
  z-index: 2;
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 50%;
  background: var(--blue);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.38);
  transition: transform 0.14s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.mic-fab:active .mic-fab-core,
.mic-fab.is-pressing .mic-fab-core {
  transform: scale(0.9);
}

.mic-fab:disabled .mic-fab-core {
  opacity: 0.55;
}

.is-live .mic-fab-core {
  background: var(--accent-strong);
  box-shadow: 0 8px 26px rgba(var(--accent-rgb), 0.45);
}

.is-ptt.is-live .mic-fab-core {
  background: var(--blue);
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.38);
}

.mic-fab.is-speaking .mic-fab-core,
.is-transmitting .mic-fab-core {
  background: var(--accent);
  box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.5);
  animation: micPulse 0.9s ease-in-out infinite;
}

.mic-fab-rings {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.mic-ring {
  position: absolute;
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 50%;
  border: 2px solid rgba(var(--accent-rgb), 0.35);
  opacity: 0;
}

.is-live .mic-ring {
  border-color: rgba(var(--accent-rgb), 0.45);
}

.mic-fab.is-speaking .mic-ring,
.is-transmitting .mic-ring {
  animation: micRipple 1.6s ease-out infinite;
}

.mic-ring:nth-child(2) { animation-delay: 0.45s; }
.mic-ring:nth-child(3) { animation-delay: 0.9s; }

.mic-level {
  position: absolute;
  inset: 0.35rem;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0%, transparent 72%);
  opacity: calc(0.15 + var(--mic-level, 0) * 0.85);
  transform: scale(calc(0.85 + var(--mic-level, 0) * 0.35));
  transition: opacity 0.08s linear, transform 0.08s linear;
}

.icon-stop { display: none; }
.is-live:not(.is-ptt) .mic-fab .icon-mic { display: none; }
.is-live:not(.is-ptt) .mic-fab .icon-stop { display: block; }

.live-pill {
  cursor: default;
}

.is-live .live-pill {
  cursor: pointer;
}

/* 笏笏 Drawer 笏笏 */

.drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.drawer-overlay.is-open { opacity: 1; }

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: min(84%, 20rem);
  z-index: 18;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: -2px 0 24px rgba(0, 0, 0, 0.18);
  padding: max(0.75rem, env(safe-area-inset-top, 0px)) 0 max(0.75rem, env(safe-area-inset-bottom, 0px));
  padding-right: max(0px, env(safe-area-inset-right, 0px));
}

.drawer.is-open { transform: translateX(0); }

.translator-view.is-hidden .drawer,
.translator-view.is-hidden .drawer-overlay {
  display: none;
}

.drawer-header {
  display: flex;
  align-items: center;
  padding: max(3.75rem, calc(env(safe-area-inset-top, 0px) + 3.25rem)) 3.75rem 0.75rem 1rem;
  flex: 0 0 auto;
}

.drawer-header h3 {
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
}

.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 0.75rem;
}

.new-conv-button {
  margin: 0 1rem 0.75rem;
  height: 2.75rem;
  border: 1px solid var(--separator);
  border-radius: 0.5rem;
  background: var(--fill);
  color: var(--blue);
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.new-conv-button:active { opacity: 0.6; }

.session-list {
  max-height: min(40vh, 18rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 0.75rem 0.25rem;
}

.session-day {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-tertiary);
  padding: 0.75rem 0.5rem 0.35rem;
}

.session-item {
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 0.7rem 0.5rem;
  border-radius: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  cursor: pointer;
  transition: background 0.15s;
}

.session-item:active { background: var(--fill); }
.session-item.is-active { background: var(--fill); }

.session-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta {
  font-size: 0.78rem;
  color: var(--ink-tertiary);
}

.session-empty {
  text-align: center;
  color: var(--ink-tertiary);
  font-size: 0.9rem;
  padding: 2rem 1rem;
}

.logout-link {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: 0.5rem;
  background: none;
  color: var(--pink);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.drawer-settings {
  margin: 0.75rem 1rem 0;
  padding: 0.85rem 0.9rem;
  border-radius: 0.5rem;
  background: var(--fill);
  border: 1px solid var(--separator);
}

.drawer-settings-title {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
  margin-bottom: 0.65rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
}

.setting-row + .setting-row {
  border-top: 1px solid var(--separator);
}

.setting-row-select {
  flex-direction: column;
  align-items: stretch;
}

.setting-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.setting-toggle {
  width: 2.75rem;
  height: 1.6rem;
  appearance: none;
  border-radius: 999rem;
  background: var(--separator);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.setting-toggle::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.setting-toggle:checked {
  background: var(--blue);
}

.setting-toggle:checked::after {
  transform: translateX(1.15rem);
}

.setting-select {
  width: 100%;
  height: 2.5rem;
  margin-top: 0.5rem;
  border: 1px solid var(--separator);
  border-radius: 0.625rem;
  background: var(--bg-elevated);
  padding: 0 0.65rem;
  font-size: 0.9375rem;
}

.setting-help {
  margin-top: 0.4rem;
  color: var(--ink-tertiary);
  font-size: 0.75rem;
  line-height: 1.4;
}

.settings-link {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: 0.5rem;
  background: none;
  color: var(--blue);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.drawer-actions {
  flex: 0 0 auto;
  display: grid;
  gap: 0.15rem;
  margin: 0;
  padding: 0.6rem 1rem 0;
  border-top: 1px solid var(--separator);
  background: var(--bg-elevated);
}

/* 笏笏 Password change dialog 笏笏 */

.password-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.password-overlay.is-hidden {
  display: none;
}

.password-dialog {
  width: min(100%, 22rem);
  padding: 1.5rem;
  border-radius: 1.25rem;
  background: var(--bg-elevated);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.password-dialog h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.password-dialog-desc {
  margin: 0 0 1rem;
  color: var(--ink-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.password-change-form .form-row {
  margin-bottom: 0.85rem;
}

.password-change-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.password-change-form input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--separator);
  border-radius: 0.65rem;
  font-size: 1rem;
  background: var(--bg-elevated);
  color: var(--ink);
}

.password-dialog-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.password-dialog-actions .app-button {
  flex: 1;
}

.password-logout-link {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.5rem;
  border: none;
  background: none;
  color: var(--pink);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.app-button.secondary {
  background: var(--fill);
  color: var(--ink);
  border: 1px solid var(--separator);
}

/* 笏笏 Toast 笏笏 */

.toast {
  position: absolute;
  left: 50%;
  bottom: 6rem;
  transform: translateX(-50%) translateY(1rem);
  z-index: 20;
  max-width: min(88vw, 18rem);
  padding: 0.65rem 1rem;
  border-radius: 999rem;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  word-break: keep-all;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 笏笏 Keyframes 笏笏 */

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.5); }
  100% { box-shadow: 0 0 0 0.5rem rgba(var(--accent-rgb), 0); }
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(0.4rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-0.2rem); opacity: 1; }
}

@keyframes micPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes micRipple {
  0% { transform: scale(1); opacity: 0.65; }
  100% { transform: scale(1.85); opacity: 0; }
}

/* 笏笏 Large screens: auth only (translator stays phone layout) 笏笏 */

@media (min-width: 720px) {
  .auth-view {
    width: min(100%, 34rem);
    left: 50%;
    transform: translateX(-50%);
  }

  .auth-view.is-hidden {
    display: none;
  }
}

/* 笏笏 Compact height (small phones) 笏笏 */

@media (max-height: 640px) {
  .session-list {
    max-height: min(30vh, 11rem);
  }

  .drawer-settings {
    padding: 0.7rem 0.8rem;
  }

  .setting-help {
    font-size: 0.7rem;
  }

  .panel-text {
    font-size: 1.0625rem;
  }

  .panel-placeholder {
    font-size: 0.875rem;
  }

  .mic-fab {
    width: 4.25rem;
    height: 4.25rem;
  }

  .mic-fab-core,
  .mic-ring {
    width: 3.875rem;
    height: 3.875rem;
  }

  .mic-hint {
    font-size: 0.75rem;
  }
}

/* 笏笏 Reduced Motion 笏笏 */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}


/* 笏笏 Nav Actions (admin button group) 笏笏 */

.nav-actions {
    position: relative;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: flex-end;
}

.nav-bar:has(.nav-actions) {
    grid-template-columns: 3rem 1fr 3rem;
}

/* 笏笏 Admin Auth Login 笏笏 */

.admin-auth-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 1rem;
  background: rgba(var(--accent-rgb), 0.1);
}

.admin-auth-icon svg {
  width: 2.5rem;
  height: 2.5rem;
}

.admin-auth-card h1 {
  font-size: 1.625rem;
}

/* 笏笏 Admin View 笏笏 */

.admin-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 0% 0%, rgba(var(--accent-rgb), 0.08), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(var(--accent-rgb), 0.06), transparent 40%),
    var(--bg);
  z-index: 1;
}

.admin-view.is-hidden {
  display: none;
}

.admin-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem clamp(1rem, 4vw, 2rem);
  border-bottom: 1px solid var(--separator);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 2;
}

[data-theme="dark"] .admin-header {
  background: rgba(28, 28, 30, 0.82);
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.admin-header-logo {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.admin-header-logo span {
  color: var(--blue);
}

.admin-header-badge {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25em 0.55em;
  border-radius: 0.375rem;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--blue);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.admin-header-user {
  font-size: 0.8125rem;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12rem;
}

.admin-header-avatar {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--blue);
  font-size: 0.8125rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.admin-logout-btn {
  flex-shrink: 0;
  height: 2.25rem;
  padding: 0 0.875rem;
  border: 1px solid var(--separator);
  border-radius: 0.5rem;
  background: var(--fill);
  color: var(--ink-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.admin-logout-btn:hover {
  background: rgba(255, 59, 48, 0.08);
  border-color: rgba(255, 59, 48, 0.25);
  color: var(--pink);
}

.admin-logout-btn:active {
  transform: scale(0.97);
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.5rem clamp(1rem, 4vw, 2rem) 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 52rem;
  width: 100%;
  margin: 0 auto;
}

.admin-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.admin-stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  border-radius: 0.875rem;
  padding: 1rem 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.admin-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
}

.admin-stat-value-sm {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.admin-page-intro {
  padding: 0.25rem 0 0.5rem;
}

.admin-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.375rem;
}

.admin-page-desc {
  font-size: 0.9375rem;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.admin-card {
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.admin-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
  padding: 0 0.75rem;
  height: 2.5rem;
  border: 1px solid var(--separator);
  border-radius: 0.625rem;
  background: var(--bg);
  color: var(--ink-tertiary);
}

.admin-search {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  color: var(--ink);
  outline: none;
}

.admin-search::placeholder {
  color: var(--ink-tertiary);
}

.admin-search-clear {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  border-radius: 50%;
  background: var(--fill);
  color: var(--ink-secondary);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.admin-search-clear:active {
  opacity: 0.7;
}

.admin-list-head {
  display: none;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  padding: 0 0.75rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
}

.admin-user-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem;
  border: 1px solid transparent;
  background: var(--fill);
  border-radius: 0.75rem;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
  font: inherit;
  color: inherit;
}

.admin-user-row:hover {
  background: rgba(var(--accent-rgb), 0.06);
  border-color: rgba(var(--accent-rgb), 0.12);
}

.admin-copy-btn {
  flex-shrink: 0;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 0.5rem;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}

.admin-copy-btn:hover {
  background: rgba(var(--accent-rgb), 0.18);
}

.admin-copy-btn:active {
  transform: scale(0.96);
}

.admin-user-row.is-copied .admin-copy-btn {
  background: rgba(52, 199, 89, 0.16);
  border-color: rgba(52, 199, 89, 0.35);
  color: var(--green);
}

.admin-user-row.is-copied {
  background: rgba(52, 199, 89, 0.12);
  border-color: rgba(52, 199, 89, 0.28);
}

.admin-list-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.admin-refresh-btn {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--separator);
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s;
}

.admin-refresh-btn:hover {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.25);
  color: var(--blue);
}

.admin-refresh-btn:active {
  transform: scale(0.94);
}

.admin-del-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.admin-del-btn:disabled:hover {
  background: transparent;
  color: var(--ink-tertiary);
}

.admin-user-row:has(.admin-del-btn:disabled) {
  opacity: 0.92;
}

.app-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.admin-card-head {
  margin-bottom: 1rem;
}

.admin-card-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.admin-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--ink);
}

.admin-card-desc {
  font-size: 0.8125rem;
  color: var(--ink-tertiary);
  line-height: 1.45;
}

.admin-user-count {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--blue);
  background: rgba(var(--accent-rgb), 0.1);
  padding: 0.35em 0.75em;
  border-radius: 999rem;
  white-space: nowrap;
}

.admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-user-avatar {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--blue);
  font-size: 0.875rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.admin-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.admin-user-id {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-meta {
  font-size: 0.75rem;
  color: var(--ink-tertiary);
}

.admin-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  color: var(--ink-tertiary);
  font-size: 0.875rem;
  padding: 2rem 0;
}

.admin-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--separator);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: adminSpin 0.7s linear infinite;
}

@keyframes adminSpin {
  to { transform: rotate(360deg); }
}

.admin-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.375rem;
  padding: 2rem 1rem;
  color: var(--ink-tertiary);
}

.admin-empty svg {
  margin-bottom: 0.5rem;
  opacity: 0.45;
}

.admin-empty-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.admin-empty-desc {
  font-size: 0.8125rem;
  line-height: 1.45;
  max-width: 16rem;
}

.admin-empty-action {
  margin-top: 0.75rem;
  height: 2.5rem;
  padding: 0 1rem;
  border: none;
  border-radius: 0.625rem;
  background: var(--blue);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.admin-empty-action:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.admin-empty-error .admin-empty-title {
  color: var(--pink);
}

/* 笏笏 Admin Add Form 笏笏 */

.admin-add-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-add-row {
  display: flex;
  gap: 0.625rem;
  align-items: stretch;
}

.admin-icon-btn {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--separator);
  border-radius: 0.625rem;
  background: var(--bg);
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.admin-icon-btn:hover {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.25);
  color: var(--blue);
}

.admin-icon-btn:active {
  transform: scale(0.96);
}

.admin-input {
  flex: 1;
  min-width: 0;
  height: 2.75rem;
  padding: 0 0.875rem;
  border: 1px solid var(--separator);
  border-radius: 0.625rem;
  background: var(--bg);
  font-size: 0.9375rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-input::placeholder {
  color: var(--ink-tertiary);
}

.admin-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.admin-add-btn {
  flex-shrink: 0;
  height: 2.75rem;
  padding: 0 1.125rem;
  border: none;
  border-radius: 0.625rem;
  background: var(--blue);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: opacity 0.15s, transform 0.12s;
  white-space: nowrap;
}

.admin-add-btn:active {
  transform: scale(0.97);
  opacity: 0.88;
}

.admin-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-add-message {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--pink);
  min-height: 1rem;
}

.admin-add-message.is-success {
  color: var(--green);
}

.admin-quick-add {
  align-self: flex-start;
  border: none;
  background: none;
  color: var(--blue);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.125rem 0;
}

.admin-quick-add:hover {
  text-decoration: underline;
}

.admin-quick-add:active {
  opacity: 0.7;
}

.admin-del-btn {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--ink-tertiary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}

.admin-del-btn:hover {
  background: rgba(255, 59, 48, 0.1);
  color: var(--pink);
}

.admin-del-btn:active {
  transform: scale(0.92);
}

@media (max-width: 480px) {
  .admin-header-user {
    display: none;
  }

  .admin-add-row {
    flex-direction: column;
  }

  .admin-icon-btn,
  .admin-add-btn {
    width: 100%;
    justify-content: center;
  }

  .input-with-action {
    flex-direction: column;
  }

  .input-action-btn {
    width: 100%;
  }

  .admin-copy-btn {
    padding: 0 0.5rem;
    font-size: 0.6875rem;
  }
}

@media (min-width: 720px) {
  .admin-content {
    padding-top: 2rem;
    max-width: 56rem;
  }

  .admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 1.25rem;
    align-items: start;
  }

  .admin-card-list {
    min-height: 20rem;
  }

  .admin-list-head {
    display: grid;
  }

  .admin-list-head span:last-child {
    text-align: right;
    padding-right: 0.25rem;
  }
}

@media (min-width: 48rem) {
  .admin-content {
    padding-top: 2rem;
  }
}

/* 笏笏 Confirm Dialog 笏笏 */

.dialog-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 1.5rem;
}

.dialog-overlay.is-hidden {
    display: none;
}

.dialog {
    background: var(--bg-elevated);
    border-radius: 1rem;
    padding: 1.5rem 1.25rem 1.25rem;
    width: 100%;
    max-width: 20rem;
    box-shadow: 0 16px 48px rgba(0,0,0,0.22);
}

.dialog-message {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    text-align: center;
    margin-bottom: 1.25rem;
    line-height: 1.45;
}

.dialog-actions {
    display: flex;
    gap: 0.6rem;
}

.dialog-btn {
    flex: 1;
    height: 2.75rem;
    border: none;
    border-radius: 0.7rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.12s;
}

.dialog-btn:active { transform: scale(0.97); opacity: 0.85; }

.dialog-btn.cancel {
    background: var(--fill);
    color: var(--ink);
}

.dialog-btn.danger {
    background: #ff3b30;
    color: #fff;
}

/* Modern auth polish */

.user-auth-view {
  background:
    linear-gradient(180deg, #f8fbff 0%, #eef2ff 100%);
}

.user-auth-card {
  width: min(100%, 27rem);
  border-radius: 1rem;
  border-color: rgba(79, 70, 229, 0.18);
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(67, 56, 202, 0.13);
}

.user-auth-card .auth-hero {
  gap: 0.55rem;
}

.user-auth-card .app-icon,
.user-auth-card .app-icon svg {
  width: 4.25rem;
  height: 4.25rem;
}

.user-auth-card .app-icon {
  filter: drop-shadow(0 10px 18px rgba(0, 122, 255, 0.18));
}

.user-auth-card h1 {
  max-width: 17rem;
  text-align: center;
  font-size: 1.82rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.user-auth-card .brand-accent {
  color: var(--ui-primary);
}

.user-auth-card .auth-subtitle {
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
}

.user-auth-card .form-group {
  gap: 0.95rem;
  background: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.user-auth-card .form-row {
  gap: 0.45rem;
}

.user-auth-card .form-row label {
  color: #334155;
  font-size: 0.8rem;
}

.user-auth-card .form-row input {
  height: 3rem;
  border-radius: 0.75rem;
  background: #ffffff;
  border-color: rgba(100, 116, 139, 0.32);
  font-size: 1rem;
}

.user-auth-card .form-row input:focus {
  border-color: #ff7118;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 113, 24, 0.13);
}

.user-auth-card .form-row-separator {
  padding-top: 0.2rem;
  border-top: none;
}

.user-auth-card .app-button.primary {
  height: 3.15rem;
  border-radius: 0.7rem;
}

.user-auth-card .auth-footer {
  color: var(--ink-tertiary);
}

@media (max-width: 480px) {
  .auth-view {
    justify-content: flex-start;
    padding: max(1.4rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  }

  .user-auth-card {
    width: 100%;
    margin-top: clamp(1rem, 7vh, 4rem);
    padding: 1.55rem 1.35rem 1.3rem;
    gap: 1.35rem;
  }

  .user-auth-card .app-icon,
  .user-auth-card .app-icon svg {
    width: 3.65rem;
    height: 3.65rem;
  }

  .user-auth-card h1 {
    max-width: 14rem;
    font-size: 1.65rem;
  }

  .user-auth-card .auth-subtitle {
    font-size: 0.84rem;
  }

  .user-auth-card .form-row input {
    height: 3.05rem;
  }

  .user-auth-card .password-field {
    height: 3.05rem;
  }

  .user-auth-card .form-row-submit {
    margin-top: 0.25rem;
  }

  .user-auth-card .auth-footer {
    display: none;
  }
}

/* Pushable buttons */

:root,
[data-theme="light"] {
  --button-face: hsl(248, 53%, 58%);
  --button-edge-a: hsl(248, 39%, 39%);
  --button-edge-b: hsl(248, 39%, 49%);
  --button-edge-c: hsl(248, 39%, 29%);
  --button-shadow: hsl(226, 25%, 69%);
  --button-ring: deeppink;
}

[data-theme="dark"] {
  --button-face: hsl(248, 53%, 62%);
  --button-edge-a: hsl(248, 39%, 34%);
  --button-edge-b: hsl(248, 39%, 44%);
  --button-edge-c: hsl(248, 39%, 24%);
  --button-shadow: hsl(226, 18%, 34%);
  --button-ring: #ff4faf;
}

.app-button,
.input-action-btn,
.nav-icon-button,
.replay-button,
.history-banner-btn,
.new-conv-button,
.session-item,
.speak-button,
.settings-link,
.logout-link,
.password-logout-link,
.dialog-btn,
.password-toggle {
  --btn-face: var(--button-face);
  --btn-edge-a: var(--button-edge-a);
  --btn-edge-b: var(--button-edge-b);
  --btn-edge-c: var(--button-edge-c);
  --btn-text: #fff;
  --btn-lift: -4px;
  --btn-hover-lift: -6px;
  --btn-active-lift: -2px;
  --btn-radius: 0.5rem;
  --btn-shadow: var(--button-shadow);
  --btn-transform: translateY(0);
  position: relative;
  isolation: isolate;
  overflow: visible;
  border: 0 !important;
  outline-offset: 4px;
  outline-color: var(--button-ring);
  border-radius: var(--btn-radius) !important;
  background: var(--btn-face) !important;
  color: var(--btn-text) !important;
  box-shadow: none;
  transform: translateY(var(--btn-lift));
  transition:
    filter 250ms,
    transform 600ms cubic-bezier(0.3, 0.7, 0.4, 1);
}

.app-button::before,
.input-action-btn::before,
.nav-icon-button::before,
.replay-button::before,
.history-banner-btn::before,
.new-conv-button::before,
.session-item::before,
.speak-button::before,
.settings-link::before,
.logout-link::before,
.password-logout-link::before,
.dialog-btn::before,
.password-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--btn-shadow);
  filter: blur(2px);
  transform: translateY(6px);
  transition: transform 600ms cubic-bezier(0.3, 0.7, 0.4, 1);
  pointer-events: none;
  z-index: -2;
}

.app-button::after,
.input-action-btn::after,
.nav-icon-button::after,
.replay-button::after,
.history-banner-btn::after,
.new-conv-button::after,
.session-item::after,
.speak-button::after,
.settings-link::after,
.logout-link::after,
.password-logout-link::after,
.dialog-btn::after,
.password-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    to right,
    var(--btn-edge-a) 0%,
    var(--btn-edge-b) 8%,
    var(--btn-edge-a) 92%,
    var(--btn-edge-c) 100%
  );
  transform: translateY(4px);
  pointer-events: none;
  z-index: -1;
}

.app-button:focus-visible,
.input-action-btn:focus-visible,
.nav-icon-button:focus-visible,
.replay-button:focus-visible,
.history-banner-btn:focus-visible,
.new-conv-button:focus-visible,
.session-item:focus-visible,
.speak-button:focus-visible,
.settings-link:focus-visible,
.logout-link:focus-visible,
.password-logout-link:focus-visible,
.dialog-btn:focus-visible,
.password-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--button-ring) 35%, transparent);
}

.app-button:hover,
.input-action-btn:hover,
.nav-icon-button:hover,
.replay-button:hover,
.history-banner-btn:hover,
.new-conv-button:hover,
.session-item:hover,
.speak-button:hover,
.settings-link:hover,
.logout-link:hover,
.password-logout-link:hover,
.dialog-btn:hover,
.password-toggle:hover {
  filter: brightness(110%);
  transform: translateY(var(--btn-hover-lift));
  transition: transform 250ms cubic-bezier(0.3, 0.7, 0.4, 1.5), filter 250ms;
}

.app-button:hover::before,
.input-action-btn:hover::before,
.nav-icon-button:hover::before,
.replay-button:hover::before,
.history-banner-btn:hover::before,
.new-conv-button:hover::before,
.session-item:hover::before,
.speak-button:hover::before,
.settings-link:hover::before,
.logout-link:hover::before,
.password-logout-link:hover::before,
.dialog-btn:hover::before,
.password-toggle:hover::before {
  transform: translateY(8px);
  transition: transform 250ms cubic-bezier(0.3, 0.7, 0.4, 1.5);
}

.app-button:active,
.input-action-btn:active,
.nav-icon-button:active,
.replay-button:active,
.history-banner-btn:active,
.new-conv-button:active,
.session-item:active,
.speak-button:active,
.settings-link:active,
.logout-link:active,
.password-logout-link:active,
.dialog-btn:active,
.password-toggle:active {
  opacity: 1;
  transform: translateY(var(--btn-active-lift)) !important;
  transition: transform 34ms;
}

.app-button:active::before,
.input-action-btn:active::before,
.nav-icon-button:active::before,
.replay-button:active::before,
.history-banner-btn:active::before,
.new-conv-button:active::before,
.session-item:active::before,
.speak-button:active::before,
.settings-link:active::before,
.logout-link:active::before,
.password-logout-link:active::before,
.dialog-btn:active::before,
.password-toggle:active::before {
  transform: translateY(3px);
  transition: transform 34ms;
}

.nav-icon-button,
.replay-button,
.password-toggle {
  --btn-lift: -3px;
  --btn-hover-lift: -5px;
  --btn-active-lift: -1px;
  --btn-radius: 999rem;
}

.password-toggle {
  --btn-face: #ffffff;
  --btn-edge-a: hsl(226, 18%, 62%);
  --btn-edge-b: hsl(226, 18%, 72%);
  --btn-edge-c: hsl(226, 18%, 52%);
  --btn-text: var(--ink-secondary);
  --btn-shadow: rgba(100, 116, 139, 0.34);
}

[data-theme="dark"] .password-toggle {
  --btn-face: #2a2a2a;
  --btn-edge-a: hsl(226, 14%, 28%);
  --btn-edge-b: hsl(226, 14%, 38%);
  --btn-edge-c: hsl(226, 14%, 20%);
}

.app-button.secondary,
.dialog-btn.cancel,
.input-action-btn {
  --btn-face: hsl(211, 90%, 56%);
  --btn-edge-a: hsl(218, 70%, 35%);
  --btn-edge-b: hsl(218, 70%, 45%);
  --btn-edge-c: hsl(218, 70%, 28%);
  --btn-shadow: hsl(215, 22%, 68%);
}

.settings-link,
.history-banner-btn,
.new-conv-button,
.session-item,
.speak-button {
  --btn-face: hsl(224, 76%, 54%);
  --btn-edge-a: hsl(224, 62%, 32%);
  --btn-edge-b: hsl(224, 62%, 42%);
  --btn-edge-c: hsl(224, 62%, 24%);
  --btn-shadow: hsl(218, 22%, 68%);
}

.session-item,
.speak-button {
  --btn-lift: -2px;
  --btn-hover-lift: -3px;
  --btn-active-lift: -1px;
}

.speak-button {
  --btn-radius: 999rem;
  padding: 0.32rem;
}

.logout-link,
.password-logout-link,
.dialog-btn.danger {
  --btn-face: hsl(0, 82%, 60%);
  --btn-edge-a: hsl(0, 66%, 35%);
  --btn-edge-b: hsl(0, 66%, 45%);
  --btn-edge-c: hsl(0, 66%, 27%);
  --btn-shadow: hsl(0, 18%, 68%);
}

.app-button:disabled,
.input-action-btn:disabled,
.dialog-btn:disabled {
  transform: translateY(var(--btn-lift)) !important;
  filter: grayscale(0.2);
  opacity: 0.55;
  cursor: not-allowed;
}

.replay-button {
  grid-column: 3;
  justify-self: start;
  margin-left: 0.85rem;
}

.replay-button:hover,
.replay-button:active {
  transform: scale(0.96);
}

.mic-fab-core {
  background: var(--button-face);
  box-shadow:
    0 0.35rem 0 hsl(248, 39%, 34%),
    0 0.55rem 0.2rem -0.2rem var(--button-shadow);
  overflow: hidden;
  transform: translateY(-4px);
  transition: transform 600ms cubic-bezier(0.3, 0.7, 0.4, 1), filter 250ms;
}

.mic-fab-core::before {
  content: "";
  position: absolute;
  top: 0.65rem;
  left: 1rem;
  width: 1.35rem;
  height: 0.6rem;
  border-radius: 999rem;
  background: rgba(255, 255, 255, 0.42);
  filter: blur(2px);
}

.mic-fab:active .mic-fab-core,
.mic-fab.is-pressing .mic-fab-core {
  transform: translateY(-2px) scale(0.98);
  box-shadow:
    0 0.15rem 0 hsl(248, 39%, 34%),
    0 0.25rem 0.2rem -0.2rem var(--button-shadow);
}

/* Keep pushable treatment off utility/list/icon buttons. */

.nav-icon-button,
.replay-button,
.password-toggle,
.session-item,
.speak-button {
  isolation: auto;
  overflow: hidden;
  border: none !important;
  box-shadow: none;
  filter: none;
}

.nav-icon-button::before,
.nav-icon-button::after,
.replay-button::before,
.replay-button::after,
.password-toggle::before,
.password-toggle::after,
.session-item::before,
.session-item::after,
.speak-button::before,
.speak-button::after {
  display: none;
}

.nav-icon-button {
  transform: none !important;
  border-radius: 50% !important;
  background: var(--fill) !important;
  color: var(--ink) !important;
}

.nav-icon-button:active {
  transform: scale(0.9) !important;
  opacity: 0.7;
}

.password-toggle {
  transform: none !important;
  border-radius: 0.375rem !important;
  background: transparent !important;
  color: var(--ink-tertiary) !important;
}

.password-toggle:hover,
.password-toggle:active {
  transform: none !important;
  filter: none;
}

.replay-button {
  transform: translate(2.8rem, -50%) !important;
  border: 1px solid var(--separator) !important;
  border-radius: 50% !important;
  background: var(--bg-elevated) !important;
  color: var(--blue) !important;
}

.replay-button:active {
  transform: translate(2.8rem, -50%) scale(0.9) !important;
  opacity: 0.7;
}

.session-item {
  transform: none !important;
  background: none !important;
  color: inherit !important;
  border-radius: 0.6rem !important;
}

.session-item:active,
.session-item.is-active {
  background: var(--fill) !important;
}

.speak-button {
  transform: none !important;
  border-radius: 0.4rem !important;
  background: none !important;
  color: var(--ink-tertiary) !important;
}

.bubble.translation .speak-button {
  color: var(--blue) !important;
}

/* Refined product UI system
   Inspired by DESIGN.md-style tokens: quiet surfaces, clear hierarchy, restrained controls. */

:root,
[data-theme="light"] {
  --ui-canvas: #f5f7fb;
  --ui-surface: #ffffff;
  --ui-surface-muted: #f7f9fc;
  --ui-border: rgba(15, 23, 42, 0.1);
  --ui-border-strong: rgba(15, 23, 42, 0.16);
  --ui-text: #111827;
  --ui-muted: #64748b;
  --ui-primary: #0f56d9;
  --ui-primary-hover: #0b46b5;
  --ui-danger: #d92d20;
  --ui-danger-hover: #b42318;
  --ui-radius-sm: 0.5rem;
  --ui-radius-md: 0.75rem;
  --ui-radius-lg: 1rem;
  --ui-pill: 999rem;
  --ui-shadow-card: 0 18px 54px rgba(15, 23, 42, 0.08);
  --ui-shadow-control: 0 8px 20px rgba(15, 23, 42, 0.1);
}

[data-theme="dark"] {
  --ui-canvas: #101114;
  --ui-surface: #18191d;
  --ui-surface-muted: #202126;
  --ui-border: rgba(255, 255, 255, 0.1);
  --ui-border-strong: rgba(255, 255, 255, 0.16);
  --ui-text: #f5f7fb;
  --ui-muted: rgba(245, 247, 251, 0.64);
  --ui-primary: #6fa3ff;
  --ui-primary-hover: #8ab6ff;
  --ui-danger: #ff6b5f;
  --ui-danger-hover: #ff8278;
  --ui-shadow-card: none;
  --ui-shadow-control: none;
}

.user-auth-view {
  background:
    radial-gradient(circle at 50% 0%, rgba(15, 86, 217, 0.08), transparent 24rem),
    var(--ui-canvas);
}

.user-auth-card {
  width: min(calc(100% - 2rem), 25.5rem);
  padding: clamp(1.35rem, 4vw, 2rem);
  gap: 1.35rem;
  border: 1px solid var(--ui-border);
  border-radius: 1.25rem;
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
}

.user-auth-card .auth-hero {
  gap: 0.65rem;
}

.user-auth-card .app-icon,
.user-auth-card .app-icon svg {
  width: 3.75rem;
  height: 3.75rem;
}

.user-auth-card h1 {
  max-width: none;
  font-size: clamp(1.75rem, 8vw, 2.2rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.user-auth-card .auth-subtitle {
  color: var(--ui-muted);
  font-size: 0.95rem;
}

.user-auth-card .form-group {
  gap: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.user-auth-card .form-row {
  padding: 0;
}

.user-auth-card .form-row + .form-row {
  margin-top: 1rem;
}

.user-auth-card .form-row label {
  margin-bottom: 0.45rem;
  color: var(--ui-text);
  font-size: 0.9rem;
  font-weight: 700;
}

.user-auth-card .form-row input {
  height: 3.15rem;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
  color: var(--ui-text);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.user-auth-card .form-row input:focus {
  border-color: var(--ui-primary);
  background: var(--ui-surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ui-primary) 16%, transparent);
}

.user-auth-card .password-field {
  width: 100%;
  height: 3.15rem;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.user-auth-card .password-field:focus-within {
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ui-primary) 16%, transparent);
}

.user-auth-card .password-field input {
  height: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding-right: 2.75rem;
}

.user-auth-card .password-field input:focus {
  border: none;
  box-shadow: none;
}

.user-auth-card .password-toggle {
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%) !important;
  width: 2.25rem;
  height: 2.25rem;
  border: none !important;
  background: transparent !important;
  color: var(--ui-muted) !important;
  box-shadow: none !important;
}

.user-auth-card .password-toggle::before,
.user-auth-card .password-toggle::after {
  display: none;
}

.user-auth-card .password-toggle:hover,
.user-auth-card .password-toggle:active {
  transform: translateY(-50%) !important;
  filter: none;
  color: var(--ui-text) !important;
  background: color-mix(in srgb, var(--ui-muted) 14%, transparent) !important;
}

.user-auth-card .form-row-submit {
  margin-top: 1.25rem;
  padding: 0;
}

.app-button,
.input-action-btn,
.history-banner-btn,
.new-conv-button,
.settings-link,
.logout-link,
.password-logout-link,
.dialog-btn {
  position: relative;
  isolation: auto;
  overflow: hidden;
  transform: none !important;
  min-height: 2.75rem;
  border: 1px solid transparent !important;
  border-radius: var(--ui-pill) !important;
  background: var(--ui-primary) !important;
  color: #ffffff !important;
  box-shadow: var(--ui-shadow-control);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  transition: background 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.app-button::before,
.app-button::after,
.input-action-btn::before,
.input-action-btn::after,
.history-banner-btn::before,
.history-banner-btn::after,
.new-conv-button::before,
.new-conv-button::after,
.settings-link::before,
.settings-link::after,
.logout-link::before,
.logout-link::after,
.password-logout-link::before,
.password-logout-link::after,
.dialog-btn::before,
.dialog-btn::after {
  display: none !important;
}

.app-button:hover,
.input-action-btn:hover,
.history-banner-btn:hover,
.new-conv-button:hover,
.settings-link:hover,
.logout-link:hover,
.password-logout-link:hover,
.dialog-btn:hover {
  filter: none;
  background: var(--ui-primary-hover) !important;
  transform: translateY(-1px) !important;
}

.app-button:active,
.input-action-btn:active,
.history-banner-btn:active,
.new-conv-button:active,
.settings-link:active,
.logout-link:active,
.password-logout-link:active,
.dialog-btn:active {
  transform: translateY(0) scale(0.985) !important;
  opacity: 0.94;
}

.app-button:focus-visible,
.input-action-btn:focus-visible,
.history-banner-btn:focus-visible,
.new-conv-button:focus-visible,
.settings-link:focus-visible,
.logout-link:focus-visible,
.password-logout-link:focus-visible,
.dialog-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--ui-primary) 18%, transparent),
    var(--ui-shadow-control);
}

.app-button.secondary,
.dialog-btn.cancel,
.input-action-btn {
  border-color: var(--ui-border-strong) !important;
  background: var(--ui-surface) !important;
  color: var(--ui-primary) !important;
  box-shadow: none;
}

.app-button.secondary:hover,
.dialog-btn.cancel:hover,
.input-action-btn:hover {
  background: var(--ui-surface-muted) !important;
}

.logout-link,
.password-logout-link,
.dialog-btn.danger {
  background: var(--ui-danger) !important;
  color: #ffffff !important;
}

.logout-link:hover,
.password-logout-link:hover,
.dialog-btn.danger:hover {
  background: var(--ui-danger-hover) !important;
}

.form-row-submit .app-button,
.user-auth-card .app-button.primary {
  height: 3.25rem;
  border-radius: var(--ui-pill) !important;
  font-size: 1rem;
}

.nav-icon-button,
.password-toggle,
.session-item,
.speak-button {
  isolation: auto;
  overflow: hidden;
  transform: none !important;
  box-shadow: none;
  filter: none;
}

.nav-icon-button {
  border: 1px solid var(--ui-border) !important;
  background: color-mix(in srgb, var(--ui-surface) 82%, transparent) !important;
  color: var(--ui-text) !important;
  backdrop-filter: blur(12px);
}

.nav-icon-button:active {
  transform: scale(0.96) !important;
}

.drawer {
  width: min(88%, 22rem);
  background: var(--ui-surface);
}

.drawer-header {
  padding: max(3.75rem, calc(env(safe-area-inset-top, 0px) + 3.25rem)) 3.75rem 0.85rem 1.15rem;
}

.drawer-header h3 {
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
}

.drawer-body {
  padding: 0 0 0.75rem;
}

.new-conv-button {
  width: calc(100% - 2rem);
  margin: 0 1rem 1rem;
  justify-content: center;
}

.session-list {
  max-height: min(34vh, 16rem);
  padding: 0 0.85rem;
}

.session-item {
  padding: 0.8rem 0.75rem;
  border: 1px solid transparent !important;
  border-radius: var(--ui-radius-md) !important;
  background: transparent !important;
}

.session-item:hover,
.session-item.is-active {
  border-color: var(--ui-border) !important;
  background: var(--ui-surface-muted) !important;
}

.session-title {
  color: var(--ui-text);
}

.session-meta {
  color: var(--ui-muted);
}

.drawer-settings {
  margin: 0.85rem 1rem 0;
  padding: 1rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface-muted);
}

.setting-row {
  padding: 0.7rem 0;
}

.setting-select {
  height: 2.75rem;
  border-color: var(--ui-border-strong);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
}

.drawer-actions {
  gap: 0.55rem;
  padding: 0.85rem 1rem max(0.65rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--ui-border);
}

.settings-link,
.logout-link {
  width: 100%;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.72rem 1rem;
  text-align: center;
}

.panel {
  padding: clamp(0.8rem, 2.8vw, 1.15rem);
}

.panel-partner {
  border-top: 0;
  border-bottom: 2px solid var(--ui-primary);
}

.panel-partner .panel-header,
.panel-partner .panel-body {
  transform: rotate(180deg);
}

.panel-partner .panel-body {
  justify-content: center;
}

.panel-self {
  border-top: 2px solid var(--accent);
}

.panel-header {
  margin-bottom: 0.7rem;
}

.panel-badge {
  padding: 0.28rem 0.65rem;
  font-size: 0.75rem;
}

.panel-text {
  max-height: 100%;
  margin-inline: auto;
  font-size: clamp(1rem, 3.7vw, 1.28rem);
  line-height: 1.42;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: break-word;
  word-break: normal;
  text-wrap: pretty;
  hyphens: auto;
}

.panel-text.is-text-short {
  max-width: 20ch;
  font-size: clamp(1.2rem, 5vw, 1.65rem);
}

.panel-text.is-text-medium {
  max-width: 17ch;
  font-size: clamp(1.05rem, 4.2vw, 1.4rem);
}

.panel-text.is-text-long {
  max-width: 15ch;
  font-size: clamp(0.96rem, 3.7vw, 1.18rem);
}

.panel-text.is-text-xlong {
  max-width: 13ch;
  font-size: clamp(0.92rem, 3.4vw, 1.06rem);
}

.mic-bar {
  gap: 0.7rem;
  padding: 0.85rem 1rem;
}

.mic-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 4.9rem;
}

.mic-fab {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
}

.mic-fab-core {
  width: 4.25rem;
  height: 4.25rem;
  background: var(--ui-primary);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--ui-primary) 28%, transparent);
  transform: none;
}

.mic-fab-core::before {
  display: none;
}

.mic-fab:active .mic-fab-core,
.mic-fab.is-pressing .mic-fab-core {
  transform: scale(0.96);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--ui-primary) 24%, transparent);
}

.is-live .mic-fab-core,
.mic-fab.is-speaking .mic-fab-core,
.is-transmitting .mic-fab-core {
  background: var(--accent);
}

@media (max-width: 480px) {
  .user-auth-card {
    margin-top: clamp(0.75rem, 5vh, 2.5rem);
    padding: 1.3rem;
  }

  .drawer {
    width: min(86%, 21rem);
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   UI refinement pass — 2026-06  (洗練)
   Consolidates the earlier stacked layers (Vignelli / modern-auth / pushable
   / refined-ui) into one calm, cohesive system. No new palette: it reuses the
   established --ui-* and --accent tokens. Identity rule:
     · signal blue (--ui-primary) = brand wordmark + primary action
     · vermilion  (--accent)      = the live / active state + the user's voice
   The slot-char translation animation is intentionally left untouched.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* — Wordmark: one blue, tightened tracking, everywhere — */
.nav-title span {
  color: var(--ui-primary);
}
.user-auth-card h1,
.nav-title {
  letter-spacing: -0.02em;
}
.nav-title {
  font-size: 1.32rem;
}

/* — Auth: quieter canvas wash + a more deliberate card lift — */
.user-auth-view {
  background:
    radial-gradient(120% 78% at 50% -12%,
      color-mix(in srgb, var(--ui-primary) 9%, transparent), transparent 60%),
    var(--ui-canvas);
}
.user-auth-card {
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 28px 64px -24px rgba(15, 23, 42, 0.22);
}
[data-theme="dark"] .user-auth-card {
  box-shadow: 0 28px 64px -28px rgba(0, 0, 0, 0.7);
}
.user-auth-card .auth-subtitle {
  letter-spacing: 0.01em;
}
.user-auth-card .app-icon {
  filter: drop-shadow(0 10px 20px color-mix(in srgb, var(--ui-primary) 24%, transparent));
}

/* — Live pill: a self-contained chip; warms to vermilion when live — */
.live-pill {
  gap: 0.45rem;
  padding: 0.34rem 0.85rem;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  transition:
    color 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out),
    background 0.2s var(--ease-out);
}
.is-live .live-pill {
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, var(--ui-surface));
}

/* — Panel dividers: let the single coloured hairline do the work.
     Drop the mic-bar's own separators so the blue (partner) and vermilion
     (self) lines aren't doubled; carry elevation with a soft shadow. — */
.mic-bar {
  border-top: 0;
  border-bottom: 0;
  box-shadow: 0 -10px 28px -20px rgba(15, 23, 42, 0.5);
}
.panel-partner {
  border-bottom-width: 1.5px;
}
.panel-self {
  border-top-width: 1.5px;
}

/* — Badges: calmer, on the unified palette — */
.panel-badge {
  padding: 0.22rem 0.6rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}
.panel-badge-partner {
  background: color-mix(in srgb, var(--ui-primary) 12%, transparent);
  color: var(--ui-primary);
}
.panel-badge-self {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.panel-lang,
.panel-lang-select {
  color: var(--ui-muted);
}

/* — Quieter supporting copy — */
.panel-placeholder {
  color: var(--ui-muted);
  font-weight: 500;
}
.translation-caution {
  color: var(--ui-muted);
}
.mic-hint {
  letter-spacing: 0.01em;
}

/* — Drawer section heading rhythm — */
.drawer-settings-title {
  letter-spacing: 0.08em;
  color: var(--ui-muted);
}

/* — Session phase UX — */
.live-pill-spinner {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--separator);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: livePillSpin 0.75s linear infinite;
}

.live-pill-spinner.is-hidden {
  display: none;
}

.live-pill.is-connecting .live-dot {
  display: none;
}

.live-pill.is-busy .live-dot {
  background: var(--blue);
  box-shadow: 0 0 0 0 rgba(0, 57, 166, 0.45);
  animation: livePulse 1.2s ease-out infinite;
}

@keyframes livePillSpin {
  to { transform: rotate(360deg); }
}

.panel.is-phase-waiting,
.panel.is-phase-speaking {
  position: relative;
}

.panel.is-phase-waiting .panel-body::before,
.panel.is-phase-speaking .panel-body::before {
  display: block;
  margin: 0 auto 0.55rem;
  padding: 0.2rem 0.65rem;
  width: fit-content;
  border-radius: 999rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.panel-partner.is-phase-waiting .panel-body::before {
  content: "通訳中…";
  color: var(--blue);
  background: rgba(0, 57, 166, 0.1);
}

.panel-self.is-phase-waiting .panel-body::before {
  content: "通訳中…";
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.12);
}

.panel-partner.is-phase-speaking .panel-body::before {
  content: "相手に聞かせています";
  color: var(--blue);
  background: rgba(0, 57, 166, 0.12);
}

.panel-self.is-phase-speaking .panel-body::before {
  content: "相手に聞かせています";
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.14);
}

.panel.is-phase-waiting .panel-text,
.panel.is-phase-speaking .panel-text {
  opacity: 1;
}

.translator-view.is-connecting .mic-fab {
  pointer-events: none;
  opacity: 0.72;
}

/* — History resume bar — */
.history-resume-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin: 0 clamp(0.85rem, 3vw, 1.25rem) 0.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--separator);
  border-radius: 1rem;
  background: var(--bg-elevated);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.history-resume-bar.is-hidden {
  display: none;
}

.history-resume-copy {
  min-width: 0;
}

.history-resume-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

.history-resume-desc {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-tertiary);
}

.history-resume-bar .app-button {
  flex-shrink: 0;
  min-height: 2.5rem;
  padding: 0.55rem 0.95rem;
  font-size: 0.875rem;
}

.translator-view.is-viewing-history .live-pill-wrap,
.translator-view.is-viewing-history .dual-panel,
.translator-view.is-viewing-history .mic-bar {
  display: none;
}

.translator-view.is-viewing-history .chat-list {
  flex: 1;
  min-height: 0;
}

/* — Silence warning — */
.silence-warning {
  position: absolute;
  left: 50%;
  bottom: calc(max(6.5rem, env(safe-area-inset-bottom, 0px)) + 5.5rem);
  z-index: 12;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: min(calc(100% - 1.5rem), 24rem);
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(255, 113, 24, 0.35);
  border-radius: 0.85rem;
  background: color-mix(in srgb, var(--bg-elevated) 92%, #fff);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(8px);
}

.silence-warning.is-hidden {
  display: none;
}

.silence-warning-text {
  flex: 1;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.silence-warning .app-button {
  flex-shrink: 0;
  min-height: 2.25rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.8125rem;
}

/* — Onboarding — */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(2, 6, 23, 0.52);
  backdrop-filter: blur(6px);
}

.onboarding-overlay.is-hidden {
  display: none;
}

.onboarding-dialog {
  width: min(100%, 22rem);
  padding: 1.35rem 1.25rem 1.15rem;
  border: 1px solid var(--separator);
  border-radius: 1.15rem;
  background: var(--bg-elevated);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}

.onboarding-dialog h3 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
}

.onboarding-steps {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.onboarding-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.onboarding-step-num {
  flex-shrink: 0;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.onboarding-dialog .app-button {
  width: 100%;
}
