/* Global */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }
body {
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  background: #eef2f9; /* subtle business blue */
  color: #111;
}

/* Titlebar */
.titlebar {
  background: #0b2a4a; /* navy */
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
}
.titlebar .inner {
  max-width: 800px;
  padding: 16px 20px;
  margin: 0 auto;
}
.titlebar h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  font-weight: 800;
  letter-spacing: .2px;
}

/* Main shell */
.shell {
  max-width: 800px;
  padding: 20px;
  margin: 16px auto 40px auto;
}

/* 2-column grid (stacks < 800px) */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;                 /* prevent stretch-caused overflow */
}
.col { min-width: 0; }                /* allow children to shrink without overflow */

/* LEFT column layout: panel over button */
.left-stack {
  display: grid;
  grid-template-rows: auto auto;      /* panel then button */
  gap: 12px;
}

/* RIGHT column layout: tiles over prompt */
.right-stack {
  display: grid;
  grid-template-rows: auto minmax(0,1fr); /* prompt can grow without overflow */
  gap: 16px;
  min-height: 0;
}

@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
  .right-stack { grid-template-rows: auto auto; }
}

/* Status panel */
#panel {
  width: 100%;
  aspect-ratio: 2 / 1;                /* half height of width */
  border: 2px solid #0b2a4a;
  border-radius: 14px;
  padding: 14px 16px;
  overflow: auto;
  background: #ffffff;
  color: #0b2a4a;
  white-space: pre-wrap;
  line-height: 1.35;
  box-shadow: 0 8px 30px rgba(0,0,0,.08);
  font-weight: 600;
}
#panel .dim { opacity: .75; font-weight: 500; }

/* Blue bar press-to-talk button (now directly under the panel) */
#ptt {
  width: 100%;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 12px;
  background: #1e5dd8;
  border: 0;
  box-shadow: 0 6px 16px rgba(0,0,0,.15), inset 0 -3px 0 rgba(0,0,0,.10);
  color: #fff;
  font-weight: 800;
  letter-spacing: .3px;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;

  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#ptt[aria-pressed="true"] {
  background: #164db8;
  box-shadow: 0 4px 12px rgba(0,0,0,.15), inset 0 -2px 0 rgba(0,0,0,.12);
}

/* Voice selector tiles — compact */
.voice-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) {
  .voice-tiles { grid-template-columns: 1fr; }
}
.voice-card {
  background: #fff;
  border: 2px solid #cdd7ea;
  border-radius: 12px;
  padding: 10px 12px;                 /* tighter padding */
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, border-color .12s ease;
  outline: none;
}
.voice-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.voice-card:active { transform: translateY(0); }
.voice-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(30,93,216,.35), 0 6px 18px rgba(0,0,0,.08);
  border-color: #1e5dd8;
}
.voice-card[aria-pressed="true"] {
  border-color: #1e5dd8;
  box-shadow: 0 0 0 3px rgba(30,93,216,.15), 0 4px 14px rgba(0,0,0,.06);
}
.voice-name {
  font-weight: 800;
  color: #0b2a4a;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;                 /* slightly smaller */
}
.pill {
  font-size: 11px;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1e5dd8;
  border: 1px solid #d7e3ff;
}
.voice-desc {
  margin: 0;
  color: #3a4a66;
  font-size: 0.85rem;                 /* compact description */
  line-height: 1.35;
}

/* System prompt box */
.prompt-box {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-height: 0;
}
.prompt-label {
  font-weight: 700;
  color: #0b2a4a;
}
.prompt-textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border: 2px solid #cdd7ea;
  border-radius: 12px;
  padding: 10px 12px;                 /* a bit tighter */
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  background: #fff;
  color: #102033;
  box-shadow: inset 0 1px 0 rgba(16,32,51,.03);
}
.prompt-textarea:focus {
  outline: none;
  border-color: #1e5dd8;
  box-shadow: 0 0 0 3px rgba(30,93,216,.15);
}

/* Mobile polish */
@media (max-width: 480px) {
  .shell { padding: 16px; margin-top: 12px; }
}

/* Prompt label row with reset button */
.prompt-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.prompt-reset {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 4px 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e5dd8;
  border-radius: 8px;
  cursor: pointer;
}
.prompt-reset:hover { text-decoration: underline; }
.prompt-reset:focus-visible {
  outline: 2px solid rgba(30,93,216,.35);
  outline-offset: 2px;
  border-radius: 6px;
}

