/* Gameday Threads web. Every color comes from the desktop app's own
   theme table (_load_themes in gameday_threads.py) and team_colors.json,
   generated into data/desktop-data.js by scripts/build_data.py. Sizes are the desktop app's Tk point sizes
   converted at 96 DPI (1pt = 4/3 px). */
:root {
  --bg: #141414; --fg: #FFFFFF; --accent: #c0c0c0;
  --comment-bg: #1e1e1e; --comment-fg: #FFFFFF;
  --button-bg: #333333; --button-fg: #FFFFFF;
  --entry-bg: #0a0a0a; --entry-fg: #FFFFFF;
  --scroll-trough: #000000; --scroll-thumb: #000000; --scroll-arrow: #FFFFFF;
  --header-bg: #141414; --ts: #a6c8ff; --author: #FFDD55;
  --faded: #1e1e1e; --pipe: #FFFFFF; --reply-user: #ffeb99;
  --banner-bg: #0a0a0a; --banner-fg: #FFFFFF;
  --status: #00FF00; --dot: #2ecc71;
  --font: "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  --ui-size: 13.33px;         /* ui_font: 10pt */
  --comment-size: 17.33px;    /* comment_font: 13pt default */
  --header-size: 16px;        /* header_font: font size - 1, bold */
  --banner-size: 21.33px;     /* subreddit_font: font size + 3 */
  --header-weight: 700;
  --gap-after: 1;             /* Comment Spacing (line_spacing) in lines */
  --scale: 1; --banner-scale: 1; /* phone shrinks text a little */
  --btn-light: rgba(255,255,255,.55);
  --btn-dark: rgba(0,0,0,.9);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color-scheme: dark; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: var(--ui-size);
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}
button, select, input, textarea { font: inherit; color: inherit; }

/* ---------- app frame ---------- */
.app {
  display: flex; flex-direction: column;
  height: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Classic Windows Tk raised button with a themed fill */
.tkbtn {
  background: var(--button-bg); color: var(--button-fg);
  border: 0; border-radius: 0;
  height: 30px; padding: 0 12px; white-space: nowrap;
  box-shadow: inset 1px 1px 0 var(--btn-light), inset -1px -1px 0 var(--btn-dark),
              inset -2px -2px 0 rgba(0,0,0,.35);
  cursor: pointer; flex: none;
}
.tkbtn:active, .tkbtn.pressed {
  background: var(--accent);
  box-shadow: inset 1px 1px 0 var(--btn-dark), inset -1px -1px 0 var(--btn-light);
}
.tkbtn:disabled { color: #6d6d6d; cursor: default; }
.tkbtn:disabled:active { background: var(--button-bg); box-shadow: inset 1px 1px 0 var(--btn-light), inset -1px -1px 0 var(--btn-dark), inset -2px -2px 0 rgba(0,0,0,.35); }
.tkbtn.on { background: var(--accent); color: #000; }
.iconbtn { width: 26px; padding: 0; display: inline-grid; place-items: center; }

/* ttk "clam" combobox */
.combo {
  position: relative; display: inline-flex; align-items: stretch; flex: none;
  height: 30px; background: var(--entry-bg); color: var(--entry-fg);
  border: 1px solid #b4b4b4;
}
.combo select {
  appearance: none; -webkit-appearance: none; border: 0; outline: 0;
  background: transparent; color: var(--entry-fg);
  padding: 0 30px 0 5px; width: 100%; cursor: pointer;
  text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
}
.combo select option { background: var(--entry-bg); color: var(--entry-fg); }
.combo::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 15px;
  background: var(--button-bg); border-left: 1px solid #b4b4b4; pointer-events: none;
}
.combo::before {
  content: ""; position: absolute; right: 4px; top: 50%; margin-top: -2px; z-index: 1;
  border: 4px solid transparent; border-top: 5px solid var(--button-fg); border-bottom: 0;
  pointer-events: none;
}

/* ---------- tab strip (Premium) ---------- */
.tabstrip { display: flex; align-items: flex-end; gap: 4px; padding: 8px 10px 0; overflow-x: auto; scrollbar-width: none; flex: none; }
.tabstrip::-webkit-scrollbar { display: none; }
.tab {
  flex: none; min-width: 100px; height: 34px; margin-top: 2px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 8px 0 10px; border-radius: 8px; cursor: pointer;
  background: var(--button-bg); color: var(--button-fg);
  font-size: var(--ui-size); user-select: none; white-space: nowrap;
}
.tab .x { padding: 0 2px; opacity: .95; }
.tab .x:hover { opacity: 1; text-decoration: underline; }
.tabstrip .tkbtn { margin-left: 4px; width: 34px; padding: 0; }

/* ---------- thread bar ---------- */
.threadbar { display: flex; align-items: center; padding: 10px 5px 5px; flex: none; min-width: 0; }
.threadbar > * { margin: 0 5px; }
.thread-combo { width: 560px; min-width: 120px; flex: 0 1 560px; }
.caret { width: 22px; padding: 0; margin-left: -4px !important; display: inline-grid; place-items: center; }
.status { display: inline-flex; align-items: center; gap: 3px; margin-left: 10px !important; min-width: 0; overflow: hidden; white-space: nowrap; flex: 1 1 auto; }
.status .dot { color: var(--dot); font-size: 18.67px; line-height: 1; }
.status .txt { color: var(--status); overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1 1 auto; }
#upgradeBtn { margin-right: 5px; margin-left: 5px; }

/* ---------- comment header bar (team banner) ---------- */
.headerbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  margin: 0 10px 5px; min-height: 34px; background: var(--banner-bg); flex: none;
}
.headerbar .sub, .headerbar .score { color: var(--banner-fg); font-size: calc(var(--banner-size) * var(--banner-scale)); white-space: nowrap; }
.headerbar .sub { padding-left: 8px; overflow: hidden; text-overflow: ellipsis; }
.headerbar .score .sep { display: inline-block; width: 2px; height: 1.05em; background: currentColor; vertical-align: -0.18em; margin: 0 6px; }
.stylebar { display: flex; justify-content: flex-end; align-items: center; gap: 0; padding: 2px 0; }
.stylebar .tkbtn { margin: 0 5px; }
.morebtn { width: 22px; padding: 0; display: inline-grid; place-items: center; margin-right: 6px !important; }
.morebtn svg { display: block; }

/* ---------- comment box ---------- */
.commentframe { position: relative; flex: 1 1 auto; min-height: 0; margin: 5px 10px 5px; display: flex; }
.commentbox {
  flex: 1 1 auto; overflow-y: scroll; background: var(--comment-bg); color: var(--comment-fg);
  border: 1px solid; border-color: #6b6b6b #e3e3e3 #e3e3e3 #6b6b6b;
  padding: 5px 10px; font-size: calc(var(--comment-size) * var(--scale)); line-height: 1.33;
  scrollbar-color: var(--scroll-thumb) var(--scroll-trough);
  overscroll-behavior: contain;
}
.commentbox::-webkit-scrollbar { width: 16px; }
.commentbox::-webkit-scrollbar-track { background: var(--scroll-trough); }
.commentbox::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border: 1px solid var(--scroll-arrow); }
.commentbox::-webkit-scrollbar-button:single-button { background: var(--scroll-trough); height: 14px; border: 1px solid var(--scroll-arrow); }
.c { margin-bottom: calc(var(--gap-after) * 1.33em); }
.c .h { background: var(--header-bg); font-size: calc(var(--header-size) * var(--scale)); font-weight: var(--header-weight); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c .ts { color: var(--ts); }
.c .pipe { color: var(--pipe); }
.c .au { color: var(--author); }
.c .rt { color: var(--pipe); font-size: calc(var(--header-size) - 2.67px); font-weight: 400; }
.c .ru { color: var(--reply-user); font-size: calc(var(--header-size) - 2.67px); font-weight: 400; }
.c .rl { color: var(--ts); cursor: pointer; font-weight: 400; }
.c .rl:hover { text-decoration: underline; }
.c .b { background: var(--faded); padding-left: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.c .sp { color: var(--score-pos); } .c .sn { color: var(--score-neg); }
.c .thumb { display: inline-block; color: var(--comment-fg); cursor: pointer; text-decoration: none; vertical-align: top; }
.c .thumbimg { display: block; max-width: 240px; max-height: 240px; }
.c .gif { color: var(--ts); text-decoration: underline; cursor: pointer; }
.c.new { animation: none; }
.c.mark .b { outline: 2px solid var(--accent); outline-offset: -2px; }

/* counters + crowd meter, bottom-right over the feed */
.counts { position: absolute; right: 25px; bottom: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; pointer-events: none; }
.counts[hidden] { display: none; }
.counts .boxes { display: flex; gap: 4px; }
.counts .box, .counts .crowd {
  background: var(--comment-bg); color: var(--comment-fg); border: 1px solid var(--comment-fg);
  padding: 2px 5px; font-size: var(--ui-size); line-height: 1.3;
}
.counts .crowd { width: 106px; padding: 2px 5px; }
.counts .meter { width: 106px; height: 8px; border: 1px solid var(--comment-fg); background: var(--comment-bg); }
.counts .meter i { display: block; height: 100%; width: 35%; background: #4CAF50; transition: width .6s ease, background-color .6s; }

/* reply indicator */
.replybar { display: none; align-items: center; gap: 4px; margin: 0 10px 4px 0; padding-left: 336px; font-size: var(--ui-size); flex: none; }
.replybar.show { display: flex; }
.replybar .u { color: var(--reply-user); }
.replybar .x { cursor: pointer; padding: 0 4px; }

/* ---------- bottom input row ---------- */
.inputrow { display: flex; align-items: center; padding: 0 10px 10px; flex: none; gap: 0; }
.inputrow .combo { width: 150px; margin-right: 10px; }
.inputrow .input {
  flex: 1 1 auto; min-width: 0; height: 30px; margin-right: 5px;
  background: var(--entry-bg); color: var(--entry-fg);
  border: 2px solid; border-color: #6b6b6b #e3e3e3 #e3e3e3 #6b6b6b;
  padding: 0 10px; outline: 0; caret-color: var(--entry-fg);
}
.inputrow .tkbtn { margin: 0 5px; }
.inputrow .tkbtn:last-child { margin-right: 0; }

/* ---------- popup menu (⋮) ---------- */
.menu {
  position: fixed; z-index: 30; min-width: 166px; display: none;
  background: var(--bg); color: var(--fg); border: 1px solid #8a8a8a;
  padding: 4px 0; font-size: var(--ui-size);
}
.menu.show { display: block; }
.menu .row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 0 0 17px; height: 32px; cursor: pointer; }
.menu .row:hover { background: var(--button-bg); }
.menu .pin { width: 40px; height: 100%; display: grid; place-items: center; }
.menu .pin i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--fg); }
.menu .pin i.on { background: var(--accent); border-color: var(--accent); }
.menu hr { border: 0; border-top: 1px solid #8a8a8a; margin: 4px 0; }
.menu .row.off { color: #7d7d7d; cursor: default; }
.menu .row.off:hover { background: none; }
.menu .row:not(:has(.pin)) { padding-right: 17px; }
.menu { max-height: calc(100% - 16px); overflow-y: auto; }

/* ---------- Settings window: SettingsDialogBuilder's light-gray Tk dialog ---------- */
.settings {
  position: absolute; z-index: 20; display: none; right: 0; top: 0; max-height: 100%;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  width: min(var(--settings-width, 800px), 100%); background: #D3D3D3; color: #000;
  flex-direction: column; font-size: var(--ui-size);
}
.settings.show { display: flex; }
/* the Toplevel's window title bar */
.titlebar { display: flex; align-items: center; gap: 8px; flex: none; height: 30px; padding-left: 8px; background: #f3f3f3; color: #444; font-size: 12px; user-select: none; }
.titlebar img { width: 16px; height: 16px; }
.titlebar span { flex: 1 1 auto; }
.titlebar button { width: 46px; height: 30px; border: 0; background: transparent; color: #222; font-size: 15px; cursor: pointer; }
.titlebar button:hover { background: #c42b1c; color: #fff; }
.settings .tabs { display: flex; padding: 6px 10px 0; gap: 0; flex: none; }
.settings .tabs button {
  border: 1px solid #9e9a91; border-bottom: 0; margin-right: -1px; background: #cfcac0; color: #000;
  padding: 3px 7px 4px; cursor: pointer; font-weight: 400; position: relative; top: 2px;
}
.settings .tabs button.on { background: #dcdad5; font-weight: 700; top: 0; padding-bottom: 6px; z-index: 1; }
.settings .body {
  flex: 1 1 auto; overflow: auto; margin: 0 10px 5px; border: 1px solid #9e9a91; background: #dcdad5;
  padding: 10px 20px; display: grid; gap: 0 10px; align-content: start;
}
.settings .body.two { grid-template-columns: 1fr 1fr; column-gap: 0; align-content: stretch; }
.settings .body.two.appear { grid-template-columns: max-content 1fr; }
.settings .col > button + label.chk { display: flex; width: fit-content; margin-top: 6px; }
.settings .body.one { grid-template-columns: 1fr; align-content: stretch; }
.settings .body > .col { background: #D3D3D3; padding: 8px 0 8px; min-width: 0; }
.settings .body.two > .col:first-child { padding: 8px 12px 8px 3px; }
.settings .body.center { align-content: center; justify-items: center; }
.settings h4 { margin: 13px 0 6px; font-size: var(--ui-size); font-weight: 700; }
.settings h4:first-child { margin-top: 0; }
.settings h4.gap { margin-top: 18px; }
.settings .checks { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 7px 0 2px; }
.settings label.chk { display: inline-flex; align-items: center; gap: 4px; min-height: 25px; padding: 0 5px 0 3px; background: #D9D9D9; cursor: pointer; white-space: nowrap; }
.settings label.chk b { font-weight: 700; }
.settings label.chk span { font-weight: 400; }
.settings label.chk.off { color: #a3a3a3; cursor: default; }
/* Tk's classic checkbutton: a small white box with a black tick */
.settings label.chk input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0 4px 0 0; width: 11px; height: 11px;
  background: #fff center / 9px 9px no-repeat; border: 1px solid #555; border-radius: 0; cursor: inherit;
}
.settings label.chk input:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath d='M1.5 4.5l2 2 4-5' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E"); }
.settings label.chk input:disabled { border-color: #a3a3a3; }
.settings .opts { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 6px 0 0; }
.settings h4 + .opts { margin-top: 0; }
.settings .combo { width: 100%; height: 26px; border-color: #9e9a91; }
.settings .note { margin-top: 4px; font-weight: 700; max-width: 250px; }
.settings .fontrow { display: flex; align-items: center; gap: 0; }
.settings .fontrow .combo { flex: 1 1 auto; width: auto; margin-right: 10px; }
.settings .size { width: 34px; text-align: center; font-size: 16px; }
.settings .sq { width: 19px; height: 19px; padding: 0; margin-left: 5px; line-height: 19px; background: var(--button-bg); color: var(--button-fg); border: 0; cursor: pointer; font-size: 11px; }
/* Tk Scale: grey trough with a raised, ridged slider */
.settings input[type=range] {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 12px; margin: 4px 0 0;
  background: #bab5ab; border: 1px solid #9e9a91; border-radius: 0; cursor: pointer;
}
.settings input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 12px; border: 1px solid #9e9a91; border-radius: 0;
  background: repeating-linear-gradient(90deg, transparent 0 9px, #8f8a80 9px 10px, transparent 10px 12px) , #dcdad5;
}
.settings input[type=range]::-moz-range-thumb {
  width: 24px; height: 10px; border: 1px solid #9e9a91; border-radius: 0;
  background: repeating-linear-gradient(90deg, transparent 0 9px, #8f8a80 9px 10px, transparent 10px 12px) , #dcdad5;
}
.settings input[type=range]::-moz-range-track { background: transparent; }
.settings .tkbtn { height: 28px; }
.settings .save { flex: none; height: 30px; border: 0; background: var(--button-bg); color: var(--button-fg); cursor: pointer; margin: 0; }
.settings .save:active { background: var(--accent); }
.settings textarea {
  width: 100%; display: block; margin: 5px 0; resize: vertical; font: inherit; line-height: 1.35;
  background: var(--entry-bg); color: var(--entry-fg); caret-color: var(--entry-fg); border: 1px solid #9e9a91; padding: 2px;
}
.settings .entry { height: 26px; background: var(--entry-bg); color: var(--entry-fg); border: 1px solid #9e9a91; padding: 0 4px; width: 100%; }
.settings .entry.wide { flex: 1 1 auto; width: auto; background: #fff; color: #000; }
.settings .colorrow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 0; margin: 8px 0 5px; }
.settings .colorrow b { margin-right: 5px; }
.settings .colorrow b.second { margin-left: 10px; }
.settings .colorrow .grow { flex: 1 1 auto; }
.settings .swatch { display: inline-block; width: 94px; height: 22px; margin: 0 5px; background: #fff; border: 0; }
.settings .colorrow .tkbtn { margin: 0 5px; }
.settings .colorrow .tkbtn:last-child { margin-right: 0; }
.settings .sep { height: 17px; }
.settings .switch { display: flex; gap: 2px; margin-bottom: 5px; }
.settings .switch .tkbtn.on { background: var(--accent); color: #000; font-weight: 700; }
.settings .col > .tkbtn { margin: 0 0 5px; }
.settings .col > label.chk { margin-top: 2px; }
.settings .tedit-top { display: flex; align-items: center; gap: 5px; margin: 5px 0; }
.settings .tedit-top b { white-space: nowrap; }
.settings .tedit-top .combo { flex: 1 1 auto; width: auto; }
.settings .cgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.settings .crow { display: flex; align-items: center; justify-content: flex-end; gap: 0; margin: 2px 0; height: 32px; }
.settings .crow b { flex: 1 1 auto; text-align: right; overflow: hidden; white-space: nowrap; text-overflow: clip; }
.settings .crow .swatch { flex: none; }
.settings .tnote { font-weight: 700; margin: 14px 0 0; max-width: 700px; }
.settings .license { text-align: center; padding: 40px 0; }
.settings .license h3 { font-size: 18.67px; margin: 0 0 13px; }
.settings .license p { font-weight: 700; margin: 0 0 13px; }

/* ---------- dialogs (Toplevel windows over the main screen) ---------- */
.dlg-back { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); }
.dlg { background: var(--bg); color: var(--fg); border: 1px solid #8a8a8a; box-shadow: 0 8px 30px rgba(0,0,0,.5); display: flex; flex-direction: column; max-width: calc(100% - 24px); max-height: calc(100% - 24px); }
.dlg-title { flex: none; padding: 6px 10px; font-size: 12px; background: #f0f0f0; color: #000; border-bottom: 1px solid #ccc; }
.dlg .flat { box-shadow: none; }
.dlg .foot { flex: none; display: flex; justify-content: center; padding: 10px; }
/* messagebox */
.dlg.msg { background: #fff; color: #000; min-width: 300px; max-width: min(460px, calc(100% - 24px)); }
.msg-body { display: flex; gap: 14px; align-items: flex-start; padding: 22px 22px 18px; font-size: 13.33px; line-height: 1.4; white-space: pre-wrap; }
.msg-icon { font-size: 26px; line-height: 1; }
.msg-foot { background: #f0f0f0; padding: 10px 12px; display: flex; justify-content: flex-end; gap: 8px; }
.msgbtn { min-width: 80px; height: 26px; background: #e1e1e1; border: 1px solid #adadad; color: #000; cursor: pointer; }
.msgbtn:focus { outline: 1px dotted #000; outline-offset: -4px; border-color: #0078d7; }
/* Game Summary */
.dlg.summary { width: 640px; height: 600px; }
.dlg.summary .scroll { flex: 1 1 auto; overflow: auto; font-size: calc((var(--comment-size) - 1.33px)); }
.sum-head { background: var(--header-bg); padding: 14px 14px 14px; }
.sum-head .teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; }
.sum-head .away, .sum-head .home { font-size: calc(var(--comment-size) + 5.33px); font-weight: 700; }
.sum-head .away { text-align: right; padding-right: 8px; }
.sum-head .home { padding-left: 8px; }
.sum-head .at { color: var(--accent); }
.sum-head .status { text-align: center; margin-top: 2px; font-weight: 700; font-size: var(--comment-size); color: #00FF00; }
.sum-head .status.final { color: var(--fg); }
.sum-head .status .bar { white-space: pre; }
.dlg .box { margin: 14px 14px 0; background: var(--comment-bg); }
.dlg .box table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.dlg .box th { background: var(--header-bg); color: var(--accent); font-weight: 400; padding: 4px 0; }
.dlg .box th:first-child { width: 22%; }
.dlg .box td { text-align: center; padding: 6px 0; }
.dlg .box td.team { text-align: left; padding-left: 8px; font-weight: 700; }
.dlg .box td.fin { color: var(--accent); font-weight: 700; }
.dlg .sec { display: flex; align-items: center; gap: 8px; margin: 12px 14px 4px; font-weight: 700; font-size: var(--comment-size); }
.dlg .sec i { flex: 1 1 auto; height: 1px; background: var(--accent); }
.dlg .sec.big { font-size: calc(var(--comment-size) + 1.33px); margin: 16px 14px 6px; gap: 10px; }
.dlg .kv { margin: 0 14px 10px; }
.dlg .kvrow { display: flex; }
.dlg .kvrow.alt { background: var(--comment-bg); }
.dlg .kvrow .k { flex: none; width: 16ch; color: var(--accent); padding: 4px 4px 4px 8px; }
.dlg .kvrow .v { flex: 1 1 auto; padding: 4px 8px 4px 0; }
.dlg .dt { margin: 0 14px 10px; background: var(--comment-bg); }
.dlg .dt table { width: 100%; border-collapse: collapse; }
.dlg .dt th { background: var(--header-bg); color: var(--accent); font-weight: 400; padding: 4px 6px; white-space: nowrap; }
.dlg .dt td { padding: 4px 6px; }
.dlg .dt tr.alt td { background: var(--comment-bg); }
.dlg .dt tr:not(.alt) td { background: var(--bg); }
.dlg .dt .l { text-align: left; } .dlg .dt .c { text-align: center; white-space: nowrap; }
.dlg .dt .w { width: 99%; }
/* Rules & Penalties */
.dlg.rules { width: 980px; height: 640px; }
.rtop { flex: none; display: flex; align-items: center; gap: 14px; background: var(--header-bg); padding: 10px 14px; }
.rtop .leagues { display: flex; gap: 6px; }
.lgbtn { width: 5.2em; height: 36px; border: 0; background: var(--button-bg); color: var(--button-fg); font-weight: 700; font-size: calc(var(--comment-size) + 1.33px); cursor: pointer; }
.lgbtn.on { background: var(--accent); color: #000; }
.rtop .search { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; font-size: calc(var(--comment-size) - 1.33px); }
.rtop .search input { flex: 1 1 auto; height: 26px; background: var(--entry-bg); color: var(--entry-fg); border: 1px solid #8a8a8a; padding: 0 4px; font-size: inherit; }
.rbody { flex: 1 1 auto; display: flex; min-height: 0; font-size: calc(var(--comment-size) - 1.33px); }
.toc { flex: none; width: 180px; background: var(--header-bg); padding: 12px 10px; overflow: auto; }
.toc .toch { font-weight: 700; font-size: calc(var(--comment-size) + 1.33px); margin-bottom: 6px; }
.toc a { display: block; color: var(--ts); margin: 6px 0; }
.rbody .content { flex: 1 1 auto; overflow: auto; position: relative; padding-bottom: 10px; }
.rbody .tbl { margin: 0 14px 4px; background: var(--comment-bg); }
.kv2 { display: flex; }
.kv2:not(.alt) { background: var(--bg); }
.kv2 .k { flex: none; width: 220px; color: var(--accent); font-weight: 700; padding: 6px 8px; }
.kv2 .v { flex: 1 1 auto; padding: 6px 8px 6px 0; }
.pen { padding: 6px 8px 8px; }
.pen:not(.alt) { background: var(--bg); }
.pen .ph { display: flex; justify-content: space-between; gap: 10px; }
.pen .ph span { color: var(--accent); text-align: right; }
.pen .pd { color: var(--accent); font-size: calc(var(--comment-size) - 2.67px); }
.pen .px { margin-top: 2px; }
.rbody .rule { height: 1px; background: var(--accent); }
.rbody .txt { margin: 0 14px 4px; }
.rbody .none { color: var(--accent); text-align: center; padding: 40px; }
.rfoot { flex: none; text-align: center; padding-top: 6px; }
.rfoot .fine { color: var(--accent); font-size: calc(var(--comment-size) - 2.67px); }
.rfoot .tkbtn { margin: 10px auto; }
/* Upgrade */
.dlg.upgrade { width: 420px; }
.up { padding: 16px 26px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.up h3 { margin: 10px 0 15px; font-size: 18.67px; }
.up p { margin: 0 0 10px; max-width: 350px; }
.up .learn { width: 13ch; height: 32px; background: #0078D7; color: #fff; border: 0; font-weight: 700; font-size: 16px; cursor: pointer; margin-bottom: 10px; }
.up .learn:hover { background: #005BB5; }
.up label { margin-bottom: 5px; }
.up input { width: 100%; max-width: 340px; height: 28px; background: var(--entry-bg); color: var(--entry-fg); border: 2px solid #8a8a8a; padding: 0 6px; margin-bottom: 10px; }
.up .verify { width: 15ch; height: 38px; font-weight: 700; font-size: 16px; margin-top: 10px; }
.colorpicker { position: fixed; left: -100px; top: 0; width: 1px; height: 1px; opacity: 0; }

.toast { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 60; background: #111; color: #fff; border: 1px solid #666; padding: 8px 14px; font-size: 13px; display: none; max-width: calc(100% - 32px); }
.toast.show { display: block; }

/* ---------- phone layout ---------- */
.only-phone { display: none; }
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  :root { --scale: .88; --banner-scale: .78; }
  .only-phone { display: initial; }
  .only-desk { display: none !important; }
  .tabstrip { padding: 6px 8px 0; }
  .tab { min-width: 0; height: 32px; }
  .threadbar { flex-wrap: wrap; padding: 6px 3px 4px; row-gap: 6px; }
  .threadbar > * { margin: 0 2px; }
  .thread-combo { order: -1; flex: 1 1 100%; width: auto; }
  .thread-combo select { pointer-events: none; }
  .app { height: var(--app-h, 100%); }
  /* Speed and TV Delay live in the ⋮ menu */
  .inputrow .combo { display: none; }
  /* 16px stops iPhone zooming the page when a text box is tapped */
  .inputrow .input, .findbar input { font-size: 16px; }
  .headerbar .sub, .headerbar .score { cursor: pointer; }
  .dlg.picker { width: calc(100% - 16px); height: calc(100% - 32px); max-height: calc(100% - 32px); }
  .picker .pick-find { flex: none; margin: 8px; height: 36px; padding: 0 8px; font: inherit; font-size: 16px; background: var(--entry-bg); color: var(--entry-fg); border: 2px solid #8a8a8a; outline: 0; }
  .picker .pick-list { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .picker .pick-row { display: block; width: 100%; text-align: left; padding: 12px 12px; border: 0; border-bottom: 1px solid var(--comment-bg); background: transparent; color: var(--fg); font: inherit; font-size: 15px; line-height: 1.3; }
  .picker .pick-row.on { background: var(--button-bg); font-weight: 700; }
  .picker .pick-row:active { background: var(--button-bg); }
  .picker .pick-sep { padding: 10px 12px 4px; font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--accent); }
  .threadbar .tkbtn { padding: 0 6px; }
  /* phones: one compact toolbar row with Upgrade next to Settings, status on the next line */
  .status { order: 10; flex: 1 1 calc(100% - 60px); min-width: 0; margin-left: 6px !important; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .threadbar #upgradeBtn { margin-left: 2px !important; margin-right: 2px !important; }
  .threadbar .tkbtn { height: 32px; }
  #refreshBtn, #settingsBtn { font-size: 0; width: 40px; padding: 0 !important; }
  #refreshBtn::before { content: "\21BB"; font-size: 20px; }
  #settingsBtn::before { content: ""; width: 20px; height: 20px; background: currentColor; display: inline-block; vertical-align: middle;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.4 13a7.7 7.7 0 0 0 0-2l2.1-1.6-2-3.5-2.5 1a7.6 7.6 0 0 0-1.7-1L15 3.3h-4l-.4 2.6a7.6 7.6 0 0 0-1.7 1l-2.5-1-2 3.5L6.6 11a7.7 7.7 0 0 0 0 2l-2.1 1.6 2 3.5 2.5-1a7.6 7.6 0 0 0 1.7 1l.4 2.6h4l.4-2.6a7.6 7.6 0 0 0 1.7-1l2.5 1 2-3.5zM13 15.5a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7z' transform='translate(-1 0)'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.4 13a7.7 7.7 0 0 0 0-2l2.1-1.6-2-3.5-2.5 1a7.6 7.6 0 0 0-1.7-1L15 3.3h-4l-.4 2.6a7.6 7.6 0 0 0-1.7 1l-2.5-1-2 3.5L6.6 11a7.7 7.7 0 0 0 0 2l-2.1 1.6 2 3.5 2.5-1a7.6 7.6 0 0 0 1.7 1l.4 2.6h4l.4-2.6a7.6 7.6 0 0 0 1.7-1l2.5 1 2-3.5zM13 15.5a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7z' transform='translate(-1 0)'/%3E%3C/svg%3E") center / contain no-repeat; }
  /* banner keeps the score; Summary, Compact and Find are in the ⋮ menu */
  .headerbar .stylebar .tkbtn:not(.morebtn) { display: none; }
  .threadbar .tkbtn { flex: 1 1 auto; }
  .threadbar.quiet .status { display: none; }
  .headerbar .morebtn { width: 36px; }
  .threadbar .morebtn { order: 11; flex: none; width: 36px; height: 28px; padding: 0 !important; display: inline-grid; place-items: center; }
  .headerbar:has(.sub:empty):has(.score:empty):not(:has(.morebtn)) { display: none; }
  /* account buttons move into the ⋮ menu once signed in */
  #loginBtn:disabled, #logoutBtn { display: none; }
  .headerbar { grid-template-columns: 1fr auto; grid-template-areas: "sub style" "score score"; margin: 0 6px 4px; }
  .headerbar .sub { grid-area: sub; }
  .headerbar .stylebar { grid-area: style; }
  .headerbar .score { grid-area: score; padding: 0 8px 4px; white-space: normal; line-height: 1.25; text-align: left; }
  .commentframe { margin: 3px 6px; }
  .commentbox { padding: 4px 6px; }
  .commentbox::-webkit-scrollbar { width: 0; }
  .counts { right: 12px; bottom: 8px; flex-direction: row; align-items: center; }
  .counts .crowd { display: none; }
  .counts .meter { width: 56px; }
  .commentbox { padding-bottom: 40px; }
  .inputrow { flex-wrap: wrap; padding: 0 6px 8px; row-gap: 6px; }
  .inputrow .combo { flex: 1 1 40%; width: auto; margin-right: 6px; height: 30px; }
  .inputrow .combo:nth-of-type(2) { margin-right: 0; }
  .inputrow .input { flex: 1 1 60%; height: 36px; font-size: 16px; }
  .inputrow .tkbtn { height: 36px; }
  .settings { right: 0; left: 0; width: 100%; top: 0; bottom: 0; max-height: none; position: fixed; box-shadow: none; }
  .settings .body { flex: 1 1 auto; }
  .settings .body.two, .settings .body.two.appear { grid-template-columns: 1fr; padding: 10px 14px; align-content: start; }
  .settings .body.two > .col:first-child { padding: 8px 0; }
  .settings label.chk { white-space: normal; }
  .settings .cgrid { grid-template-columns: 1fr; }
  .settings .tabs { overflow-x: auto; padding: 6px 6px 0; }
  .settings .tabs button { white-space: nowrap; flex: 1 1 auto; padding: 3px 3px 4px; font-size: 12px; }
  /* 16px stops iPhone zooming in when a box is tapped; keyword boxes grow to fit their text */
  .settings textarea, .settings .entry, .settings select { font-size: 16px; }
  .settings textarea { resize: none; overflow: hidden; min-height: 60px; }
  /* Save sits clear of the iPhone home bar, as a full-size raised button */
  .settings .save { height: 42px; margin: 8px 10px calc(12px + env(safe-area-inset-bottom)); font-size: 16px;
    box-shadow: inset 1px 1px 0 var(--btn-light), inset -1px -1px 0 var(--btn-dark), inset -2px -2px 0 rgba(0,0,0,.35); }
  .dlg.summary, .dlg.rules { width: 100%; height: 100%; max-width: 100%; max-height: 100%; }
  .toc { display: none; }
  .rtop { flex-wrap: wrap; }
  .kv2 .k { width: 40%; }
  .manualbar { margin: 0 6px 4px; }
  .favtip { margin: 0 6px 4px; flex-wrap: wrap; font-size: 13px; }
  .favtip span { padding: 2px 4px; }
  .favtip .tkbtn { height: 28px; }
}

/* ---------- find bar ---------- */
.findbar { display: none; align-items: center; gap: 4px; margin: 0 10px 4px; flex: none; }
.findbar.show { display: flex; }
.findbar input { flex: 1 1 auto; min-width: 0; height: 28px; background: var(--entry-bg); color: var(--entry-fg); border: 2px solid; border-color: #6b6b6b #e3e3e3 #e3e3e3 #6b6b6b; padding: 0 6px; outline: 0; }
.findbar .count { width: 64px; text-align: center; }
.findbar .tkbtn { width: 34px; padding: 0; height: 28px; }
mark { background: #ffd54a; color: #000; }
mark.cur { background: #ff8a00; }

/* ---------- empty / sign-in state in the feed ---------- */
.empty { color: var(--comment-fg); opacity: .85; padding: 24px 10px; font-size: var(--ui-size); line-height: 1.6; max-width: 560px; }
.empty b { font-weight: 700; }
.empty .tkbtn { margin-top: 12px; }

/* ---------- league selector (first run) ---------- */
.leaguepick { position: fixed; inset: 0; z-index: 45; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.55); }
.leaguepick.show { display: flex; }
.leaguepick .card { background: #141414; color: #fff; width: min(400px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; padding: 18px 50px 20px; text-align: center; }
.leaguepick h3 { margin: 4px 0 8px; font-size: 18.67px; }
.leaguepick p { margin: 0 0 12px; font-size: 16px; }
.leaguepick .lg { display: flex; align-items: center; justify-content: center; gap: 10px; height: 40px; color: #fff; font-size: 24px; font-weight: 700; }
.leaguepick .sel { width: 100%; margin: 6px 0 16px; height: 32px; background: #333; color: #fff; border: 1px solid #b4b4b4; cursor: pointer; }
.leaguepick .sel:hover { background: #c0c0c0; color: #000; }


/* hidden means hidden, whatever display a class sets */
[hidden] { display: none !important; }

/* ---------- Reddit URL box ---------- */
.manualbar { display: flex; align-items: center; gap: 0; margin: 0 10px 5px; flex: none; }
.manualbar span { margin-right: 5px; }
.manualbar .entry { flex: 1 1 auto; min-width: 0; height: 30px; margin: 0 5px; background: var(--entry-bg); color: var(--entry-fg); border: 2px solid; border-color: #6b6b6b #e3e3e3 #e3e3e3 #6b6b6b; padding: 0 10px; outline: 0; }
.manualbar .tkbtn { margin: 0 0 0 5px; }

/* ---------- Favorite Team tip ---------- */
.favtip { display: flex; align-items: center; margin: 0 10px 10px; flex: none; }
.favtip span { padding: 4px 5px 4px 10px; }
.favtip .tkbtn { margin-right: 5px; }
.favtip #favtipClose, .favtip #hometipClose { width: 34px; padding: 0; }
#hometip { flex-wrap: nowrap; }
#hometip span { flex: 1 1 auto; }

/* the reply indicator sits under the input row, lined up with the text box */
.replybar { margin: -8px 10px 5px; padding-left: 330px; }
.replybar .x { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 4px; }
body.feedonly .replybar { padding-left: 170px; }
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  /* phones: "Replying to" sits right above the reply box so it stays in view over the keyboard */
  .replybar, body.feedonly .replybar { order: 1; margin: 0 6px 4px; padding-left: 4px; min-width: 0; white-space: nowrap; }
  .replybar .u { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .replybar .x { margin-left: auto; height: 28px; width: 36px; font-size: 16px; }
  .inputrow { order: 2; }
  /* the on-screen keyboard: the app is pinned to the visible area (see visualViewport in app.js) */
  .app { position: fixed; left: 0; right: 0; top: 0; transform: translateY(var(--app-top, 0px)); }
  body.kbd .app { padding-bottom: 0; }
}

.threadbar #upgradeBtn { margin-left: auto; margin-right: 0; }
.caret { width: 22px; padding: 0; display: inline-grid; place-items: center; margin-left: -5px !important; }
body.feedonly .commentframe { margin-top: 10px; }
.exitfeed { position: absolute; top: 6px; right: 10px; z-index: 5; height: 30px; padding: 0 10px; opacity: .9; }

/* ================= phones: modern skin =================
   Computers keep the desktop app's Windows look; phones get flat, rounded
   controls with 44pt tap targets and bottom sheets. Colors still come from the theme. */
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  :root { --radius: 12px; --hair: color-mix(in srgb, var(--fg) 16%, transparent); --ui-font: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
  .tkbtn, .combo, .tab, .menu, .input, .dlg, .favtip, .status, .replybar { font-family: var(--ui-font); }

  /* buttons: flat, rounded, press = dim */
  .tkbtn { border-radius: 10px; box-shadow: none !important; font-weight: 600; font-size: 15px; }
  .tkbtn:active, .tkbtn.pressed { background: var(--button-bg); opacity: .6; }
  .tkbtn:disabled { opacity: .45; color: var(--button-fg); }
  .tkbtn:disabled:active { box-shadow: none; opacity: .45; }
  .tkbtn.on { background: var(--accent); color: #000; }
  .threadbar { padding: 8px 4px 6px; row-gap: 8px; }
  .threadbar .tkbtn { height: 42px; font-size: 14px; font-weight: 500; padding: 0 4px; }
  .threadbar .morebtn { height: 36px; width: 44px; border-radius: 18px; }
  .headerbar .morebtn { width: 44px; height: 36px; border-radius: 18px; margin-right: 6px !important; background: color-mix(in srgb, var(--banner-fg) 18%, transparent); color: var(--banner-fg); }
  .caret { margin-left: -2px !important; border-top-left-radius: 0; border-bottom-left-radius: 0; }
  #preloadBtn:not([hidden]) + .caret { border-left: 1px solid color-mix(in srgb, var(--button-fg) 25%, transparent); }
  #preloadBtn { border-top-right-radius: 0; border-bottom-right-radius: 0; }

  /* thread box: a rounded field with a chevron */
  .combo { border: 1px solid var(--hair); border-radius: var(--radius); overflow: hidden; }
  .thread-combo { height: 44px; }
  .thread-combo select { font-size: 16px; padding: 0 36px 0 12px; }
  .combo::after { background: transparent; border-left: 0; width: 34px; }
  .combo::before { right: 14px; margin-top: -4px; width: 8px; height: 8px; border: 0; border-right: 2px solid var(--entry-fg); border-bottom: 2px solid var(--entry-fg); transform: rotate(45deg); }

  /* tabs: pill chips */
  .tabstrip { gap: 6px; padding: 8px 8px 0; align-items: center; }
  .tab { height: 34px; border-radius: 17px; padding: 0 12px 0 14px; min-width: 0; font-size: 14px; font-weight: 600; }
  .tabstrip .tkbtn { width: 34px; height: 34px; border-radius: 17px; padding: 0; font-size: 18px; }

  /* team banner and the comment feed as rounded cards */
  .headerbar { border-radius: var(--radius); margin: 0 8px 6px; padding: 4px 0; }
  .headerbar .sub { padding-left: 14px; font-weight: 700; }
  .headerbar .score { padding: 0 14px 6px; font-weight: 600; }
  .commentframe { margin: 0 8px 6px; }
  .commentbox { border: 1px solid var(--hair); border-radius: var(--radius); padding: 6px 10px; }
  .counts .box { border-radius: 8px; border-color: var(--hair); font-weight: 600; }
  .counts .meter { border-radius: 4px; border-color: var(--hair); overflow: hidden; }
  .status { font-size: 14px; }

  /* reply box: a pill field and a round-cornered send button */
  .inputrow { padding: 0 8px 8px; gap: 8px; }
  .inputrow .input { height: 44px; border: 1px solid var(--hair); border-radius: 22px; padding: 0 16px; margin-right: 0; }
  .inputrow .input:focus { border-color: color-mix(in srgb, var(--fg) 45%, transparent); }
  .inputrow .tkbtn { height: 44px; border-radius: 22px; padding: 0 18px; margin: 0; }
  .replybar { font-size: 14px; }
  .favtip { border-radius: var(--radius); background: color-mix(in srgb, var(--fg) 8%, transparent); margin: 0 8px 8px; padding: 6px 6px 6px 4px; font-size: 14px; }
  .favtip .tkbtn { height: 34px; border-radius: 17px; }
  .favtip #favtipClose, .favtip #hometipClose { width: 34px; }
  .exitfeed { border-radius: 18px; height: 36px; }

  /* the ⋮ menu: a bottom sheet */
  .menu { left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto; max-height: 75%;
    border: 0; border-radius: 16px 16px 0 0; padding: 18px 0 calc(10px + env(safe-area-inset-bottom)); font-size: 16px;
    box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .menu::before { content: ""; position: absolute; top: 7px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: var(--hair); }
  .menu .row { height: 48px; padding-left: 20px; }
  .menu .row:not(:has(.pin)) { padding-right: 20px; }
  .menu .row:hover { background: none; }
  .menu .row:active { background: var(--button-bg); }
  .menu hr { border-top-color: var(--hair); margin: 6px 16px; }
  .menu .pin { width: 56px; }
  .menu .pin i { width: 14px; height: 14px; }

  /* lists (threads, speed, TV Delay): bottom sheets */
  .dlg-back:has(.dlg.picker) { align-items: flex-end; background: rgba(0,0,0,.45); }
  .dlg.picker { width: 100%; max-width: 100%; height: auto; max-height: 85%; border: 0; border-radius: 16px 16px 0 0; box-shadow: none; padding-bottom: env(safe-area-inset-bottom); }
  .picker .titlebar { height: 52px; padding: 0 6px 0 18px; background: transparent; color: var(--fg); font-size: 17px; font-weight: 700; }
  .picker .titlebar img { display: none; }
  .picker .titlebar button { width: 36px; height: 36px; border-radius: 18px; background: var(--button-bg); color: var(--fg); font-size: 14px; }
  .picker .titlebar button:hover { background: var(--button-bg); color: var(--fg); }
  .picker .pick-find { margin: 0 14px 8px; height: 40px; border: 1px solid var(--hair); border-radius: 10px; padding: 0 12px; }
  .picker .pick-row { padding: 14px 18px; border-bottom: 1px solid var(--hair); font-family: var(--ui-font); }
  .picker .pick-row.on { background: transparent; color: var(--fg); }
  .picker .pick-row.on::after { content: "✓"; float: right; margin-left: 10px; font-weight: 700; }
  .picker .pick-sep { padding: 14px 18px 6px; border-bottom: 0; font-family: var(--ui-font); }
  .picker .pick-list { min-height: 0; }
}
/* phones sideways: short screen, so the thread box and buttons share one row,
   and nothing sits under the notch */
@media (pointer: coarse) and (max-height: 500px) and (min-width: 561px) {
  .app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .threadbar { flex-wrap: nowrap; }
  .thread-combo { flex: 1 1 auto; min-width: 160px; }
  .threadbar .tkbtn { flex: none; padding: 0 12px; }
  #refreshBtn, #settingsBtn { width: 44px; }
}

/* ================= phones: modern Settings and dialogs ================= */
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  .settings { --card: color-mix(in srgb, var(--fg) 7%, var(--bg)); --muted: color-mix(in srgb, var(--fg) 58%, transparent);
    background: var(--bg); color: var(--fg); font-family: var(--ui-font); font-size: 16px; }
  .settings .titlebar { height: 56px; padding: 0 10px 0 18px; background: transparent; color: var(--fg); font-size: 22px; font-weight: 700; }
  .settings .titlebar img { display: none; }
  .settings .titlebar button { width: 36px; height: 36px; border-radius: 18px; background: var(--button-bg); color: var(--fg); font-size: 14px; }
  .settings .titlebar button:hover { background: var(--button-bg); color: var(--fg); }

  /* tabs: a segmented control */
  .settings .tabs { margin: 0 8px 6px; padding: 2px; gap: 0; border-radius: 10px; background: var(--card); scrollbar-width: none; }
  .settings .tabs::-webkit-scrollbar { display: none; }
  .settings .tabs button { top: 0; border: 0; margin: 0; border-radius: 8px; background: transparent; color: var(--fg); padding: 7px 3px; font-size: 12px; font-weight: 600; letter-spacing: -.01em; }
  .settings .tabs button.on { background: var(--button-bg); color: var(--button-fg); font-weight: 700; padding-bottom: 7px; box-shadow: 0 1px 3px rgba(0,0,0,.3); }

  /* the page: grouped cards on the app background */
  .settings .body, .settings .body.two, .settings .body.two.appear { margin: 0; border: 0; background: transparent; padding: 0 14px 16px; }
  .settings .body > .col, .settings .body.two > .col:first-child { background: transparent; padding: 0; }
  .settings h4, .settings h4.gap { margin: 20px 4px 7px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .settings h4:first-child { margin-top: 10px; }
  .settings .note, .settings .tnote { font-weight: 400; font-size: 13px; color: var(--muted); margin: 8px 4px 0; max-width: none; }

  /* checkboxes: full-width rows with iPhone switches */
  .settings label.chk { display: flex; align-items: center; gap: 6px; min-height: 50px; margin: 0 0 8px; padding: 6px 14px; flex-wrap: nowrap;
    background: var(--card); border-radius: 12px; white-space: normal; font-size: 16px; }
  .settings label.chk b { font-weight: 500; }
  .settings label.chk span { color: var(--muted); font-size: 14px; }
  .settings label.chk.off { color: var(--muted); }
  .settings .checks, .settings .opts { display: flex; flex-direction: column; align-items: stretch; gap: 0; margin: 0 0 8px; padding: 0 14px; background: var(--card); border-radius: 12px; }
  .settings .checks label.chk, .settings .opts label.chk { margin: 0; padding: 6px 0; border-radius: 0; background: transparent; border-bottom: 1px solid var(--hair); }
  .settings .checks label.chk:last-child, .settings .opts label.chk:last-child { border-bottom: 0; }
  .settings .col > button + label.chk { width: auto; display: flex; margin-top: 8px; }
  .settings label.chk input {
    order: 9; margin: 0 0 0 auto; width: 51px; height: 31px; border: 0; border-radius: 16px; flex: none; transition: background-color .2s;
    background: radial-gradient(circle at 15.5px 50%, #fff 0 13px, transparent 13.5px), color-mix(in srgb, var(--fg) 22%, transparent);
  }
  .settings label.chk input:checked { background: radial-gradient(circle at 35.5px 50%, #fff 0 13px, transparent 13.5px), #34C759; }
  .settings label.chk input:disabled { opacity: .4; border: 0; }

  /* fields */
  .settings .combo, .settings .entry, .settings textarea { border: 1px solid var(--hair); border-radius: 10px; }
  .settings .combo, .settings .entry { height: 44px; }
  .settings .col > .combo, .settings h4 + .combo { margin-bottom: 8px; }
  .settings .combo select { padding-left: 12px; font-size: 16px; }
  .settings .entry { padding: 0 12px; }
  .settings .entry.wide { background: var(--entry-bg); color: var(--entry-fg); }
  .settings textarea { padding: 8px 12px; margin: 0 0 8px; }
  .settings .fontrow .combo { margin-right: 8px; }
  .settings .size { width: 36px; font-size: 17px; font-weight: 600; }
  .settings .sq { width: 36px; height: 36px; border-radius: 18px; margin-left: 6px; font-size: 12px; }
  .settings .tkbtn { height: 40px; }
  .settings .col > .tkbtn { margin: 0 0 8px; }
  .settings input[type=range] { height: 4px; margin: 18px 4px 14px; width: calc(100% - 8px); border: 0; border-radius: 2px; background: var(--hair); }
  .settings input[type=range]::-webkit-slider-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
  .settings input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #fff; }

  /* Live / Post-Game: segmented */
  .settings .switch { gap: 2px; padding: 3px; margin: 4px 0 8px; border-radius: 10px; background: var(--card); }
  .settings .switch .tkbtn { flex: 1 1 0; height: 36px; border-radius: 8px; background: transparent; color: var(--fg); }
  .settings .switch .tkbtn.on { background: var(--button-bg); color: var(--button-fg); box-shadow: 0 1px 3px rgba(0,0,0,.3); }

  /* Theme Editor colors */
  .settings .crow { justify-content: space-between; height: 46px; margin: 0; border-bottom: 1px solid var(--hair); }
  .settings .crow .tkbtn { display: none; }
  .settings .crow .swatch { cursor: pointer; margin-right: 0; }
  .settings .tedit-top { flex-wrap: wrap; gap: 8px; margin: 10px 0; }
  .settings .tedit-top b { flex: 1 1 100%; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 6px 4px 0; }
  .settings .tedit-top .combo, .settings .tedit-top .entry { flex: 1 1 150px; width: auto; margin: 0; }
  .settings .tedit-top .tkbtn { margin: 0; padding: 0 14px; height: 44px; }
  .settings .colorrow b.second { margin-left: 0; }
  .settings label.chk:has(> span) { flex-wrap: wrap; }
  .settings label.chk > span { order: 10; flex: 1 1 100%; margin-top: -8px; }
  .settings .crow b { text-align: left; font-weight: 500; }
  .settings .swatch { width: 64px; height: 30px; border-radius: 8px; border: 1px solid var(--hair); }
  .settings .colorrow .swatch { width: 56px; }
  .settings .license h3 { font-size: 20px; }
  .settings .license p { font-weight: 400; color: var(--muted); }

  /* Save: a blue pill */
  .settings .save { background: #0A84FF; color: #fff; border-radius: 12px; box-shadow: none; font-weight: 600; font-size: 17px; height: 48px; }
  .settings .save:active { background: #0A84FF; opacity: .7; }

  /* pop-up messages: iPhone alerts */
  .dlg.msg { background: color-mix(in srgb, var(--fg) 10%, var(--bg)); color: var(--fg); min-width: 0; width: min(300px, calc(100% - 48px)); border: 0; border-radius: 14px; overflow: hidden; text-align: center; font-family: var(--ui-font); }
  .msg-title { padding: 20px 16px 0; font-weight: 700; font-size: 17px; }
  .msg-body { flex-direction: column; align-items: center; gap: 8px; padding: 6px 16px 18px; font-size: 14px; }
  .msg-icon { display: none; }
  .msg-foot { background: transparent; padding: 0; gap: 0; border-top: 1px solid var(--hair); }
  .msgbtn { flex: 1 1 0; height: 46px; border: 0; border-radius: 0; background: transparent; color: #0A84FF; font-size: 17px; font-weight: 600; }
  .msgbtn + .msgbtn { border-left: 1px solid var(--hair); font-weight: 400; }
  .msgbtn:focus { outline: 0; }

  /* Game Summary and Rules: full-screen pages; Upgrade: a card. Plain headings on all three */
  .dlg.summary, .dlg.rules, .dlg.upgrade { border: 0; font-family: var(--ui-font); }
  .dlg.summary, .dlg.rules { box-shadow: none; }
  .dlg.upgrade { width: calc(100% - 24px); border-radius: 16px; overflow: hidden; background: color-mix(in srgb, var(--fg) 10%, var(--bg)); box-shadow: 0 10px 40px rgba(0,0,0,.6); } /* a card: tapping around it closes it */
  .dlg-back { background: rgba(0,0,0,.55); }
  .dlg-title { padding: 16px 18px 10px; font-size: 20px; font-weight: 700; background: transparent; color: var(--fg); border: 0; }
  .dlg .foot, .rfoot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .dlg .foot .tkbtn, .rfoot .tkbtn { width: 100%; height: 48px; border-radius: 12px; font-size: 17px; }
  .dlg .box { border-radius: 12px; overflow: hidden; }
  .up input { height: 44px; border: 1px solid var(--hair); border-radius: 10px; font-size: 16px; }
  .up .learn, .up .verify { height: 46px; border-radius: 12px; width: 100%; max-width: 340px; }
}
