/* Neo-brutalist theme: flat bright colours, thick black outlines, hard offset shadows. */
:root {
  --ink: #111111;
  --bg: #7b93ff;
  --surface: #ffffff;
  --surface-2: #fff9d6;
  --text: #111111;
  --muted: #3a3f55;
  --border: #111111;
  --accent: #6ff0d8;       /* mint: primary buttons, header */
  --accent-ink: #111111;
  --accent-soft: #f5f78a;  /* yellow: results */
  --lav: #d9a6ff;
  --pink: #ff9ec7;
  --sky: #8fd3ff;
  --peach: #ffc27a;
  --good: #3ddc97;
  --bad: #ff5a5f;
  --radius: 14px;
  --bw: 3px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(rgba(17, 17, 17, .13) 1.4px, transparent 1.4px);
  background-size: 22px 22px;
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { background: var(--accent-soft); }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--accent); border-bottom: var(--bw) solid var(--ink); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-top: 12px; padding-bottom: 12px; }
.logo { font-weight: 900; font-size: 1.2rem; letter-spacing: .02em; text-transform: uppercase; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.logo:hover { background: none; }
.logo-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border: var(--bw) solid var(--ink); border-radius: 9px; background: var(--accent-soft); box-shadow: var(--shadow-sm); font-size: 1rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 6px; font-size: .9rem; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 700; padding: 3px 10px; border: 2px solid transparent; border-radius: 999px; }
.site-nav a:hover { background: var(--surface); border-color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--accent-soft); border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }

/* Page */
main { padding-top: 22px; padding-bottom: 56px; }
.crumbs { font-size: .85rem; font-weight: 600; margin-bottom: 8px; }
.crumbs a { color: var(--ink); }
h1 {
  font-size: clamp(1.6rem, 4.6vw, 2.5rem);
  line-height: 1.15;
  margin: 0 0 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
h2 { font-size: 1.3rem; margin: 30px 0 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .03em; }
h3 { font-size: 1.05rem; margin: 22px 0 6px; font-weight: 800; }
.lead { font-size: 1.08rem; font-weight: 500; margin: 0 0 22px; max-width: 62ch; }

.card, .content, .faq, section.related {
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 0 0 26px;
}
.content > :first-child, .faq > :first-child, section.related > :first-child { margin-top: 0; }
.content > :last-child { margin-bottom: 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card.plain { box-shadow: none; }

/* Forms */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--ink); }
label.inline { flex-direction: row; align-items: center; gap: 10px; font-weight: 700; text-transform: none; letter-spacing: 0; font-size: .95rem; }
input, select, button, textarea { font: inherit; }
input[type="number"], input[type="date"], input[type="time"], input[type="text"], select {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: var(--bw) solid var(--ink);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--ink); flex: none; }
input:focus-visible, select:focus-visible, button:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--accent-soft);
}
::placeholder { color: #6a6f85; font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 20px;
  border-radius: 10px; border: var(--bw) solid var(--ink);
  background: var(--accent); color: var(--ink);
  font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.secondary { background: var(--surface); }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .8rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab { border: var(--bw) solid var(--ink); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 7px 16px; cursor: pointer; font-weight: 800; font-size: .9rem; text-transform: uppercase; letter-spacing: .03em; box-shadow: 2px 2px 0 var(--ink); }
.tab[aria-selected="true"] { background: var(--lav); box-shadow: none; transform: translate(2px, 2px); }
[hidden] { display: none !important; }

/* Results */
.result {
  margin-top: 20px;
  padding: 18px;
  border: var(--bw) solid var(--ink);
  border-radius: 12px;
  background: var(--accent-soft);
}
.result-label { font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.result-big { font-size: clamp(1.4rem, 4.5vw, 2.1rem); font-weight: 900; line-height: 1.25; margin: 2px 0; overflow-wrap: anywhere; }
.result-sub { color: var(--muted); font-weight: 500; }
.result.hero { margin: 0 0 20px; background: var(--lav); box-shadow: var(--shadow-sm); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 18px 0 0; }
.facts div { background: var(--surface); border: 2px solid var(--ink); border-radius: 10px; padding: 8px 12px; }
.facts dt { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.facts dd { margin: 0; font-weight: 800; }
.note { font-size: .88rem; color: var(--muted); }

/* Tables */
.table-scroll { overflow-x: auto; border: 2px solid var(--ink); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 9px 12px; border-bottom: 2px solid var(--ink); text-align: left; vertical-align: middle; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
th { background: var(--accent-soft); font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:nth-child(even) td { background: #faf6e6; }
.timecard td input { min-width: 96px; }
.timecard td.num, .timecard th.num { text-align: right; white-space: nowrap; }
td.num, th.num { text-align: right; }
.dur-row { display: grid; grid-template-columns: 64px repeat(4, minmax(56px, 1fr)) 44px; gap: 8px; align-items: end; margin-bottom: 8px; }
.icon-btn { min-height: 46px; border: var(--bw) solid var(--ink); background: var(--pink); color: var(--ink); border-radius: 10px; cursor: pointer; font-weight: 900; box-shadow: 2px 2px 0 var(--ink); }
.icon-btn:active { transform: translate(2px, 2px); box-shadow: none; }

/* Content */
.content p, .content li { max-width: 72ch; }
.content code { background: var(--accent-soft); border: 2px solid var(--ink); padding: 0 6px; border-radius: 6px; font-weight: 600; }
.faq h2, section.related h2 { margin-top: 0; }
.faq details { border: 2px solid var(--ink); border-radius: 10px; background: var(--surface-2); padding: 12px 14px; margin-top: 10px; }
.faq summary { cursor: pointer; font-weight: 800; }
.faq details[open] { background: var(--sky); }
.faq details p { margin: 10px 0 0; }

.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; padding: 0; list-style: none; font-size: .93rem; }
.link-grid a { font-weight: 600; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.tool-card {
  display: block; text-decoration: none; color: var(--ink);
  background: var(--accent-soft); border: var(--bw) solid var(--ink); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  transition: transform .1s ease, box-shadow .1s ease;
}
.tool-card:nth-child(6n+2) { background: var(--lav); }
.tool-card:nth-child(6n+3) { background: var(--accent); }
.tool-card:nth-child(6n+4) { background: var(--pink); }
.tool-card:nth-child(6n+5) { background: var(--sky); }
.tool-card:nth-child(6n+6) { background: var(--peach); }
.tool-card:hover { transform: translate(-3px, -3px); box-shadow: 8px 8px 0 var(--ink); background-color: inherit; }
.tool-card strong { display: block; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.tool-card span { font-weight: 500; font-size: .92rem; }

.sr-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Text tools */
textarea {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border: var(--bw) solid var(--ink);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  resize: vertical;
}
.big-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.big-stat { background: var(--lav); border: var(--bw) solid var(--ink); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow-sm); }
.big-stat:nth-child(2) { background: var(--accent); }
.big-stat b { display: block; font-size: clamp(1.7rem, 5vw, 2.3rem); line-height: 1.1; font-weight: 900; }
.big-stat span { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.limit { margin: 12px 0; }
.limit-row { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; font-weight: 600; }
.bar { height: 14px; border: 2px solid var(--ink); border-radius: 99px; background: var(--surface); overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--good); border-right: 2px solid var(--ink); }
.limit.over .bar i { background: var(--bad); }
.limit.over .limit-row span:last-child { font-weight: 900; text-decoration: underline wavy var(--bad); }

/* Wheel */
.wheel-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.wheel-box { text-align: center; }
.wheel-box canvas { width: 100%; max-width: 460px; aspect-ratio: 1; cursor: pointer; display: block; margin: 0 auto; touch-action: manipulation; }
.winner { margin-top: 14px; text-align: left; }
.winner .result-big { min-height: 1.3em; }
.history { margin: 8px 0 0; padding-left: 22px; color: var(--muted); font-size: .92rem; }
.history li:first-child { color: var(--ink); font-weight: 800; }
@media (max-width: 720px) { .wheel-layout { grid-template-columns: 1fr; } }

/* Random numbers & dice */
.rng-out { font-size: clamp(2.6rem, 12vw, 4.5rem); font-weight: 900; line-height: 1.1; overflow-wrap: anywhere; }
.rng-out.many { font-size: clamp(1.2rem, 4vw, 1.6rem); font-weight: 800; }
.pop { animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.92); opacity: .4; } to { transform: none; opacity: 1; } }
.dice { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; min-height: 72px; margin: 6px 0 8px; }
.die { display: inline-grid; place-items: center; min-width: 64px; height: 64px; padding: 0 8px; border-radius: 12px; background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: var(--shadow-sm); font-size: 1.8rem; font-weight: 900; }
.die.d6 { font-size: 3.6rem; line-height: 1; border: 0; background: none; box-shadow: none; min-width: 0; padding: 0; }
.rolling .die { animation: roll .35s ease-out; }
@keyframes roll { 0% { transform: rotate(-25deg) scale(.8); } 60% { transform: rotate(10deg) scale(1.05); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .pop, .rolling .die, .btn, .tool-card { animation: none; transition: none; } }
.home-section { margin-top: 30px; }
.home-section h2 { margin-top: 0; display: inline-block; background: var(--surface); border: var(--bw) solid var(--ink); border-radius: 10px; padding: 4px 14px; box-shadow: var(--shadow-sm); margin-bottom: 18px; }

/* Footer */
.site-footer { border-top: var(--bw) solid var(--ink); background: var(--accent-soft); font-size: .9rem; font-weight: 600; }
.site-footer .wrap { padding-top: 20px; padding-bottom: 28px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer a { color: var(--ink); }

@media (max-width: 720px) {
  .site-nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { white-space: nowrap; }
}
@media (max-width: 560px) {
  .card, .content, .faq, section.related { padding: 16px; box-shadow: 4px 4px 0 var(--ink); }
  .dur-row { grid-template-columns: repeat(3, 1fr); padding-bottom: 10px; border-bottom: 2px dashed var(--ink); }
}

.content.plain { background: none; border: 0; box-shadow: none; padding: 0; border-radius: 0; }
.content.plain > h2:not(.home-section h2) { display: inline-block; background: var(--surface); border: var(--bw) solid var(--ink); border-radius: 10px; padding: 4px 14px; box-shadow: var(--shadow-sm); }
.content.plain > p, .content.plain > ul { background: var(--surface); border: var(--bw) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; max-width: none; }
.content.plain > ul.link-grid { padding: 16px 20px; }
