:root {
  --bg: #eef3f8;
  --card: #ffffff;
  --text: #13233a;
  --muted: #66768b;
  --border: #d7e1ec;
  --blue: #eef4ff;
  --green: #eefaf5;
  --primary: #2f66f3;
  --primary-dark: #244fbe;
  --recording: #df3c4b;
  --dark: #0f1d3d;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
.app { max-width: 1080px; margin: 16px auto; padding: 0 14px 132px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 24px; padding: 16px 18px; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero, .panel-head, .actions, .btn-row, .settings-head, .history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero, .settings, .history { margin-bottom: 14px; }
.hero h1, .panel h2, .history h2, .settings h2 { margin: 0; }
.hero h1 { font-size: 34px; line-height: 1.15; }
.hero-actions { display:flex; gap:10px; align-items:center; }
.eyebrow, .small { color: var(--muted); font-size: 14px; }
label span { display:block; margin-bottom: 8px; font-weight: 600; }
select, textarea, button { font: inherit; }
select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 18px; padding: 14px 16px; background: #fff; color: var(--text); }
textarea { min-height: 210px; resize: none; font-size: 16px; line-height: 1.55; }
textarea::placeholder { color: transparent; }
button { border: 1px solid var(--border); border-radius: 999px; padding: 12px 18px; cursor: pointer; background:#fff; transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease; }
button:hover { transform: translateY(-1px); }
button.primary { background: var(--primary); color:#fff; border-color: transparent; }
button.primary:hover { background: var(--primary-dark); }
button.primary.recording,
button.action-chip.recording { background: var(--recording); color:#fff; border-color: transparent; }
button.dark { background: var(--dark); color:#fff; border-color: transparent; }
button.ghost { background:#fff; }
button.small-btn { padding: 10px 14px; }
.result { background:#fff; border: 1px solid var(--border); border-radius: 18px; padding: 14px 16px; margin-top: 14px; min-height: 84px; }
.result.big { font-size: 28px; font-weight: 700; }
.result.big.smallText { font-size: 20px; }
.history-list { border:1px dashed var(--border); border-radius:18px; padding:16px; min-height:72px; background: #fff; }
.history-item { padding: 10px 0; border-bottom: 1px solid var(--border); word-break: break-word; }
.history-item:last-child { border-bottom: none; }
.compact-status { display: grid; gap: 8px; padding: 14px 16px; border: 1px dashed var(--border); border-radius: 18px; background: #fff; }
.compact-status, .compact-status strong, .compact-status span { color: var(--text); font-size: 13px; line-height: 1.45; }
.compact-status strong { font-weight: 600; }
.settings.hidden,
.settings-backdrop.hidden { display:none; }
.settings-gap { margin-top: 12px; }
.primary.suggested{outline:3px solid rgba(255,255,255,.4);box-shadow:0 0 0 3px rgba(15,23,42,.08);}
.compact-hero { padding-top: 18px; padding-bottom: 18px; }
.history-actions { display:flex; gap: 8px; align-items:center; }
.hidden-el,
.hidden-data { display: none !important; }
.visual-hidden { display: none !important; }
.settings-row-inline { display:grid; gap:10px; }
.check { display:flex; align-items:center; gap:10px; padding: 12px 14px; border:1px dashed var(--border); border-radius:16px; background:#fff; }
.check input { width: auto; }
.embedded-status { margin-top: 14px; }
.compact-history .panel-head { margin-bottom: 10px; }
.top-ui-lang select {
  width: auto;
  min-width: 112px;
  height: 42px;
  padding: 8px 36px 8px 12px;
  border-radius: 999px;
  font-size: 14px;
}
.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 29, 61, .28);
  z-index: 9998;
}
.settings {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  z-index: 9999;
  box-shadow: 0 20px 60px rgba(15, 29, 61, .18);
}
.settings-main-grid { align-items: end; }
.settings-actions { margin-top: 12px; justify-content: flex-end; }
.history-head > div:first-child h2 { margin: 0; }
.settings-points-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
}
.settings-points-copy {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.translator-shell {
  padding: 18px;
  margin-bottom: 14px;
}
.paired-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.panel-side {
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 16px;
}
.side-blue { background: var(--blue); }
.side-green { background: var(--green); }
.lang-top {
  display: block;
  margin-bottom: 14px;
}
.lang-top select {
  height: 54px;
  border-radius: 22px;
  font-size: 20px;
  font-weight: 600;
  background: rgba(255,255,255,.94);
}
.input-shell {
  position: relative;
}
.input-shell textarea {
  min-height: 230px;
  padding: 18px 18px 72px;
  border-radius: 28px;
  background: rgba(255,255,255,.88);
}
.send-arrow {
  border: 1px solid #c9d8ea;
  background: rgba(255,255,255,.96);
  color: var(--dark);
  width: 58px;
  min-width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 999px;
  font-size: 30px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}
.send-arrow-inside {
  position: absolute;
  right: 14px;
  bottom: 12px;
}
.send-arrow:hover { background: rgba(255,255,255,1); color: var(--primary-dark); transform: none; }
.record-dock {
  position: fixed;
  left: 10px;
  top: 10px;
  width: min(520px, calc(100vw - 20px));
  margin: 0;
  background: #f7fbff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  z-index: 9000;
  box-shadow: 0 16px 36px rgba(15, 29, 61, .16);
  user-select: none;
}
.action-chip {
  width: 100%;
  min-width: 0;
  height: 62px;
  padding: 0 22px;
  font-weight: 800;
  font-size: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}
.action-chip:hover { background: var(--primary-dark); }
.record-chip.recording { background: var(--recording); }
.dock-grip {
  height: 72px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ecf2f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a9bb3;
  font-size: 40px;
  line-height: 1;
  user-select: none;
  cursor: grab;
  touch-action: none;
}
.record-dock.dragging .dock-grip { cursor: grabbing; }
.billing-modal { max-width: 560px; }
.billing-copy {
  margin: 8px 0 14px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.billing-pack-list {
  display: grid;
  gap: 10px;
}
.billing-pack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  background: #fff;
}
.billing-pack-meta {
  display: grid;
  gap: 4px;
}
.billing-pack-title {
  font-weight: 700;
  color: var(--text);
}
.billing-pack-sub {
  color: var(--muted);
  font-size: 13px;
}
.billing-pack a {
  text-decoration: none;
  min-width: 108px;
}
.billing-pack.missing-url {
  opacity: .75;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
@media (max-width: 900px) {
  .hero, .panel-head, .actions, .settings-head, .history-head { flex-wrap: wrap; }
  .hero-actions { justify-content: flex-end; width: auto; }
}
@media (max-width: 640px) {
  .app { padding: 0 10px 140px; margin: 10px auto; }
  .card { border-radius: 20px; padding: 14px; }
  .hero { align-items: center; }
  .hero h1 { font-size: 26px; max-width: 54%; }
  textarea { font-size: 16px; }
  .history-head { align-items: stretch; }
  .history-head > div:first-child { width: 100%; }
  .history-actions { width: 100%; display:grid; grid-template-columns: 1fr 1fr; }
  .history-actions button, .settings-actions button { width: 100%; }
  .hero-actions {
    display: grid;
    grid-template-columns: minmax(108px, 1fr) auto;
    width: 100%;
    align-items: center;
  }
  .hero-actions .ghost { width: auto; }
  .settings {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 20px;
    padding: 14px;
  }
  .settings-main-grid { grid-template-columns: 1fr; }
  .settings-points-box {
    display: grid;
    grid-template-columns: 1fr;
  }
  .paired-panels {
    gap: 12px;
  }
  .panel-side {
    padding: 12px;
    border-radius: 24px;
  }
  .lang-top { margin-bottom: 10px; }
  .lang-top select {
    height: 50px;
    border-radius: 20px;
    font-size: 17px;
  }
  .input-shell textarea {
    min-height: 196px;
    padding: 16px 14px 68px;
    border-radius: 24px;
  }
  .send-arrow {
    width: 52px;
    min-width: 52px;
    height: 52px;
    font-size: 28px;
  }
  .send-arrow-inside {
    right: 12px;
    bottom: 12px;
  }
  .record-dock {
    width: min(430px, calc(100vw - 20px));
    grid-template-columns: minmax(0, 1fr) 62px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }
  .action-chip {
    height: 58px;
    font-size: 24px;
  }
  .dock-grip {
    height: 66px;
    font-size: 34px;
  }
}
