/* Defluffed — quiet, print-like utility design: paper, ink, one vermilion accent. */
:root {
  --paper: #f7f6f2; --card: #ffffff; --ink: #1c1b19; --ink-2: #4a4843; --muted: #7a776f; --rule: #e3e0d8; --rule-2: #cfcbc0;
  --accent: #c8452c; --accent-soft: #f6e6e1; --field: #fbfaf7; --ok: #2f7a4b; --warn: #9a5b00;
  --radius: 8px; --max: 1000px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #141412; --card: #1b1b19; --ink: #ecebe6; --ink-2: #c4c2bb; --muted: #8f8c84; --rule: #2d2c29; --rule-2: #3d3b37; --accent: #e0654b; --accent-soft: #3a211b; --field: #171715; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); font-feature-settings: "tnum" 1; }
a { color: var(--ink); text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
[hidden] { display: none !important; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

header.site { border-bottom: 1px solid var(--rule); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }
.logo { font-weight: 700; font-size: 18px; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.logo b { color: var(--accent); font-weight: 700; }
nav.top { display: flex; gap: 18px; font-size: 14px; }
nav.top a { color: var(--ink-2); text-decoration: none; }
nav.top a:hover { color: var(--ink); }
@media (max-width: 640px) { nav.top .hide-sm { display: none; } nav.top { gap: 14px; } }

.crumbs { font-size: 13px; color: var(--muted); padding-top: 16px; }
.crumbs a { color: var(--muted); }
.hero { padding: 28px 0 4px; }
.hero h1 { font-size: clamp(28px, 4.2vw, 40px); line-height: 1.12; margin: 0 0 8px; letter-spacing: -.025em; font-weight: 700; }
.hero p { color: var(--ink-2); margin: 0; max-width: 640px; font-size: 17px; }
.nofluff { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.nofluff li::before { content: "No "; }

.tool { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; margin: 22px 0; }
@media (max-width: 640px) { .tool { padding: 16px; } }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-2); min-width: 0; }
.field.grow { flex: 1 1 220px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
input[type=text], input[type=number], input[type=url], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--field); border: 1px solid var(--rule-2); border-radius: 6px; padding: 9px 11px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 160px; line-height: 1.55; }
input[type=color] { width: 46px; height: 40px; padding: 3px; border: 1px solid var(--rule-2); border-radius: 6px; background: var(--field); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
input[type=range] { accent-color: var(--accent); }
button, .btn { font: inherit; font-size: 15px; font-weight: 600; border: 1px solid var(--ink); border-radius: 6px; padding: 9px 16px; cursor: pointer; background: var(--ink); color: var(--paper); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.3; }
button:hover, .btn:hover { background: #000; }
@media (prefers-color-scheme: dark) { button:hover, .btn:hover { background: #fff; } }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule-2); }
button.ghost:hover, .btn.ghost:hover { border-color: var(--ink); background: transparent; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #b33b24; }
button:disabled { opacity: .4; cursor: default; }
.big-btn { font-size: 18px; padding: 12px 26px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule-2); border-radius: 6px; overflow: hidden; margin-bottom: 16px; }
.seg button { background: transparent; color: var(--ink-2); border: 0; border-right: 1px solid var(--rule-2); border-radius: 0; font-weight: 500; padding: 7px 13px; font-size: 14px; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg button:hover { background: var(--field); }
.seg button[aria-pressed="true"]:hover { background: var(--ink); }
.result { font-family: var(--mono); font-size: clamp(34px, 8vw, 68px); font-weight: 600; letter-spacing: -.03em; text-align: center; margin: 14px 0; word-break: break-word; line-height: 1.08; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: center; }
.sub { color: var(--ink-2); text-align: center; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); margin-top: 16px; }
.stat { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 10px 12px; }
.stat b { display: block; font-family: var(--mono); font-size: 24px; font-weight: 600; line-height: 1.15; }
.stat span { font-size: 12px; color: var(--muted); }
.note { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.warn { color: var(--warn); font-size: 14px; padding-left: 18px; }
.warn:empty { display: none; }
.privacy { font-size: 13px; color: var(--muted); margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); }
.history { list-style: none; padding: 0; margin: 12px 0 0; font-family: var(--mono); font-size: 13px; color: var(--muted); max-height: 140px; overflow: auto; }
.history li { padding: 3px 0; border-bottom: 1px dotted var(--rule); }
.history:empty { display: none; }

.ad { margin: 24px auto; min-height: 100px; text-align: center; }
article { max-width: 720px; }
article h2 { font-size: 21px; margin: 36px 0 8px; letter-spacing: -.015em; }
article h3 { font-size: 17px; margin: 20px 0 6px; }
article p, article li { color: var(--ink-2); }
article ol, article ul { padding-left: 22px; }
details { border-top: 1px solid var(--rule); padding: 12px 0; }
details:last-of-type { border-bottom: 1px solid var(--rule); }
summary { cursor: pointer; font-weight: 600; color: var(--ink); }
details p { margin: 8px 0 0; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { border-bottom: 1px solid var(--rule); padding: 8px 10px 8px 0; text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; padding: 0; list-style: none; }
.chips a { display: inline-block; padding: 5px 11px; border: 1px solid var(--rule-2); border-radius: 999px; text-decoration: none; color: var(--ink-2); font-size: 14px; }
.chips a:hover { border-color: var(--ink); color: var(--ink); }

/* Home */
.cat { margin-top: 30px; }
.cat h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); border-top: 1px solid var(--rule); }
.list a { display: flex; flex-direction: column; padding: 13px 4px 13px 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); margin-right: 24px; }
.list a strong { font-weight: 600; }
.list a small { color: var(--muted); font-size: 13px; }
.list a:hover strong { color: var(--accent); }

.share { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.share-label { color: var(--muted); font-size: 14px; margin-right: 4px; }
.share .sh { font: inherit; font-size: 13px; font-weight: 500; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--rule-2); background: transparent; color: var(--ink-2); text-decoration: none; cursor: pointer; }
.share .sh:hover { border-color: var(--ink); color: var(--ink); background: transparent; }
.share .sh-native { border-color: var(--ink); color: var(--ink); }
.share-end { margin: 36px 0 8px; padding-top: 18px; border-top: 1px solid var(--rule); }

footer.site { margin-top: 64px; border-top: 1px solid var(--rule); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }
footer.site .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; }
footer.site h4 { margin: 0 0 8px; color: var(--ink); font-size: 13px; }
footer.site ul { list-style: none; margin: 0; padding: 0; }
footer.site li { margin: 4px 0; }
footer.site a { color: var(--muted); text-decoration: none; }
footer.site a:hover { color: var(--ink); }
.kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--rule-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }

/* Tool-specific */
.qr-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 760px) { .qr-grid { grid-template-columns: minmax(0, 1fr); } }
.qr-fields { display: flex; flex-wrap: wrap; gap: 10px; }
.qr-style { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); }
#qr-preview { display: flex; justify-content: center; }
#qr-preview canvas, #qr-preview svg { max-width: 100%; height: auto !important; border: 1px solid var(--rule); border-radius: 4px; }
.wheel-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 760px) { .wheel-grid { grid-template-columns: minmax(0, 1fr); } }
#wh-canvas { display: block; margin: 0 auto; cursor: pointer; max-width: 100%; }
.dice { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 14px 0; }
.die { display: inline-grid; place-items: center; min-width: 64px; height: 64px; border: 1.5px solid var(--ink); border-radius: 10px; font-family: var(--mono); font-size: 28px; font-weight: 600; background: var(--card); padding: 0 8px; }
.die.d6 { font-size: 54px; line-height: 1; border: 0; min-width: 0; }
.coin { width: 150px; height: 150px; margin: 10px auto; position: relative; transform-style: preserve-3d; cursor: pointer; }
.coin div { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 20px; backface-visibility: hidden; border: 1.5px solid var(--ink); }
.coin .h { background: #e6d3a3; color: #4a3b12; }
.coin .t { background: #cfd3d6; color: #2a2f33; transform: rotateY(180deg); }
.coin.flip-h { animation: flipH 1s ease-out forwards; }
.coin.flip-t { animation: flipT 1s ease-out forwards; }
@keyframes flipH { from { transform: rotateY(0); } to { transform: rotateY(1800deg); } }
@keyframes flipT { from { transform: rotateY(0); } to { transform: rotateY(1980deg); } }
.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.teams ol { margin: 6px 0 0; padding-left: 20px; }
.clock { font-family: var(--mono); font-size: clamp(56px, 16vw, 150px); font-weight: 600; letter-spacing: -.04em; text-align: center; line-height: 1; margin: 18px 0 8px; font-variant-numeric: tabular-nums; }
.clock.done { color: var(--accent); }
.bar { height: 4px; background: var(--rule); border-radius: 2px; overflow: hidden; margin: 10px 0 0; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s linear; }
.tool:fullscreen { display: flex; flex-direction: column; justify-content: center; border: 0; border-radius: 0; }
.tool:fullscreen .clock { font-size: 22vw; }
.laps { width: 100%; font-family: var(--mono); font-size: 14px; margin-top: 14px; }
.meter { height: 26px; background: var(--field); border: 1px solid var(--rule-2); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .05s; }
.meter i.hot { background: var(--accent); }
.kb { display: grid; gap: 4px; user-select: none; margin-top: 12px; }
.kb .r { display: flex; gap: 4px; }
.kb span { flex: 1 1 0; min-width: 0; height: 40px; display: grid; place-items: center; border: 1px solid var(--rule-2); border-radius: 5px; font-size: 12px; color: var(--ink-2); background: var(--field); white-space: nowrap; overflow: hidden; }
.kb span.w15 { flex-grow: 1.5; } .kb span.w18 { flex-grow: 1.8; } .kb span.w2 { flex-grow: 2.2; } .kb span.w25 { flex-grow: 2.6; } .kb span.w6 { flex-grow: 6.5; }
.kb span.hit { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.kb span.down { background: var(--accent); border-color: var(--accent); color: #fff; }
.typing { font-family: var(--mono); font-size: 22px; line-height: 1.7; color: var(--muted); min-height: 5.2em; max-height: 5.2em; overflow: hidden; position: relative; user-select: none; }
.typing .c { color: var(--ink); }
.typing .x { color: var(--accent); text-decoration: underline; }
.typing .cur { border-left: 2px solid var(--accent); margin-left: -1px; }
.video-box { background: #000; border-radius: 6px; overflow: hidden; aspect-ratio: 16/9; display: grid; place-items: center; }
.video-box video { width: 100%; height: 100%; object-fit: contain; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 640px) { .split { grid-template-columns: minmax(0, 1fr); } }
.calc-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 16px; }
.calc-line:last-child { border-bottom: 0; }
.calc-line input { width: 120px; }
.calc-line output { font-family: var(--mono); font-weight: 600; font-size: 20px; margin-left: auto; min-width: 110px; text-align: right; }
@media (max-width: 520px) { .calc-line output { margin-left: 0; width: 100%; text-align: left; } }
/* Segmented controls wrap cleanly as separate pills */
.seg { border: 0; border-radius: 0; overflow: visible; gap: 6px; }
.seg button { border: 1px solid var(--rule-2); border-radius: 999px; padding: 6px 13px; }
.seg button:last-child { border-right: 1px solid var(--rule-2); }
/* On narrow screens show the QR preview before the options */
@media (max-width: 760px) { .qr-grid > div:last-child { order: -1; } .qr-grid #qr-preview canvas { max-width: 240px; } }

/* Placeholder for camera boxes before the stream starts */
.video-box { background: var(--field); border: 1px solid var(--rule); position: relative; }
.video-box::before { content: attr(data-empty); position: absolute; color: var(--muted); font-size: 14px; }
.video-box:has(video[src]), .video-box.live { background: #000; border-color: #000; }
.video-box video { position: relative; z-index: 1; }
/* Timesheet rows: one compact line */
.tc-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tc-row select { width: 64px; }
.tc-row input { width: 84px; }
.tc-row span { color: var(--muted); font-size: 14px; }
/* Percentage lines stay on one line on phones */
@media (max-width: 520px) {
  .calc-line { font-size: 15px; gap: 6px; }
  .calc-line input { width: 76px; padding: 7px 8px; }
  .calc-line output { font-size: 18px; }
}
