:root {
  --blue: #2a6fe8;
  --blue-dark: #1d5ccc;
  --blue-soft: #dfe9fc;
  --hl: #dbe6fb;
  --ink: #1f2430;
  --ink-2: #4a5160;
  --muted: #7b8291;
  --line: #e6e8ee;
  --bg: #f4f5f7;
  --card: #ffffff;
  --side-dark: #3a3f4b;
  --yellow: #f7c948;
  --red: #d93b3b;
  --green: #1f9d62;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 4px 14px rgba(20, 30, 50, .06);
  --player-h: 0px;
  font-family: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); min-height: 100vh; padding-bottom: calc(var(--player-h) + 24px); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------- top bar */
.topbar {
  background: var(--blue);
  color: #fff;
  height: 80px;
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: Nunito, sans-serif; font-weight: 900; font-size: 27px; letter-spacing: -.2px; }
.brand svg { width: 38px; height: 38px; }
.brand .ver { font-size: 12px; font-weight: 800; background: rgba(255,255,255,.2); border-radius: 4px; padding: 2px 6px; align-self: flex-start; margin-top: 4px; }
.topnav { display: flex; gap: 38px; font-weight: 800; font-size: 17px; letter-spacing: .3px; }
.topnav a { opacity: .95; }
.topnav a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 6px; }
.engines { margin-left: auto; display: flex; gap: 8px; font-size: 13px; }
.engines .chip { background: rgba(255,255,255,.16); border-radius: 30px; padding: 5px 12px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.engines .dot { width: 8px; height: 8px; border-radius: 50%; background: #7cf0b0; }
.engines .dot.off { background: #ffb4b4; }

/* ---------------------------------------------------------- layout */
.layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 32px;
  padding: 40px 28px 0;
  max-width: 1640px;
  margin: 0 auto;
  align-items: start;
}
.layout.with-panel { grid-template-columns: 290px minmax(0, 1fr) 290px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------------------------------------------------------- sidebar */
.sidebar { overflow: hidden; position: sticky; top: 120px; }
.sidebar-top { background: var(--side-dark); padding: 26px 20px 20px; color: #fff; }
.usage-label { font-size: 16px; margin-bottom: 12px; }
.usage-bar { height: 9px; background: rgba(255,255,255,.18); border-radius: 9px; overflow: hidden; margin-bottom: 18px; }
.usage-bar span { display: block; height: 100%; width: 0; background: var(--yellow); border-radius: 9px; transition: width .4s; }
.btn-white {
  width: 100%; background: #fff; color: var(--blue); border: 0; border-radius: 4px;
  height: 58px; font-weight: 800; font-size: 16px; letter-spacing: .4px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.btn-white:hover { background: #f3f7ff; }
.sidebar-body { padding: 14px 10px 18px; }
.sidebar-body h4 { margin: 16px 20px 10px; font-size: 17px; font-weight: 800; }
.side-link {
  display: flex; align-items: center; gap: 14px; padding: 11px 20px;
  border-radius: 4px; font-size: 17px; color: var(--ink-2); width: 100%;
  background: none; border: 0; text-align: left;
}
.side-link:hover { background: #f1f3f6; }
.side-link.active { background: #e4e6ea; color: var(--ink); font-weight: 600; }
.side-link .count { margin-left: auto; font-size: 13px; color: var(--muted); }
.side-link .del { margin-left: auto; opacity: 0; border: 0; background: none; color: var(--muted); font-size: 18px; padding: 0 4px; }
.side-link:hover .del { opacity: 1; }
.side-link .del + .count { margin-left: 6px; }

/* ---------------------------------------------------------- main card */
main { min-width: 0; }
.panel { padding: 36px 32px; }
.panel h1 { font-family: "Nunito Sans", sans-serif; font-weight: 800; font-size: 34px; margin: 0 0 6px; line-height: 1.2; letter-spacing: -.3px; }
.panel .sub { color: var(--ink-2); font-size: 18px; margin-bottom: 26px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 14px; }
.page-head h1 svg { width: 32px; height: 32px; }
.page-head .btn-primary { margin-left: auto; }

.btn-primary {
  background: var(--blue); color: #fff; border: 0; border-radius: 4px;
  padding: 0 26px; height: 52px; font-weight: 800; font-size: 16px; letter-spacing: .5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-primary.wide { width: 100%; border-radius: 0; height: 56px; }
.btn-grey { background: #e2e3e6; border: 0; border-radius: 4px; padding: 16px 22px; font-weight: 800; font-size: 16px; letter-spacing: .3px; color: #333; }
.btn-grey:hover { background: #d6d8dc; }
.btn-mini { background: var(--blue); color: #fff; border: 0; border-radius: 4px; padding: 5px 12px; font-weight: 700; font-size: 13px; }

/* empty state */
.empty { text-align: center; padding: 50px 20px 30px; color: var(--ink-2); }
.empty .big { font-size: 26px; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.empty .btn-primary { margin: 26px 0 16px; height: 66px; padding: 0 44px; font-size: 18px; }

/* file table */
.files { width: 100%; border-collapse: collapse; font-size: 16px; }
.files th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.files td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.files tr.row { cursor: pointer; }
.files tr.row:hover td { background: #f7f9fd; }
.files .name { font-weight: 700; display: flex; align-items: center; gap: 12px; min-width: 0; }
.files .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.files .ftype { width: 34px; height: 34px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: none; }
.files .ftype svg { width: 18px; height: 18px; }
.files .muted { color: var(--muted); white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 30px; background: #eef0f4; color: var(--ink-2); white-space: nowrap; }
.badge.done { background: #e3f6ec; color: var(--green); }
.badge.error { background: #fde8e8; color: var(--red); }
.badge.work { background: var(--blue-soft); color: var(--blue); }
.mini-bar { height: 5px; width: 110px; background: #e8ebf0; border-radius: 5px; overflow: hidden; margin-top: 6px; }
.mini-bar span { display: block; height: 100%; background: var(--blue); transition: width .5s; }
.lang-tag { font-size: 12px; font-weight: 800; letter-spacing: .5px; background: #eef0f4; color: var(--ink-2); padding: 2px 7px; border-radius: 4px; text-transform: uppercase; }

/* ---------------------------------------------------------- transcript */
.title-input { font: inherit; border: 0; outline: 0; width: 100%; padding: 0; background: transparent; }
.lang-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 22px; }
.lang-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 30px; padding: 5px 14px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.lang-tabs button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.transcript { font-size: 19px; line-height: 1.62; color: #2b303b; }
.transcript p { margin: 0 0 20px; }
.seg { border-radius: 3px; padding: 1px 0; transition: background .15s; cursor: text; }
.seg.active { background: var(--hl); box-shadow: 0 0 0 3px var(--hl); }
.ts { color: var(--muted); font-size: 15px; cursor: pointer; margin-right: 4px; font-variant-numeric: tabular-nums; }
.ts:hover { color: var(--blue); text-decoration: underline; }
.transcript.no-ts .ts { display: none; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }

/* processing */
.processing { text-align: center; padding: 30px 10px 10px; }
.spinner { width: 54px; height: 54px; border: 5px solid var(--blue-soft); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 0 auto 22px; }
@keyframes spin { to { transform: rotate(360deg); } }
.big-bar { height: 12px; background: #e8ebf0; border-radius: 12px; overflow: hidden; max-width: 520px; margin: 18px auto 10px; }
.big-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), #5a95f5); transition: width .6s; }
.steps { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.steps span { font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 30px; background: #eef0f4; color: var(--muted); }
.steps span.on { background: var(--blue); color: #fff; }
.steps span.ok { background: #e3f6ec; color: var(--green); }
.error-box { background: #fdecec; color: #9e2222; border-radius: 6px; padding: 16px 18px; text-align: left; max-width: 640px; margin: 18px auto; white-space: pre-wrap; word-break: break-word; }

/* promo-like blue banner below transcript (TurboScribe style) */
.banner { margin-top: 30px; background: linear-gradient(135deg, #2a6fe8, #3d86f2); color: #fff; border-radius: var(--radius); padding: 30px; text-align: center; box-shadow: var(--shadow); }
.banner h2 { margin: 0 0 6px; font-family: Nunito, sans-serif; font-weight: 900; font-size: 30px; }
.banner p { margin: 0; opacity: .92; font-size: 17px; }
.banner .btn-white { width: auto; display: inline-flex; padding: 0 30px; margin-top: 18px; height: 50px; }

/* ---------------------------------------------------------- right panel */
.rightpanel { padding: 22px 14px; position: sticky; top: 120px; max-height: calc(100vh - 140px - var(--player-h)); overflow: auto; }
.rightpanel h4 { margin: 8px 16px 10px; font-size: 17px; font-weight: 800; }
.rightpanel h4:not(:first-child) { margin-top: 22px; }
.action {
  display: flex; align-items: flex-start; gap: 14px; width: 100%; padding: 10px 16px;
  background: none; border: 0; text-align: left; font-size: 17px; color: var(--ink-2); border-radius: 4px; line-height: 1.3;
}
button.action:hover, label.action:hover { background: #f1f3f6; }
.action small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.action.danger { color: var(--red); }
.ficon {
  width: 26px; height: 30px; border: 1.8px solid var(--ink-2); border-radius: 3px 8px 3px 3px; flex: none;
  font-size: 8px; font-weight: 800; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2px; letter-spacing: -.2px;
}
.ficon.cc { height: 24px; width: 30px; border-radius: 4px; align-items: center; padding: 0; font-size: 12px; margin-top: 3px; }
.check { cursor: pointer; align-items: center; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox { width: 26px; height: 26px; border-radius: 4px; border: 2px solid var(--ink); flex: none; display: grid; place-items: center; }
.check input:checked + .checkbox { background: var(--ink); }
.check input:checked + .checkbox::after { content: ""; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg); }
.check input:focus-visible + .checkbox { outline: 2px solid var(--blue); outline-offset: 2px; }
.gicon svg { width: 26px; height: 26px; }
.translate-row { display: flex; gap: 6px; margin-top: 8px; }
.translate-row select, .move select { border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; font-size: 14px; background: #fff; min-width: 0; flex: 1; }
.move select { margin-top: 6px; width: 100%; }

/* ---------------------------------------------------------- player */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; height: 64px; background: #fff;
  border-top: 1px solid var(--line); display: flex; align-items: center; gap: 14px;
  padding: 0 max(28px, calc((100vw - 1100px) / 2)); z-index: 30; box-shadow: 0 -4px 14px rgba(20,30,50,.06);
}
.player .play { border: 0; background: none; padding: 4px; color: var(--ink); }
.player .play svg { width: 28px; height: 28px; }
.player .time { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 44px; }
.player input[type=range] { accent-color: var(--blue); }
#seek { flex: 1; }
.vol { width: 110px; }
.vol-icon { color: var(--ink); }
#speed { border: 1px solid var(--line); border-radius: 4px; padding: 4px; background: #fff; font-size: 14px; }

/* ---------------------------------------------------------- modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(40, 44, 52, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; width: min(640px, 100%); max-height: calc(100vh - 32px); border-radius: 4px; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: center; position: relative; padding: 26px 30px 6px; }
.modal-head h2 { margin: 0; display: flex; align-items: center; gap: 12px; font-size: 28px; font-weight: 800; }
.modal-head h2 svg { width: 32px; height: 32px; }
.modal-head .icon-btn { position: absolute; right: 26px; top: 20px; font-size: 38px; line-height: 1; }
.modal-body { padding: 10px 30px 22px; overflow: auto; }
.icon-btn { border: 0; background: none; color: var(--ink-2); padding: 4px; border-radius: 4px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: #f1f3f6; color: var(--ink); }
.icon-btn.small svg { width: 20px; height: 20px; }
.icon-btn.on { color: var(--blue); background: var(--blue-soft); }
.field-label { display: flex; align-items: center; justify-content: space-between; font-size: 18px; color: var(--ink-2); margin: 18px 0 8px; }
.dropzone { background: #ededee; border-radius: 4px; padding: 30px 20px 26px; text-align: center; transition: background .15s, outline-color .15s; outline: 2px dashed transparent; outline-offset: -8px; }
.dropzone.drag { background: var(--blue-soft); outline-color: var(--blue); }
.dz-title { font-size: 24px; margin-bottom: 8px; color: var(--ink); }
.dz-formats { font-size: 15px; color: var(--ink-2); max-width: 420px; margin: 0 auto; line-height: 1.5; }
.dz-or { color: var(--ink-2); margin: 18px 0 14px; font-size: 16px; }
.picked { list-style: none; padding: 0; margin: 16px 0 0; text-align: left; }
.picked li { background: #fff; border-radius: 4px; padding: 8px 12px; margin-top: 6px; display: flex; gap: 10px; align-items: center; font-size: 15px; }
.picked li span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.picked li small { color: var(--muted); }
.picked li button { border: 0; background: none; font-size: 18px; color: var(--muted); }
.urlzone input { width: 100%; height: 54px; border: 1px solid var(--line); border-radius: 4px; padding: 0 16px; font-size: 17px; outline: none; background: #fafbfc; }
.urlzone input:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px var(--blue-soft); }
.url-hint { margin-top: 10px; font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pill { font-weight: 800; font-size: 12px; padding: 3px 9px; border-radius: 30px; color: #fff; }
.pill.yt { background: #e62117; } .pill.dm { background: #0d0d0d; } .pill.vm { background: #1ab7ea; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.modal select#sourceLang, .modal select#targetLang { width: 100%; height: 56px; border: 1px solid var(--line); border-radius: 4px; padding: 0 14px; font-size: 17px; font-weight: 600; background: #fff; }
.engine-note { margin-top: 10px; font-size: 14px; color: var(--ink-2); background: #f6f8fc; border-left: 3px solid var(--blue); padding: 8px 12px; border-radius: 0 4px 4px 0; }
.engine-note.warn { border-color: #e2a400; background: #fff8e5; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); background: #ededee; border-radius: 4px; overflow: hidden; }
.mode { border: 0; background: transparent; padding: 14px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 18px; color: var(--ink); }
.mode .emoji { font-size: 30px; line-height: 1.1; }
.mode b { font-weight: 600; }
.mode small { font-size: 14px; color: var(--ink-2); }
.mode.active { background: linear-gradient(135deg, #2a6fe8, #3a82f0); color: #fff; }
.mode.active small { color: #e8f0ff; }
.mode:not(.active):hover { background: #e2e3e6; }
.upload-progress { margin-top: 18px; }
.upload-progress .bar { height: 8px; background: #e8ebf0; border-radius: 8px; overflow: hidden; }
.upload-progress .bar span { display: block; height: 100%; width: 0; background: var(--blue); }
.upload-progress small { color: var(--muted); }
.form-error { margin-top: 14px; color: #9e2222; background: #fdecec; padding: 10px 14px; border-radius: 4px; font-size: 15px; }

/* faq */
.faq details { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq summary { font-weight: 700; font-size: 18px; cursor: pointer; }
.faq p { color: var(--ink-2); line-height: 1.6; margin: 10px 0 0; }
.faq code { background: #f1f3f6; padding: 1px 6px; border-radius: 4px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--player-h) + 24px); transform: translateX(-50%); background: #222831; color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 15px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100vw - 32px); }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1250px) {
  .layout.with-panel { grid-template-columns: 250px minmax(0, 1fr); }
  .layout.with-panel .rightpanel { grid-column: 2; position: static; max-height: none; order: 3; }
}
@media (max-width: 860px) {
  .topbar { gap: 16px; padding: 0 16px; height: 64px; }
  .brand { font-size: 21px; } .brand svg { width: 30px; height: 30px; }
  .topnav { display: none; }
  .engines .chip span.txt { display: none; }
  .layout, .layout.with-panel { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 0; gap: 16px; }
  .layout.with-panel .rightpanel { grid-column: 1; }
  .sidebar { position: static; }
  .sidebar-body { display: none; }
  .panel { padding: 24px 18px; }
  .panel h1 { font-size: 26px; }
  .transcript { font-size: 17px; }
  .files .hide-sm { display: none; }
  .two-col { grid-template-columns: 1fr; gap: 0; }
  .modal-body { padding: 6px 16px 18px; }
  .modal-head { padding: 20px 16px 4px; } .modal-head h2 { font-size: 22px; }
  .player { padding: 0 12px; gap: 8px; } .vol, .vol-icon { display: none; }
}

/* ---------------------------------------------------------- click a sentence to play from there */
.seg { cursor: pointer; }
.seg:hover { background: #f1f5fd; }

/* ---------------------------------------------------------- summary */
.summary-cta { margin: -4px 0 22px; }
.btn-outline {
  border: 1.5px solid var(--blue); color: var(--blue); background: #fff; border-radius: 30px;
  padding: 8px 18px; font-weight: 800; font-size: 15px;
}
.btn-outline:hover { background: var(--blue-soft); }
.summary {
  background: linear-gradient(180deg, #f5f8ff, #eef3fe); border: 1px solid #d6e2fb; border-radius: 8px;
  padding: 18px 22px 16px; margin: 0 0 26px;
}
.summary-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.summary-head h3 { margin: 0; font-size: 19px; font-weight: 800; }
.summary-head .muted { color: var(--muted); font-size: 13px; }
.summary-actions { margin-left: auto; display: flex; gap: 4px; }
.summary-actions svg { width: 19px; height: 19px; }
.summary-text { font-size: 17px; line-height: 1.6; color: #2b303b; margin-top: 8px; }
.summary-text p { margin: 8px 0; }
.summary-text ul { margin: 6px 0 4px; padding-left: 22px; }
.summary-text li { margin: 3px 0; }
.summary-player { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.btn-listen {
  background: var(--blue); color: #fff; border: 0; border-radius: 30px; padding: 9px 20px;
  font-weight: 800; font-size: 15px; min-width: 210px;
}
.btn-listen:hover { background: var(--blue-dark); }
.btn-listen:disabled { opacity: .7; cursor: progress; }
.sum-bar { flex: 1; min-width: 120px; height: 6px; background: #d6e2fb; border-radius: 6px; overflow: hidden; }
.sum-bar span { display: block; height: 100%; width: 0; background: var(--blue); transition: width .25s linear; }
.summary-player .time { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.summary-wait { display: flex; align-items: center; gap: 14px; color: var(--ink-2); margin-top: 10px; }
.spinner.small { width: 26px; height: 26px; border-width: 3px; margin: 0; flex: none; }

/* translation progress in the right panel */
.translate-status { margin-top: 8px; }
.translate-status .mini-bar { width: 100%; margin: 0 0 4px; }
.translate-status small { color: var(--ink-2); font-size: 13px; margin: 0; }
.translate-status small.err { color: var(--red); }
.translate-row select option:disabled { color: #aaa; }

/* GPU power-cap warning */
.power-banner {
  background: #fdecec; color: #8a1c1c; border-bottom: 2px solid var(--red);
  padding: 12px 28px; font-size: 15px; line-height: 1.5; position: sticky; top: 80px; z-index: 19;
}
.power-banner code { background: #fff; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
@media (max-width: 860px) { .power-banner { top: 64px; padding: 10px 16px; } }

/* ---------------------------------------------------------- select & delete jobs */
.files th.sel, .files td.sel { width: 44px; padding-right: 0; }
.files td.sel { cursor: default; }
.files input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; vertical-align: middle; }
.files input[type=checkbox]:disabled { cursor: not-allowed; opacity: .4; }
.files tr.row.selected td { background: #eef3fe; }
.select-bar { margin-left: auto; display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--ink-2); }
.select-bar + .btn-primary { margin-left: 0; }
.btn-link { border: 0; background: none; color: var(--blue); font-weight: 700; padding: 4px 6px; }
.btn-link:hover { text-decoration: underline; }
.btn-danger {
  background: var(--red); color: #fff; border: 0; border-radius: 4px; height: 44px; padding: 0 18px;
  font-weight: 800; font-size: 15px; letter-spacing: .4px; display: inline-flex; align-items: center; gap: 8px;
}
.btn-danger svg { width: 18px; height: 18px; }
.btn-danger:hover { background: #b92f2f; }
.btn-danger:disabled { opacity: .6; cursor: progress; }
@media (max-width: 860px) {
  .page-head { flex-wrap: wrap; }
  .select-bar { order: 3; width: 100%; margin-left: 0; }
}

/* ---------------------------------------------------------- play the original or a translation */
.voice-toggle { display: flex; border: 1px solid var(--line); border-radius: 30px; overflow: hidden; flex: none; }
.voice-toggle button {
  border: 0; background: #fff; padding: 7px 12px; font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap;
}
.voice-toggle button + button { border-left: 1px solid var(--line); }
.voice-toggle button:hover { background: #f1f5fd; }
.voice-toggle button.on { background: var(--blue); color: #fff; }
.btn-original {
  margin-top: 8px; width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 4px;
  padding: 5px 10px; font-size: 13px; font-weight: 700; color: var(--blue);
}
.btn-original:hover:not(:disabled) { background: var(--blue-soft); }
.btn-original:disabled { color: var(--muted); cursor: default; }
@media (max-width: 860px) {
  .player { flex-wrap: wrap; height: auto; padding: 8px 12px; row-gap: 6px; }
  .voice-toggle { order: -1; width: 100%; justify-content: center; border-radius: 8px; }
  .voice-toggle button { flex: 1; }
}

/* ---------------------------------------------------------- account & sign-in */
.account { display: flex; align-items: center; gap: 10px; margin-left: 6px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.engines + .account { margin-left: 14px; }
.account .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--yellow); color: #1f2430;
  display: grid; place-items: center; font-weight: 900;
}
.signout { border: 1px solid rgba(255,255,255,.5); background: transparent; color: #fff; border-radius: 4px; padding: 5px 10px; font-weight: 700; font-size: 13px; }
.signout:hover { background: rgba(255,255,255,.15); }
.login-screen { position: fixed; inset: 0; z-index: 100; background: linear-gradient(160deg, #2a6fe8, #1d4fb0); display: grid; place-items: center; padding: 16px; }
.login-card { background: #fff; width: min(400px, 100%); border-radius: 8px; padding: 30px 30px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-brand { display: flex; align-items: center; gap: 10px; color: var(--blue); font-family: Nunito, sans-serif; font-weight: 900; font-size: 22px; margin-bottom: 18px; }
.login-brand svg { width: 32px; height: 32px; }
.login-card h1 { margin: 0 0 16px; font-size: 26px; }
.login-card label { display: block; font-size: 15px; color: var(--ink-2); margin: 12px 0 6px; }
.login-card input { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 4px; padding: 0 12px; font-size: 16px; background: #fafbfc; }
.login-card input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px var(--blue-soft); }
.login-card .btn-primary.wide { margin-top: 20px; border-radius: 4px; }
.login-note { color: var(--muted); font-size: 13px; margin: 12px 0 0; line-height: 1.5; }
.login-note:empty { display: none; }
@media (max-width: 860px) { .account-name { display: none; } }

/* ---------------------------------------------------------- About */
.about h2 { font-size: 22px; font-weight: 800; margin: 34px 0 14px; padding-top: 22px; border-top: 1px solid var(--line); }
.about-hero { display: flex; align-items: center; gap: 22px; }
.about-avatar {
  width: 86px; height: 86px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), #5a95f5); color: #fff; font-family: Nunito, sans-serif; font-weight: 900; font-size: 32px;
}
.about-hero h1 { margin: 0; }
.about-title { font-size: 18px; color: var(--ink-2); margin-top: 4px; }
.about-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.about-tags span { background: var(--blue-soft); color: var(--blue); font-weight: 800; font-size: 13px; padding: 3px 10px; border-radius: 30px; }
.about-built { color: var(--muted); font-size: 14px; margin: 16px 0 0; }
.about-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 20px 0 6px; }
.about-facts div { background: #f6f8fc; border-radius: 6px; padding: 10px 14px; }
.about-facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.about-facts dd { margin: 4px 0 0; font-weight: 600; line-height: 1.4; }
.about-intro { font-size: 17px; line-height: 1.65; color: #2b303b; margin: 14px 0 0; }
.about-impact { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.about-impact div { border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.about-impact b { font-family: Nunito, sans-serif; font-size: 28px; font-weight: 900; color: var(--blue); line-height: 1.1; }
.about-impact span { font-weight: 600; line-height: 1.35; }
.about-impact small { color: var(--muted); font-size: 13px; }
.about-timeline { list-style: none; padding: 0; margin: 0; }
.about-timeline > li { display: grid; grid-template-columns: 130px 1fr; gap: 18px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.about-timeline > li:last-child { border-bottom: 0; }
.about-timeline .when, .about-edu .when { color: var(--blue); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.about-timeline .role { font-weight: 800; font-size: 17px; }
.about-timeline .org { color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.about-timeline ul { margin: 8px 0 0; padding-left: 18px; color: #2b303b; line-height: 1.55; }
.about-skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.about-skills h3 { margin: 0 0 8px; font-size: 15px; }
.about-skills .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.about-skills .chips span { background: #eef0f4; border-radius: 30px; padding: 4px 11px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.about-edu { list-style: none; padding: 0; margin: 0; }
.about-edu li { display: grid; grid-template-columns: 130px 1fr; gap: 18px; padding: 8px 0; }
.about-edu b { display: block; }
.about-edu small { color: var(--muted); }
.about-contact { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.about-contact .btn-outline { text-decoration: none; display: inline-flex; align-items: center; height: 44px; }
@media (max-width: 860px) {
  .about-hero { flex-direction: column; align-items: flex-start; }
  .about-timeline > li, .about-edu li { grid-template-columns: 1fr; gap: 4px; }
}
.topnav a { white-space: nowrap; }
.about-impact b { white-space: nowrap; font-size: 26px; }
.about-facts div:last-child:nth-child(4) { grid-column: 1 / -1; }  /* the long "Open to" line gets the full width */
/* header with the extra ABOUT item: tighter spacing; engine labels shrink to their dots (tooltip keeps the text) */
.topbar { gap: 28px; }
.topnav { gap: 26px; }
.engines { min-width: 0; }
@media (max-width: 1400px) {
  .engines .chip .txt { display: none; }
  .engines .chip { padding: 6px; }
}
.site-footer { text-align: center; color: var(--muted); font-size: 14px; padding: 28px 16px 8px; }
.site-footer a { color: var(--blue); font-weight: 700; }
.site-footer a:hover { text-decoration: underline; }

/* ---------------------------------------------------------- FR | EN switch */
.lang-switch { display: inline-flex; border: 1.5px solid rgba(255,255,255,.6); border-radius: 30px; overflow: hidden; flex: none; margin-left: 14px; }
.engines ~ .lang-switch { margin-left: 14px; }
.topbar .engines { margin-left: auto; }
.lang-switch button {
  border: 0; background: transparent; color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .5px;
  padding: 5px 11px; cursor: pointer;
}
.lang-switch button + button { border-left: 1.5px solid rgba(255,255,255,.6); }
.lang-switch button.on { background: #fff; color: var(--blue); }
.lang-switch button:not(.on):hover { background: rgba(255,255,255,.15); }
.lang-switch button:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
/* light version on the white sign-in card */
.lang-switch.light { border-color: var(--line); margin-left: 0; }
.lang-switch.light button { color: var(--ink-2); }
.lang-switch.light button + button { border-left-color: var(--line); }
.lang-switch.light button.on { background: var(--blue); color: #fff; }
.lang-switch.light button:not(.on):hover { background: #f1f3f6; }
.login-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.login-top .login-brand { margin-bottom: 0; }
@media (max-width: 860px) { .lang-switch { margin-left: 8px; } .lang-switch button { padding: 4px 8px; } }
/* bilingual header: the French menu is longer, keep everything on one line */
@media (max-width: 1350px) {
  .topbar { gap: 18px; padding: 0 20px; }
  .topnav { gap: 18px; font-size: 15px; }
  .brand { font-size: 24px; }
}
@media (max-width: 1200px) {
  .account-name { display: none; }
  .brand .ver { display: none; }
}
@media (max-width: 1060px) {
  .topnav { gap: 14px; font-size: 14px; }
  .signout { padding: 4px 8px; }
}
/* phones: logo + avatar + sign-out icon + FR|EN must fit in 375 px */
@media (max-width: 860px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand { font-size: 19px; gap: 6px; } .brand svg { width: 26px; height: 26px; } .brand .ver { display: none; }
  .engines { display: none; }
  .topbar .account { margin-left: auto; gap: 6px; }
  .account .avatar { width: 28px; height: 28px; font-size: 14px; }
  .signout { font-size: 0; padding: 4px 7px; line-height: 1; }        /* text kept for screen readers */
  .signout { width: 30px; height: 26px; background: center / 16px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 4h3a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-3'/%3E%3Cpath d='M10 17l5-5-5-5M15 12H4'/%3E%3C/svg%3E"); }
  .topbar > .lang-switch { margin-left: 6px; }
}
