:root {
  --ink: #172122;
  --muted: #677473;
  --line: #cbd8d4;
  --surface: #f5f1e8;
  --panel: #fffaf0;
  --panel-deep: #e8efe8;
  --accent: #0f6b68;
  --accent-strong: #064b4a;
  --gold: #d99a2b;
  --danger: #b93831;
  --danger-dark: #7d1f1b;
  --shadow: 0 24px 70px rgba(23, 33, 34, 0.18);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(15, 107, 104, 0.12), transparent 35%),
    repeating-linear-gradient(90deg, rgba(23, 33, 34, 0.035) 0 1px, transparent 1px 92px),
    var(--surface);
  font-family: Georgia, "Times New Roman", serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.device-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.tablet {
  width: min(1180px, 100%);
  min-height: min(720px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  overflow: hidden;
  border: 12px solid #152326;
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 16px;
  background: #172122;
  color: #f6f1e7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  color: #f7c467;
  font-size: 24px;
  font-weight: 700;
}

.brand p,
.brand strong,
.rail-footer p,
.eyebrow {
  margin: 0;
}

.brand p {
  color: #d5ddd9;
  font-size: 13px;
}

.brand strong {
  display: block;
  font-size: 23px;
  line-height: 1;
}

.nav-list {
  display: grid;
  gap: 10px;
}

.nav-button,
.action-button,
.tab-button,
.phrase-tile,
.reply-option,
.method-button,
.speed-selector button,
.emergency {
  min-height: 54px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.08);
  color: #dce6e2;
  text-align: left;
  font-size: 17px;
}

.nav-button span {
  width: 26px;
  font-size: 21px;
  text-align: center;
}

.nav-button.is-active,
.nav-button:hover {
  background: #f3c262;
  color: #172122;
}

.rail-footer {
  margin-top: auto;
  display: grid;
  gap: 9px;
  color: #b7c5c1;
  font-size: 13px;
}

.signal {
  display: flex;
  gap: 5px;
  align-items: end;
  height: 20px;
}

.signal span {
  width: 9px;
  border-radius: 2px 2px 0 0;
  background: #66c8bd;
}

.signal span:nth-child(1) {
  height: 8px;
}

.signal span:nth-child(2) {
  height: 13px;
}

.signal span:nth-child(3) {
  height: 19px;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  background:
    linear-gradient(rgba(255, 250, 240, 0.92), rgba(255, 250, 240, 0.92)),
    radial-gradient(circle at 75% 15%, rgba(217, 154, 43, 0.16), transparent 34%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 30px 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--accent-strong);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.08;
}

.status-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
}

.control-mode {
  min-width: 178px;
  padding: 7px 10px;
  border: 1px solid rgba(15, 107, 104, 0.24);
  border-radius: var(--radius);
  background: #fffdf7;
}

.control-mode strong,
.control-mode span {
  display: block;
}

.control-mode strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.control-mode span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.battery {
  width: 72px;
  height: 30px;
  padding: 4px;
  display: flex;
  border: 2px solid #86928f;
  border-radius: 5px;
}

.battery span {
  display: block;
  border-radius: 2px;
  background: var(--accent);
}

.screen {
  display: none;
  min-height: 0;
  padding: 24px 30px 30px;
}

.screen.is-active {
  display: block;
}

.compose-layout,
.conversation-layout {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(340px, 0.95fr);
  gap: 22px;
}

.utterance-panel,
.keyboard-panel,
.transcript,
.reply-panel,
.settings-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.46);
}

.utterance-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 430px;
}

.utterance-field {
  display: flex;
  align-items: center;
  padding: 34px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.06;
}

.suggestion-strip {
  padding: 16px;
  border-top: 1px solid var(--line);
  background: var(--panel-deep);
}

.suggestion-strip p {
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.suggestions,
.compose-actions,
.quick-header,
.tabs,
.reply-list,
.method-grid,
.speed-selector {
  display: grid;
  gap: 12px;
}

.suggestions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.suggestion-button,
.letter-button {
  min-height: 72px;
  border: 1px solid rgba(15, 107, 104, 0.3);
  border-radius: var(--radius);
  background: #fffdf7;
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
}

button.is-scan-active {
  outline: 6px solid var(--gold);
  outline-offset: 4px;
  box-shadow: 0 0 0 10px rgba(217, 154, 43, 0.22), 0 18px 36px rgba(23, 33, 34, 0.18);
  transform: translateY(-2px) scale(1.01);
}

button.is-dwell-target {
  position: relative;
  overflow: hidden;
}

button.is-dwell-target::after {
  content: "";
  position: absolute;
  left: 0;
  right: auto;
  bottom: 0;
  width: var(--dwell-progress, 0%);
  height: 7px;
  background: var(--gold);
  transition: width 60ms linear;
}

button.is-dwell-active {
  outline: 4px solid rgba(217, 154, 43, 0.8);
  outline-offset: 3px;
}

.suggestion-button:hover,
.letter-button:hover,
.phrase-tile:hover,
.reply-option:hover,
.method-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(23, 33, 34, 0.1);
}

.keyboard-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 16px;
  padding: 16px;
  background: rgba(232, 239, 232, 0.62);
}

.letter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.letter-button {
  min-height: 96px;
  font-size: 34px;
  font-weight: 700;
  font-family: "Trebuchet MS", Verdana, sans-serif;
}

.letter-button.is-back {
  color: var(--accent);
}

.compose-actions {
  grid-template-columns: 70px 1fr 1fr 1fr;
}

.action-button {
  background: #e8efe8;
  border: 1px solid rgba(15, 107, 104, 0.24);
  font-size: 21px;
  font-weight: 700;
}

.action-button.speak {
  background: var(--accent);
  color: #fffaf0;
}

.action-button.ghost {
  background: #fffdf7;
}

.quick-header {
  grid-template-columns: 1fr 156px;
  align-items: center;
  margin-bottom: 18px;
}

.tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tab-button {
  border: 1px solid var(--line);
  background: #fffdf7;
  font-size: 19px;
  font-weight: 700;
}

.tab-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fffaf0;
}

.phrase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.phrase-tile {
  min-height: 128px;
  padding: 18px;
  border: 1px solid var(--line);
  background: #fffdf7;
  text-align: left;
  font-size: clamp(23px, 2.4vw, 34px);
  line-height: 1.08;
}

.phrase-tile.is-selected {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 3px rgba(217, 154, 43, 0.35);
}

.emergency {
  position: relative;
  width: 100%;
  min-height: 82px;
  margin-top: 18px;
  overflow: hidden;
  border: 0;
  background: #481716;
  color: #fff8ef;
  font-size: clamp(20px, 2.4vw, 30px);
}

.emergency-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--danger);
  transition: width 90ms linear;
}

.emergency strong {
  position: relative;
}

.speaker-card {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1d4f4e;
  color: #f7c467;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-weight: 700;
}

.speaker-card strong,
.speaker-card span {
  display: block;
}

.speaker-card span {
  color: var(--muted);
}

.speaker-card p {
  justify-self: end;
  margin: 0;
  padding: 8px 10px;
  border-radius: 999px;
  background: #dceddf;
  color: var(--accent-strong);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.transcript {
  overflow: hidden;
}

.message {
  margin: 18px;
  max-width: 78%;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: #fffdf7;
  border: 1px solid var(--line);
}

.message p {
  margin-bottom: 8px;
  font-size: 25px;
  line-height: 1.18;
}

.message span {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 13px;
}

.from-user {
  margin-left: auto;
  background: #e9f3f1;
  border-color: rgba(15, 107, 104, 0.28);
}

.live-line {
  box-shadow: inset 4px 0 0 var(--gold);
}

.reply-panel {
  padding: 18px;
  background: rgba(232, 239, 232, 0.72);
}

.reply-list {
  margin-top: 12px;
}

.reply-option {
  min-height: 118px;
  padding: 20px;
  border: 1px solid rgba(15, 107, 104, 0.3);
  background: #fffdf7;
  text-align: left;
  font-size: clamp(24px, 2.7vw, 36px);
  line-height: 1.1;
}

.reply-option:first-child {
  background: var(--accent);
  color: #fffaf0;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.settings-panel {
  min-height: 180px;
  padding: 20px;
}

.method-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.method-button {
  min-height: 82px;
  border: 1px solid var(--line);
  background: #fffdf7;
  font-size: 24px;
  font-weight: 700;
}

.method-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fffaf0;
}

.setting-row {
  display: grid;
  gap: 26px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.voice-panel p:not(.eyebrow) {
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 20px;
}

.model-panel p:not(.eyebrow) {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.25;
}

.camera-panel h2 {
  margin-bottom: 12px;
}

.camera-preview {
  position: relative;
  min-height: 112px;
  overflow: hidden;
  border: 1px solid rgba(15, 107, 104, 0.24);
  border-radius: var(--radius);
  background: #172122;
}

.camera-preview video {
  width: 100%;
  height: 142px;
  display: block;
  object-fit: cover;
  transform: scaleX(-1);
  opacity: 0.76;
}

.camera-preview span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.92);
  color: var(--accent-strong);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.memory-panel p:not(.eyebrow) {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.25;
}

.model-panel code {
  display: inline-block;
  padding: 10px 12px;
  border: 1px solid rgba(15, 107, 104, 0.24);
  border-radius: var(--radius);
  background: #fffdf7;
  color: var(--accent-strong);
  font-family: "Courier New", monospace;
  font-size: 16px;
}

.phrase-editor,
.memory-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
  margin-top: 16px;
}

.memory-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.phrase-editor input {
  min-height: 54px;
  width: 100%;
  border: 1px solid rgba(15, 107, 104, 0.24);
  border-radius: var(--radius);
  background: #fffdf7;
  color: var(--ink);
  padding: 0 14px;
  font-size: 19px;
}

.danger-lite {
  color: var(--danger-dark);
}

.full-width-action {
  width: 100%;
  margin-top: 10px;
}

.audio-bars {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 50px;
}

.audio-bars span {
  width: 22px;
  border-radius: 4px 4px 0 0;
  background: var(--gold);
}

.audio-bars span:nth-child(1) { height: 18px; }
.audio-bars span:nth-child(2) { height: 36px; }
.audio-bars span:nth-child(3) { height: 25px; }
.audio-bars span:nth-child(4) { height: 48px; }
.audio-bars span:nth-child(5) { height: 30px; }
.audio-bars span:nth-child(6) { height: 42px; }

.speed-selector {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.speed-selector button {
  border: 1px solid var(--line);
  background: #fffdf7;
  font-size: 22px;
}

.speed-selector .is-active {
  border-color: var(--gold);
  background: #f6d68e;
}

.speech-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  max-width: min(760px, calc(100vw - 32px));
  min-height: 58px;
  padding: 16px 22px;
  border-radius: var(--radius);
  background: #172122;
  color: #fffaf0;
  box-shadow: 0 18px 46px rgba(23, 33, 34, 0.28);
  transform: translate(-50%, 120px);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
  font-size: 20px;
}

.speech-toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.camera-pointer {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 30;
  width: 42px;
  height: 42px;
  border: 4px solid var(--gold);
  border-radius: 50%;
  background: rgba(217, 154, 43, 0.22);
  box-shadow: 0 0 0 8px rgba(217, 154, 43, 0.16), 0 10px 28px rgba(23, 33, 34, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease;
}

.camera-pointer.is-active {
  opacity: 1;
}

.camera-pointer.is-locked {
  border-color: var(--accent);
  background: rgba(15, 107, 104, 0.22);
  box-shadow: 0 0 0 8px rgba(15, 107, 104, 0.16), 0 10px 28px rgba(23, 33, 34, 0.28);
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid #f2b84d;
  outline-offset: 3px;
}

@media (max-width: 920px) {
  .device-shell {
    padding: 0;
  }

  .tablet {
    min-height: 100vh;
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
  }

  .rail {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px;
  }

  .brand {
    min-width: 142px;
  }

  .nav-list {
    flex: 1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-button {
    justify-content: center;
    padding: 0 8px;
    font-size: 14px;
  }

  .nav-button span {
    display: none;
  }

  .rail-footer {
    display: none;
  }

  .topbar,
  .screen {
    padding-left: 16px;
    padding-right: 16px;
  }

  .compose-layout,
  .conversation-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .utterance-panel {
    min-height: 310px;
  }
}

@media (max-width: 620px) {
  .status-cluster {
    display: none;
  }

  .brand {
    display: none;
  }

  .quick-header,
  .phrase-grid,
  .suggestions,
  .tabs,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .letter-grid {
    grid-template-columns: 1fr;
  }
}
