:root {
  color-scheme: light;
  --page: #eeeeee;
  --card: #ffffff;
  --soft: #f4f4f4;
  --soft-2: #e9e9e9;
  --ink: #242424;
  --muted: #7a7a7a;
  --muted-2: #9a9a9a;
  --line: #e5e5e5;
  --accent: #252525;
  --accent-text: #ffffff;
  --danger: #d6534b;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.05);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans JP", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 13px 28px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.topbar {
  height: 76px;
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
}

.topbar h1 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0;
}

.nav-button,
.round-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  display: inline-grid;
  place-items: center;
}

.nav-button:hover,
.round-button:hover {
  background: rgba(0, 0, 0, 0.05);
}

.nav-button svg {
  width: 30px;
  height: 30px;
  stroke-width: 2.2;
}

.session-card,
.settings-card,
.translation-card {
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.session-card {
  min-height: 58px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.compact-session strong,
.compact-session span {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.notice {
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff6da;
  color: #6e5100;
  display: flex;
  align-items: center;
  gap: 10px;
}

.notice[hidden] {
  display: none;
}

.notice svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.notice span {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.notice a {
  color: #2d2d2d;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.settings-card {
  overflow: hidden;
}

.settings-card summary {
  min-height: 48px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  list-style: none;
  color: var(--muted);
  font-weight: 800;
}

.settings-card summary::-webkit-details-marker {
  display: none;
}

.settings-card summary svg {
  width: 19px;
  height: 19px;
}

.status-pill {
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.ok {
  color: #28725f;
  background: #e5f6f1;
}

.status-pill.warn {
  color: #986f00;
  background: #fff2c4;
}

.control-strip {
  padding: 0 12px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.select-field,
.range-field,
.toggle-field {
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 9px;
}

.select-field span,
.range-field span {
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

select {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

option {
  color: var(--ink);
  background: var(--card);
}

.toggle-field {
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.toggle-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.range-field {
  grid-column: 1 / -1;
}

.range-field input {
  width: 100%;
  accent-color: var(--accent);
}

.range-field output {
  min-width: 56px;
  color: var(--ink);
  text-align: right;
  font-size: 0.86rem;
  font-weight: 800;
}

.translation-card {
  min-height: 0;
  padding: 11px 0 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(420px, 1fr);
}

.filter-tabs {
  min-height: 48px;
  padding: 0 17px 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr 1fr;
  align-items: center;
  gap: 7px;
}

.filter-tab {
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--soft-2);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0;
}

.filter-tab.active {
  background: var(--accent);
  color: var(--accent-text);
}

.tab-divider {
  width: 1px;
  height: 28px;
  background: #8f8f8f;
  margin: 0 8px;
}

.live-console {
  padding: 0 17px 4px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.speaker-panel {
  min-width: 0;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.speaker-panel.active {
  border-bottom-color: #bdbdbd;
}

.speaker-head {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  justify-content: space-between;
  gap: 7px;
}

.speaker-label,
.area-label {
  display: block;
  color: var(--muted-2);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.language-select {
  margin-top: 2px;
  max-width: 150px;
  color: var(--ink);
  font-size: 0.95rem;
}

.listen-button {
  display: none;
}

.listen-button svg,
.round-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.speaker-panel.active .listen-button {
  background: #111111;
}

.live-area {
  min-width: 0;
  display: none;
  gap: 4px;
}

.speaker-panel.active .live-area,
.speaker-panel.has-live .live-area {
  display: grid;
}

.live-text {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.translation-area .live-text {
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 900;
}

.live-text.empty {
  color: #b5b5b5;
}

.console-actions {
  min-width: 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.round-button {
  width: 34px;
  height: 34px;
  background: var(--soft);
}

.stop-button {
  color: var(--danger);
}

.transcript-shell {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.transcript-shell header {
  min-height: 34px;
  padding: 0 17px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.transcript-list {
  min-height: 0;
  margin: 0;
  padding: 0 17px 18px;
  list-style: none;
  overflow: auto;
  scrollbar-width: thin;
}

.transcript-item {
  padding: 17px 0 18px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.transcript-time {
  color: var(--muted-2);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.transcript-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.transcript-copy strong,
.transcript-copy span {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.transcript-copy strong {
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1.48;
  font-weight: 800;
}

.transcript-copy span {
  color: var(--ink);
  font-size: 1.28rem;
  line-height: 1.48;
  font-weight: 900;
}

.transcript-item[hidden] {
  display: none;
}

.error-text {
  color: var(--danger) !important;
}

@media (min-width: 720px) {
  .app-shell {
    width: min(100%, 760px);
    padding-inline: 20px;
  }

  .translation-card {
    grid-template-rows: auto auto minmax(440px, 1fr);
  }

  .speaker-panel {
    border-bottom: 0;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-top: 18px;
  }

  .session-card {
    padding: 13px 16px;
  }

  .control-strip {
    grid-template-columns: 1fr;
  }

  .filter-tabs {
    grid-template-columns: 1fr auto 1fr 1fr;
  }

  .filter-tab {
    font-size: 0.85rem;
  }

  .transcript-copy strong,
  .transcript-copy span {
    font-size: 1.08rem;
  }
}
