/* Colours avoid pure white and pure black: they clip on camera and cause glare. */
:root {
  --bg: #f8f8f6;
  --page: #f8f8f6;
  --surface: #f0f1f3;
  --raised: #fbfbfa;
  --border: #dadde2;
  --text: #20242a;
  --muted: #646d78;
  --accent: #3554d1;
  --accent-soft: #e5eafb;
  --error: #a33a2c;
  --shadow: 0 1px 2px rgba(30, 36, 44, 0.06), 0 2px 8px rgba(30, 36, 44, 0.05);
  --radius: 14px;
  --fs: 28px;
}

:root[data-theme="dark"] {
  --bg: #1c1f23;
  --page: #1c1f23;
  --surface: #24282d;
  --raised: #2a2e34;
  --border: #3a4048;
  --text: #e6e8ea;
  --muted: #98a1ab;
  --accent: #8ea6f5;
  --accent-soft: #2c3550;
  --error: #e59a8c;
  --shadow: none;
}

:root[data-size="m"] { --fs: 22px; }
:root[data-size="l"] { --fs: 27px; }
:root[data-size="xl"] { --fs: 34px; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.hide-cursor, body.hide-cursor * { cursor: none !important; }

/* Hide scrollbars so they don't flicker into frame. */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 16px 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-right { gap: 4px; }

.brand { display: flex; align-items: center; gap: 10px; margin-left: 4px; user-select: none; -webkit-user-select: none; }
.logo { width: 34px; height: 34px; flex: none; }
.logo-bubble { fill: var(--bg); }
.brand-name { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.brand-sub { margin-left: 7px; color: var(--muted); font-weight: 400; letter-spacing: -0.01em; }

.avatar {
  width: 34px; height: 34px; margin-left: 6px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6b7fd8, #4aa3a8); color: #f4f6f8;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { background: var(--surface); }

.gear[hidden] { display: none; }

/* ---------- Page layout: translator + ad column ---------- */
.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 28px;
}
body.pz-side .page { grid-template-columns: minmax(0, 1fr) 300px; }

.container { min-width: 0; padding: 16px 0 16px; }

/* ---------- Mode tabs (Text / Images / Documents / Websites) ---------- */
.modes { display: flex; gap: 10px; margin-bottom: 14px; }
.mode {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--accent);
  font: inherit; font-size: 15px; font-weight: 500; cursor: default;
}
.mode svg { color: var(--accent); }
.mode.active { background: var(--accent-soft); border-color: transparent; }

/* ---------- Translator card ---------- */
.translator {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.lang-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
}
.lang-side { display: flex; align-items: stretch; min-width: 0; padding: 0 8px; overflow: hidden; }
.lang-chip {
  display: flex; align-items: center;
  padding: 0 14px; height: 50px;
  font-size: 15px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.lang-chip.active { color: var(--accent); border-bottom-color: var(--accent); }
.lang-more { display: flex; align-items: center; padding: 0 6px; color: var(--muted); }

.swap {
  align-self: center;
  border: none;
  background: transparent;
  color: var(--muted);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.swap:hover { background: var(--surface); }

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr);
  height: clamp(240px, 40vh, 500px);
}
body.pz-top .panels { height: clamp(220px, 33vh, 440px); }

.panel { position: relative; display: flex; flex-direction: column; min-height: 0; }
.panel.source { border-right: 1px solid var(--border); }
.panel.target { background: var(--surface); }

textarea, .output {
  flex: 1;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 60px 10px 24px;
  font: inherit;
  font-size: var(--fs);
  line-height: 1.42;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

textarea {
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  caret-color: var(--accent);
}

.output.placeholder, textarea::placeholder { color: var(--muted); }

/* Soft reveal so the translation doesn't pop in abruptly on camera. */
.output.reveal { animation: reveal 220ms ease-out; }
@keyframes reveal { from { opacity: 0.25; } to { opacity: 1; } }
.output.pending { opacity: 0.55; transition: opacity 150ms; }

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 0 14px 0 10px;
}
.footer-tools { display: flex; align-items: center; gap: 4px; min-width: 0; }
.footer-tools .count { margin-right: 12px; }

.count, .status { font-size: 13px; color: var(--muted); }
.status { margin-left: 6px; }
.status.error { color: var(--error); }

.kb-toggle.active { color: var(--accent); background: var(--accent-soft); }

.clear { position: absolute; top: 12px; right: 10px; }

.below-panels { display: flex; justify-content: flex-end; padding: 6px 4px 0; }
.feedback-link { font-size: 12px; font-style: italic; color: var(--muted); }

/* ---------- Translate button ---------- */
.translate-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  height: 40px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  transition: transform 80ms, filter 150ms;
}
.translate-btn:hover { filter: brightness(1.08); }
.translate-btn:active { transform: scale(0.96); }
.translate-btn[hidden] { display: none; }
.translate-btn.busy { filter: saturate(0.6) brightness(1.05); pointer-events: none; }
.translate-btn.busy::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 10px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Ads (fictional advertisers, styled like real display ads).
   Neutral "pz-" names (and image names without "ad") so browser ad blockers leave them alone. ---------- */
.pz-rail { display: none; padding-top: 16px; }
body.pz-side .pz-rail { display: flex; flex-direction: column; gap: 16px; }
.pz-card { width: 300px; }
.pz-label {
  height: 16px; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); text-align: center; opacity: 0.8;
}
.pz-box {
  position: relative; width: 300px; height: 250px; overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif; border: 1px solid rgba(0, 0, 0, 0.08);
}
/* The little info / close tab ad networks put in the corner of every creative. */
.pz-corner {
  position: absolute; top: 0; right: 0; z-index: 3; display: flex; gap: 1px;
  padding: 2px 2px 2px 4px; background: rgba(248, 248, 246, 0.92); color: #4a90c8;
  border-bottom-left-radius: 4px;
}
.pz-corner svg { width: 14px; height: 14px; display: block; }
.pz-corner svg + svg { color: #6b7380; }
.pz-cta {
  display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 16px;
  border-radius: 6px; font-size: 13px; font-weight: 700; white-space: nowrap; letter-spacing: 0.01em;
}
.pz-cta-yellow { background: #ffcf3f; color: #14213d; }
.pz-cta-orange { background: #ff6a2b; color: #fff8f3; border-radius: 999px; }
.pz-cta-outline { border: 1.5px solid #e6c27a; color: #f3dfb3; background: transparent; }
.pz-fine { margin: 6px 0 0; font-size: 8px; line-height: 1.3; color: rgba(235, 241, 250, 0.72); }

/* Flyvo: full-bleed photo with a dark gradient behind the copy */
.pz-flyvo { background: #0f2347; color: #f2f5fb; }
.flyvo-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.pz-flyvo::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(10, 26, 56, 0.55) 0%, rgba(10, 26, 56, 0) 28%, rgba(10, 26, 56, 0.2) 45%, rgba(10, 26, 56, 0.92) 78%);
}
.flyvo-logo {
  position: absolute; z-index: 2; top: 11px; left: 13px; display: flex; align-items: center; gap: 4px;
  font-size: 21px; font-weight: 800; letter-spacing: -0.05em; color: #fff;
}
.flyvo-logo svg { width: 20px; height: 20px; color: #ffcf3f; }
.flyvo-body { position: absolute; z-index: 2; left: 13px; right: 13px; bottom: 10px; }
.flyvo-sale {
  display: inline-block; padding: 2px 7px; margin-bottom: 5px; border-radius: 3px;
  background: #e8344e; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.flyvo-route { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.flyvo-route span { color: #ffcf3f; margin: 0 3px; }
.flyvo-row { display: flex; align-items: flex-end; justify-content: space-between; }
.flyvo-price { font-size: 38px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.flyvo-price small { font-size: 12px; font-weight: 600; letter-spacing: 0; margin-right: 4px; color: #c9d6ee; }
.flyvo-price sup { font-size: 16px; vertical-align: top; position: relative; top: 2px; }

/* Vorbo: app install ad with a phone mock-up */
.pz-vorbo { background: linear-gradient(150deg, #fff6ef 0%, #ffe7d8 100%); color: #26201c; }
.pz-vorbo::before {
  content: ''; position: absolute; right: -60px; bottom: -70px; width: 230px; height: 230px; border-radius: 50%;
  background: #ffcfb4;
}
.vorbo-copy { position: absolute; left: 15px; top: 15px; width: 150px; z-index: 2; }
.vorbo-logo { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 17px; letter-spacing: -0.03em; color: #26201c; }
.vorbo-mark {
  width: 22px; height: 22px; border-radius: 7px; background: #ff6a2b; color: #fff8f3;
  display: grid; place-items: center; font-size: 15px; line-height: 1;
}
.pz-vorbo h3 { margin: 12px 0 8px; font-size: 21px; line-height: 1.12; letter-spacing: -0.03em; font-weight: 800; }
.vorbo-rating { font-size: 11.5px; font-weight: 700; color: #3a302a; }
.vorbo-stars { color: #ffae00; letter-spacing: 0.5px; }
.vorbo-count { font-weight: 500; color: #7a6a5e; }
.pz-vorbo p { margin: 6px 0 12px; font-size: 11.5px; line-height: 1.35; color: #5a4a40; }

.vorbo-phone {
  position: absolute; z-index: 2; right: 14px; top: 26px; width: 112px; height: 236px;
  padding: 5px; border-radius: 20px; background: #1e1b1a;
  box-shadow: 0 10px 24px rgba(80, 40, 20, 0.28); transform: rotate(6deg);
}
.vp-screen {
  height: 100%; border-radius: 15px; background: #fffdfb; padding: 14px 7px 8px;
  display: flex; flex-direction: column; gap: 5px; font-size: 7px; color: #2a2420;
}
.vp-top { display: flex; align-items: center; gap: 4px; font-size: 7px; color: #9a8d84; }
.vp-bar { flex: 1; height: 5px; border-radius: 3px; background: #f0e6df; overflow: hidden; }
.vp-bar i { display: block; width: 62%; height: 100%; background: #ff6a2b; }
.vp-heart { color: #e8344e; font-weight: 700; }
.vp-ask { margin-top: 4px; font-size: 8.5px; font-weight: 800; }
.vp-bubble { padding: 6px; border-radius: 7px; background: #fff0e6; border: 1px solid #ffd7c0; font-weight: 600; font-size: 7.5px; }
.vp-opt { padding: 5px 6px; border-radius: 6px; border: 1px solid #e8e0da; border-bottom-width: 2px; font-size: 7px; }
.vp-ok { border-color: #3bb273; background: #e9f8ef; color: #1f7a4a; font-weight: 700; }
.vp-check {
  margin-top: auto; padding: 6px; border-radius: 7px; text-align: center;
  background: #3bb273; color: #f4fff8; font-size: 7.5px; font-weight: 800;
}

/* Casa Vesper: 728x90 leaderboard */
.pz-banner { display: none; width: 728px; max-width: 100%; margin: 0 auto 12px; }
body.pz-top .pz-banner { display: block; }
.pz-leader {
  position: relative; display: flex; align-items: center; gap: 18px; height: 90px; overflow: hidden;
  background: #1c2433; color: #f5efe3; border: 1px solid rgba(0, 0, 0, 0.08);
}
.pz-leader-photo {
  width: 250px; height: 100%; flex: none; object-fit: cover; object-position: 50% 55%;
  -webkit-mask-image: linear-gradient(90deg, #000 70%, transparent);
  mask-image: linear-gradient(90deg, #000 70%, transparent);
}
.pz-leader-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; margin-left: -30px; }
.pz-kicker { font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: #e6c27a; }
.pz-leader-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; font-family: Georgia, 'Times New Roman', serif; }
.pz-leader-copy span:last-child { font-size: 12px; color: #c9c2b4; }
.pz-leader .pz-cta { margin-right: 22px; }

/* Crew panel */
.crew {
  position: fixed;
  top: 16px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  padding: 18px;
  background: #2a2e34;
  color: #eceef0;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  font-size: 14px;
  z-index: 10;
}
.crew[hidden] { display: none; }

.crew-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.crew-close { background: none; border: none; color: inherit; font-size: 24px; cursor: pointer; line-height: 1; }

.crew-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.crew-row.check { justify-content: flex-start; }
.crew-row select { font: inherit; padding: 4px 6px; border-radius: 6px; }

.crew-actions { display: flex; gap: 8px; margin: 12px 0 8px; }
.crew-actions button {
  flex: 1;
  font: inherit;
  padding: 9px;
  border-radius: 8px;
  border: none;
  background: #4a6fd1;
  color: #fff;
  cursor: pointer;
}

.crew-help { margin: 8px 0 0; color: #aab2bb; font-size: 12px; line-height: 1.6; }
.crew kbd { background: #3d434b; border-radius: 4px; padding: 1px 5px; font-family: inherit; }

/* ---------- Romanian on-screen keyboard ---------- */
.keyboard {
  margin: 6px auto 0;
  max-width: 980px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.keyboard[hidden] { display: none; }
.kb-row { display: flex; gap: 8px; }
.kb-key {
  flex: 1 1 0;
  min-width: 0;
  height: clamp(36px, 4.8vh, 52px);
  border: 1px solid var(--border);
  border-bottom-width: 3px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 20px;
  cursor: pointer;
}
.kb-key.mod { font-size: 14px; color: var(--muted); }
.kb-key.wide { flex-grow: 1.5; }
.kb-key.wider { flex-grow: 1.9; }
.kb-key.widest { flex-grow: 2.4; }
.kb-key.space { flex-grow: 1; max-width: 60%; margin: 0 auto; }
.kb-key.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.kb-key:hover { filter: brightness(0.97); }
.kb-key.pressed { animation: keypress 160ms ease-out; }
@keyframes keypress {
  0% { transform: translateY(2px); background: var(--accent-soft); border-bottom-width: 1px; }
  100% { transform: none; }
}

/* ---------- Crew scene editor ---------- */
.crew { max-height: calc(100vh - 32px); overflow-y: auto; width: min(420px, calc(100vw - 32px)); }
.crew-scene { margin: 10px 0; padding: 10px 12px; background: #23272c; border-radius: 10px; }
.crew-scene summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
.crew-hint { font-weight: 400; color: #aab2bb; font-size: 12px; }
.crew-field { display: block; margin-top: 10px; }
.crew-field span { display: block; margin-bottom: 4px; color: #cfd5db; }
.crew-field textarea {
  width: 100%;
  min-height: 0;
  padding: 8px;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: #eceef0;
  background: #1b1e22;
  border: 1px solid #3d434b;
  border-radius: 6px;
  resize: vertical;
  overflow-y: auto;
}
.crew input[type="text"], .crew input[type="password"] {
  font: inherit;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #3d434b;
  background: #1b1e22;
  color: #eceef0;
  width: 130px;
}
.crew-pair { display: flex; gap: 6px; }
.crew-pair input[type="text"] { width: 100px; }
.crew-link { background: none; border: none; padding: 4px 0; color: #8fb0f2; font: inherit; font-size: 12px; cursor: pointer; }
.crew-actions button.secondary { background: #3d434b; }
.crew-help.error { color: #f0a493; }


@media (max-width: 1060px) {
  body.pz-side .page { grid-template-columns: minmax(0, 1fr); }
  body.pz-side .pz-rail { display: none; }
}
@media (max-width: 980px) {
  .lang-chip.extra { display: none; }
}
/* ---------- Phones ---------- */
.kb-reopen { display: none; }
@media (max-width: 720px) {
  .topbar { height: 56px; padding: 0 6px 0 2px; }
  .topbar-left { gap: 0; }
  .logo { width: 30px; height: 30px; }
  .brand { gap: 8px; }
  .brand-name { font-size: 19px; }
  .brand-sub { margin-left: 5px; }
  .apps-btn { display: none; }
  .avatar { width: 32px; height: 32px; margin-left: 2px; }

  /* Fill the screen so the keyboard sits at the very bottom, like a phone keyboard. */
  .page { padding: 0 12px; min-height: calc(100dvh - 56px); }
  .container { padding: 10px 0 0; display: flex; flex-direction: column; }
  .keyboard.phone { margin-top: auto !important; }

  /* Mode tabs scroll sideways, like a phone app. */
  .modes { gap: 8px; margin: 0 -12px 10px; padding: 0 12px; overflow-x: auto; }
  .mode { flex: none; height: 34px; font-size: 14px; padding: 0 12px 0 10px; }
  .mode svg { width: 18px; height: 18px; }

  /* Language bar: two language buttons with swap between them. */
  .translator { border-radius: 12px; }
  .lang-bar { padding: 6px; gap: 4px; }
  .lang-side { padding: 0; justify-content: center; }
  .lang-chip:not(.active), .lang-more { display: none; }
  .lang-chip.active {
    width: 100%; height: 40px; justify-content: center; border-radius: 999px;
    border-bottom: none; background: var(--accent-soft); font-size: 15px;
  }

  .panels { grid-template-columns: 1fr; height: auto; }
  .panel.source { border-right: none; border-bottom: 1px solid var(--border); }
  textarea, .output { padding: 14px 46px 6px 16px; font-size: calc(var(--fs) * 0.78); }
  textarea { min-height: 150px; height: 26vh; }
  .output { min-height: 110px; }
  .clear { top: 6px; right: 4px; }
  .panel-footer { min-height: 50px; padding: 0 8px 0 4px; }
  .footer-tools .count { margin-right: 8px; font-size: 12px; }
  .translate-btn { height: 38px; padding: 0 18px; }
  .below-panels { display: none; }
  .pz-banner { display: none !important; }

  /* Phone keyboard: edge to edge, stays at the bottom of the screen, big keys. */
  .keyboard.phone {
    position: sticky; bottom: 0; z-index: 5;
    max-width: none; margin: 10px -12px 0; gap: 9px;
    /* margin-top is auto (above) so it rests on the bottom edge */
    padding: 8px 3px calc(8px + env(safe-area-inset-bottom));
    border: none; border-top: 1px solid var(--border); border-radius: 0;
    background: #d3d6dc;
  }
  .keyboard.phone:not([hidden]) { animation: kb-up 200ms ease-out; }
  @keyframes kb-up { from { transform: translateY(100%); } to { transform: none; } }
  .kb-bar { display: flex; align-items: center; justify-content: space-between; height: 26px; margin: -4px 2px 0 8px; }
  .kb-bar span { font-size: 12px; font-weight: 600; color: #5b6270; letter-spacing: 0.02em; }
  .kb-hide {
    width: 44px; height: 30px; display: grid; place-items: center; border: none; border-radius: 6px;
    background: transparent; color: #3d434c; cursor: pointer;
  }
  .kb-reopen:not([hidden]) {
    position: sticky; bottom: 0; z-index: 5; margin: 10px -12px 0; margin-top: auto !important;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    height: calc(46px + env(safe-area-inset-bottom)); padding: 0 0 env(safe-area-inset-bottom);
    border: none; border-top: 1px solid var(--border); background: #d3d6dc; color: #3d434c;
    font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; animation: kb-up 200ms ease-out;
  }
  :root[data-theme="dark"] .kb-bar span, :root[data-theme="dark"] .kb-hide { color: #c9ced5; }
  :root[data-theme="dark"] .kb-reopen { background: #2a2d32; color: #c9ced5; }
  .keyboard.phone .kb-row { gap: 5px; }
  .keyboard.phone .kb-row.inset { padding: 0 5%; }
  .keyboard.phone .kb-row.dia { justify-content: center; }
  .keyboard.phone .kb-row.dia .kb-key { flex: 0 1 17%; height: 38px; }
  .keyboard.phone .kb-key {
    height: 44px; border: none; border-radius: 6px; font-size: 21px;
    background: #fbfbfa; color: #1d2025; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  }
  .keyboard.phone .kb-key.mod { background: #aab0ba; color: #1d2025; font-size: 15px; }
  .keyboard.phone .kb-key.wide { flex-grow: 1.45; font-size: 20px; }
  .keyboard.phone .kb-key.wider { flex-grow: 2.3; }
  .keyboard.phone .kb-key.space { flex-grow: 5; max-width: none; margin: 0; }
  .keyboard.phone .kb-key.on { background: #fbfbfa; color: #1d2025; border: none; }
  .keyboard.phone .kb-key.locked { text-decoration: underline; text-underline-offset: 4px; }
  .keyboard.phone .kb-key:hover { filter: none; }
  :root[data-theme="dark"] .keyboard.phone { background: #2a2d32; }
  :root[data-theme="dark"] .keyboard.phone .kb-key { background: #5a5f66; color: #f1f2f4; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); }
  :root[data-theme="dark"] .keyboard.phone .kb-key.mod { background: #3c4047; color: #f1f2f4; }
  :root[data-theme="dark"] .keyboard.phone .kb-key.on { background: #e6e8ea; color: #1d2025; }
}
@media (min-width: 721px) and (max-height: 960px) {
  .container { padding-top: 12px; padding-bottom: 10px; }
  .modes { margin-bottom: 10px; }
  .keyboard { margin-top: 8px; }
}

/* ---------- Short screens (a phone turned sideways, small laptop windows) ---------- */
@media (min-width: 721px) and (max-height: 560px) {
  .topbar { height: 48px; }
  .logo { width: 28px; height: 28px; }
  .brand-name { font-size: 18px; }
  .modes, .below-panels { display: none; }
  .container { padding-top: 8px; }
  .lang-chip { height: 42px; }
  .panels { height: 34vh; min-height: 120px; }
  textarea, .output { padding-top: 10px; font-size: calc(var(--fs) * 0.7); }
  .panel-footer { min-height: 44px; }
  .translate-btn { height: 34px; }
  .keyboard { margin-top: 6px; padding: 8px; gap: 5px; }
  .kb-row { gap: 5px; }
  .kb-key { height: 30px; font-size: 15px; border-bottom-width: 2px; }
  .kb-key.mod { font-size: 12px; }
}
