/* OnlineDiceRoller.com – single lightweight stylesheet (no framework) */
:root {
  --accent: #ff9800;
  --accent-dark: #e68900;
  --accent-text: #b25e00;
  --ink: #1d1f21;
  --muted: #5a6168;
  --bg: #ffffff;
  --bg-soft: #f3f4f6;
  --line: #e2e5e9;
  --dark: #111315;
  --radius: 10px;
  --wrap: 960px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

img { max-width: 100%; height: auto; }

a { color: var(--accent-text); }
a:hover, a:focus { color: var(--ink); }

h1, h2, h3 { line-height: 1.25; margin: 1.6em 0 .5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-top: .4em; }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); }
h3 { font-size: 1.15rem; }

p, ul, ol, table { margin: 0 0 1em; }

code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 .3em;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #000; padding: .5em 1em; z-index: 10;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- header / navigation ---------- */
.site-header { background: var(--dark); color: #fff; }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .25rem 1rem; padding-top: .6rem; padding-bottom: .6rem;
}
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.brand:hover, .brand:focus { color: var(--accent); }
.nav { list-style: none; display: flex; flex-wrap: wrap; gap: .1rem .9rem; margin: 0; padding: 0; }
.nav a { color: #e9eaec; text-decoration: none; font-size: .95rem; padding: .25rem 0; display: inline-block; }
.nav a:hover, .nav a:focus, .nav a[aria-current="page"] { color: var(--accent); }

/* ---------- dice tool ---------- */
.hero {
  background: #222 url("../images/dice/dices.jpg") center / cover no-repeat;
  color: #fff;
}
.hero-inner { background: rgba(0, 0, 0, .62); }
.hero h1 { margin: 0; padding-top: 1.2rem; }
.hero .lead { margin: .3rem 0 1rem; color: #eee; max-width: 46rem; }
.hero .lead code { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .35); color: #fff; }

.roller {
  background: #fff; color: var(--ink);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 1.4rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
.roller-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.roller-form label { display: block; font-size: .85rem; color: var(--muted); font-weight: 600; }
.roller-form .field { flex: 1 1 12rem; }
.roller-form input[type="text"] {
  width: 100%; font: inherit; font-size: 1.1rem; padding: .5rem .65rem;
  border: 2px solid var(--line); border-radius: 8px;
}
.roller-form input[type="text"]:focus { outline: 3px solid var(--ink); outline-offset: 1px; border-color: var(--accent-dark); }

.btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 999px;
  background: var(--accent); color: #000; padding: .6rem 1.4rem; font-size: 1.05rem;
}
.btn:hover, .btn:focus-visible { background: var(--accent-dark); }
.btn:focus-visible, .chip:focus-visible, .link-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0 0; padding: 0; list-style: none; }
.chip {
  font: inherit; font-size: .9rem; cursor: pointer; background: var(--bg-soft); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; padding: .25rem .8rem;
}
.chip:hover { border-color: var(--accent); }

.dice-tray {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem;
  min-height: 78px; margin: 1rem 0 .5rem;
}
.die {
  width: 70px; height: 70px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; font-weight: 800; font-size: 1.5rem; background: #fff;
  border: 2px solid var(--ink); color: var(--ink);
}
.die img { width: 70px; height: 70px; display: block; }
.die.img-die { border: 0; background: transparent; }
.die.dropped { opacity: .35; }
.die small { font-size: .6rem; display: block; color: var(--muted); font-weight: 600; }
.die-label { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }

.die.fresh { animation: shake .45s ease-in-out; }
@keyframes shake {
  0% { transform: rotate(0) translateY(0); }
  25% { transform: rotate(-14deg) translateY(-6px); }
  50% { transform: rotate(10deg) translateY(2px); }
  75% { transform: rotate(-6deg) translateY(-3px); }
  100% { transform: rotate(0) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .die.fresh { animation: none; }
}

.result { text-align: center; margin: 0; }
.result-total { font-size: 2rem; font-weight: 800; display: block; line-height: 1.2; }
.result-detail { color: var(--muted); font-size: .95rem; word-break: break-word; }
.error { color: #b00020; font-weight: 600; }

.roller-meta {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1rem;
  font-size: .88rem; color: var(--muted); border-top: 1px solid var(--line);
  margin-top: .8rem; padding-top: .6rem;
}
.roller-meta label { cursor: pointer; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--accent-text); text-decoration: underline; cursor: pointer; }

.history { list-style: none; padding: 0; margin: .4rem 0 0; font-size: .88rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .1rem .9rem; }
.history li { padding: 0; }
.history li:first-child { color: var(--ink); font-weight: 600; }
.history:empty { display: none; }

/* ---------- content ---------- */
main { display: block; }
main:focus { outline: none; }
.content { padding-top: .5rem; padding-bottom: 2rem; }
.content > section:first-child > h2:first-child { margin-top: 1rem; }
.content section + section { border-top: 1px solid var(--line); margin-top: 2rem; }
.breadcrumb { font-size: .9rem; color: var(--muted); margin: 1rem 0 0; }

.note {
  background: #fff7e8; border-left: 4px solid var(--accent);
  padding: .8rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 1em;
}

.table-wrap { overflow-x: auto; margin: 0 0 1em; }
table { border-collapse: collapse; width: 100%; font-size: .97rem; }
caption { text-align: left; font-weight: 700; padding: .3rem 0; }
th, td { border: 1px solid var(--line); padding: .4rem .6rem; text-align: left; }
thead th { background: var(--bg-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar { display: inline-block; height: .7em; background: var(--accent); border-radius: 2px; vertical-align: middle; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1rem 0; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: #fff; }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.faq dt { font-weight: 700; margin-top: 1.2em; }
.faq dd { margin: .3em 0 0; }

figure { margin: 0 0 1em; }
figcaption { font-size: .9rem; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { background: var(--dark); color: #c9cdd2; font-size: .92rem; padding: 1.5rem 0; margin-top: 2rem; }
.site-footer a { color: #fff; }
.site-footer a:hover, .site-footer a:focus { color: var(--accent); }
.footer-nav { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; padding: 0; margin: 0 0 .8rem; }
.site-footer p { margin: .3rem 0; }

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .roller { padding: .8rem; }
  .hero h1 { padding-top: .8rem; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .3rem; -webkit-overflow-scrolling: touch; }
  .chip { white-space: nowrap; }
  .dice-tray { min-height: 60px; margin: .7rem 0 .3rem; }
  .btn { width: 100%; }
  .die, .die img { width: 56px; height: 56px; }
  .result-total { font-size: 1.7rem; }
}
