/* Shared tokens and base styles for the website and the extension's own pages.
   Two-tone rule: sun marks the writer's own words, coral marks the customer's language. */
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/plex-sans.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --display: "Newsreader", Georgia, serif;
  --canvas: light-dark(#f7f4ee, #101119);
  --surface: light-dark(#fff, #191b29);
  --sunken: light-dark(#efeae0, #12131d);
  --ink: light-dark(#17182b, #f4f1ea);
  --muted: light-dark(#55566b, #a9a9bb);
  --line: light-dark(#dcd4c5, #2f3145);
  --line-strong: light-dark(#17182b, #6c6e87);
  --sun: #ffc531;
  --sun-soft: light-dark(#ffe9a8, #3f3513);
  --coral: #ff6a4d;
  --coral-soft: light-dark(#ffe0d8, #47221c);
  --coral-ink: light-dark(#b62c18, #ff9c8a);
  --night: light-dark(#17182b, #0a0b13);
  --on-night: #f4f1ea;
  --accent: var(--sun);
  --on-accent: #17182b;
  --focus: light-dark(#17182b, #ffc531);
  --radius: 6px;
  --radius-large: 10px;
  --space: 8px;
  --shadow: 0 1px 2px #0b0c1626, 0 16px 36px -14px #0b0c1666;
  font: 15px/1.55 var(--font);
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
/* Chrome gives extension pages their own body font, so it is set here and not only on the root. */
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.5 var(--font); }
main { max-width: 680px; margin: 0 auto; padding: 32px 24px 56px; }
h1, h2 { font-family: var(--display); letter-spacing: -.01em; }
h1 { font-size: 2.3rem; line-height: 1.1; font-weight: 600; margin: 0 0 12px; }
h2 { font-size: 1.45rem; line-height: 1.2; font-weight: 600; margin: 0 0 6px; }
h3 { font-size: 1rem; font-weight: 600; margin: 16px 0 0; }
p { color: var(--muted); margin-block: 8px; }
p:empty { display: none; }
small { color: var(--muted); }
a { color: var(--ink); text-decoration-color: var(--sun); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
::selection { background: var(--sun); color: #17182b; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.brand { display: flex; align-items: center; gap: var(--space); font: 600 1rem/1.2 var(--font); letter-spacing: 0; color: var(--ink); margin: 0 0 24px; }
.brand img { border-radius: 6px; }
body:not(.website) main > a:first-child { display: inline-block; margin-block-end: 16px; }

button { cursor: pointer; min-height: 38px; border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 14px; font: 600 .95em/1.3 var(--font); background: transparent; color: var(--ink); transition: background-color 120ms ease, border-color 120ms ease; }
button:hover { background: var(--sunken); border-color: var(--line-strong); }
button:active { background: var(--line); }
button:disabled { cursor: default; opacity: .5; }
button[type="submit"], form button:not([type]), #new-reply, #site-access button, #report-editor button {
  background: var(--sun); border-color: var(--sun); color: var(--on-accent);
}
button[type="submit"]:hover, form button:not([type]):hover, #new-reply:hover, #site-access button:hover, #report-editor button:hover {
  background: #ffb400; border-color: #ffb400;
}
button[data-session="delete"], #delete-reply { color: var(--coral-ink); }
button[data-session="delete"]:hover, #delete-reply:hover { background: var(--coral-soft); border-color: var(--coral-ink); }

label { font-weight: 600; }
input, select, textarea { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sunken); color: var(--ink); padding: 8px 12px; font: inherit; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
select { appearance: none; padding-inline-end: 40px; background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%2355566b' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) {
  select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%23a9a9bb' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E"); }
}
[dir="rtl"] select { background-position: left 14px center; }
input[type="checkbox"] { width: 18px; min-height: 0; height: 18px; padding: 0; accent-color: light-dark(#17182b, #ffc531); }
input[type="file"] { padding: 6px; }

form, body:not(.website) main > section, #manager { display: grid; gap: 8px; margin-block: 16px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-large); }
form form, #manager form, #manager { box-shadow: none; }
#manager { padding: 0; border: 0; background: none; }
form button, section > button { justify-self: start; }
form > label, section > label { margin-block-start: 8px; }
fieldset { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 14px; }
legend { padding-inline: 6px; font-weight: 600; }
.check { display: flex; align-items: start; gap: var(--space); font-weight: 400; }
.check input { flex: none; margin-block-start: 2px; }
.row, .term { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space); }
.term { margin-block: var(--space); }
.term input { flex: 1 1 130px; }
#tone-overrides { display: grid; gap: var(--space); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
[role="status"] { color: var(--ink); font-weight: 600; }

/* Reply languages: tags in order, then a field that opens a short list. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 2px; min-height: 32px; padding: 2px 2px 2px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-weight: 600; }
.chip:first-child { background: var(--sun); border-color: var(--sun); color: #17182b; }
.chip button { min-height: 26px; width: 26px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: inherit; font: 400 17px/1 var(--font); }
.chip button:hover { background: #17182b26; border: 0; }
.combo { position: relative; }
.combo [role="listbox"] { position: absolute; z-index: 2; inset: calc(100% + 4px) 0 auto; display: grid; gap: 1px; max-height: 248px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.combo [role="option"] { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 4px; cursor: pointer; }
.combo [role="option"] small { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.combo [role="option"][aria-selected="true"] { background: var(--sun); color: #17182b; }
.combo [role="option"][aria-selected="true"] small { color: inherit; }

.account { display: grid; gap: 6px; margin-block: 16px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-large); }
#offers { display: grid; gap: 0; }
#offers .row { margin-block-start: 4px; }
.account p { margin-block: 0; }
.account strong[data-account-remaining] { font: 600 2rem/1.15 var(--display); letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; }
.account .row { margin-block-start: 10px; }
.account button { min-height: 34px; padding: 5px 12px; }

.popup { min-width: 320px; }
.popup main { padding: 16px; }
.popup .brand { margin-block-end: 12px; }
.popup .account { margin-block: 0 12px; padding: 16px; }
.popup .account button { font-size: 13px; min-height: 30px; padding: 3px 10px; }
.popup #translate-page { width: 100%; background: var(--sun); border-color: var(--sun); color: var(--on-accent); }
.popup #translate-page:hover { background: #ffb400; border-color: #ffb400; }
.popup .site { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-block: 0 12px; }
.popup .site p { margin: 0; overflow-wrap: anywhere; }
.popup .site button { flex: none; font-size: 13px; min-height: 30px; padding: 3px 10px; }
.popup .site button[data-on="false"] { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
#surface-options { display: grid; gap: 6px; }
.popup .links { display: flex; justify-content: center; gap: 20px; margin-block: 12px 0; }
.popup .links a { font-weight: 600; }

#typed-shortcuts .row, #manager .row, .reply-items { margin-block: var(--space); }
.reply-items { display: flex; flex-wrap: wrap; gap: var(--space); }
#reply-versions fieldset { margin-block: var(--space); }
#reply-versions textarea { margin-block: var(--space); }

@media (prefers-reduced-motion: reduce) { button { transition: none; } }
