﻿:root {
  color-scheme: dark;
  --page: #ffffff;
  --ink: #191d21;
  --gt-green: #657f35;
  --gt-red: #7d211c;
  --gt-brown: #95452f;
  --bg: #14120f;
  --panel: #232522;
  --panel-2: #30332f;
  --text: #f4efe4;
  --muted: #bab2a3;
  --line: #55584f;
  --accent: #df3f2f;
  --accent-2: #f0b84c;
  --green: #4fb071;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100%;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: transparent;
  color: var(--ink);
}

a {
  color: inherit;
}

.siteHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 8px clamp(16px, 4vw, 34px);
  border-bottom: 5px solid var(--gt-green);
  background: #050505;
  color: #fff;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.brandLogo {
  width: min(245px, 42vw);
  height: auto;
  display: block;
}

.headerActions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.headerLinks {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
}

.siteNav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.siteNav a {
  text-decoration: none;
}

.siteNav a:hover {
  color: #f4d7c8;
}

.helpLink {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: #fff;
  color: #b82820;
  font-size: 1.1rem;
  font-weight: 950;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.helpLink:hover {
  background: #f7eee9;
  color: var(--gt-brown);
}

.version {
  align-self: flex-end;
  color: #b8c79a;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.app {
  background:
    linear-gradient(135deg, rgba(223, 63, 47, 0.16), transparent 36%),
    linear-gradient(315deg, rgba(79, 176, 113, 0.16), transparent 40%),
    var(--bg);
  color: var(--text);
  min-height: 100%;
  display: grid;
  place-items: start center;
  padding: 12px 24px 24px;
  cursor: crosshair;
}

button {
  font: inherit;
}

.roller {
  position: relative;
  width: min(920px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(340px, 1.1fr);
  grid-template-rows: auto minmax(360px, 1fr) auto;
  gap: 22px;
  padding: clamp(18px, 4vw, 40px);
  border: 1px solid rgba(244, 239, 228, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    rgba(35, 37, 34, 0.92);
  background-size: 34px 34px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.3);
}

.status {
  grid-column: 1 / -1;
  align-self: center;
  justify-self: center;
  width: min(620px, 100%);
  padding-top: 10px;
  text-align: center;
}

.appTitle {
  max-width: none;
  margin: 0 0 8px;
  color: var(--text);
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gt-green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 16ch;
  font-size: clamp(1.55rem, 4vw, 3.15rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.copy {
  max-width: 32rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.dieStage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 340px;
}

.trayTitle {
  display: none;
}

.diceTray {
  width: min(86%, 430px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(94px, 1fr));
  align-items: center;
  justify-items: center;
  gap: clamp(10px, 2vw, 18px);
}

.dieStage[data-dice-count="1"] .diceTray {
  width: min(78%, 390px);
  grid-template-columns: 1fr;
}

.dieStage[data-dice-count="2"] .diceTray,
.dieStage[data-dice-count="3"] .diceTray,
.dieStage[data-dice-count="4"] .diceTray {
  width: min(84%, 430px);
  grid-template-columns: repeat(2, minmax(104px, 1fr));
}

.dieFace {
  position: relative;
  width: 100%;
  max-width: 130px;
  aspect-ratio: 1;
  filter: drop-shadow(0 22px 22px rgba(0, 0, 0, 0.32));
  transform: rotate(var(--die-tilt, -5deg));
  transition:
    transform 180ms ease,
    filter 180ms ease;
}

.dieImage {
  width: 100%;
  height: 100%;
  display: block;
}

.dieNumber {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #171512;
  font-size: clamp(1.2rem, 4.8vw, 3.6rem);
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.dieNumber.d4 {
  padding-top: 18%;
}

.dieNumber.d10,
.dieNumber.d100 {
  font-size: clamp(1rem, 4.2vw, 3.1rem);
}

.dieStage[data-dice-count="1"] .dieFace {
  max-width: 330px;
}

.dieStage[data-dice-count="2"] .dieFace,
.dieStage[data-dice-count="3"] .dieFace,
.dieStage[data-dice-count="4"] .dieFace {
  max-width: 165px;
}

.dieFace.rolling {
  transform: rotate(var(--die-spin, 14deg)) scale(1.04);
  filter: drop-shadow(0 30px 28px rgba(0, 0, 0, 0.42));
}

.rollValue {
  width: min(360px, 100%);
  min-width: 72px;
  min-height: 72px;
  margin-top: 16px;
  padding: 10px 14px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 239, 228, 0.24);
  border-radius: 8px;
  background: rgba(20, 18, 15, 0.76);
  color: var(--accent-2);
  font-size: clamp(1.45rem, 4vw, 2.45rem);
  font-weight: 900;
  text-align: center;
}

.controls {
  align-self: center;
  justify-self: center;
  width: min(430px, 100%);
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid rgba(244, 239, 228, 0.14);
  border-radius: 10px;
  background: rgba(20, 18, 15, 0.46);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
  text-align: center;
}

.diceControls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.diceControl {
  display: grid;
  align-items: stretch;
  gap: 7px;
  text-align: left;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.diceControl select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(244, 239, 228, 0.2);
  border-radius: 6px;
  background: rgba(20, 18, 15, 0.72);
  color: var(--text);
  font: inherit;
  font-weight: 850;
  padding: 0 10px;
}

.modeControl {
  grid-column: 1 / -1;
  align-items: stretch;
}

.modeButtons {
  display: grid;
  grid-template-columns: repeat(2, minmax(76px, 1fr));
  gap: 6px;
}

.modeButtons button {
  min-height: 42px;
  border: 2px solid rgba(244, 239, 228, 0.2);
  border-radius: 6px;
  background: rgba(20, 18, 15, 0.72);
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 850;
  cursor: pointer;
}

.modeButtons button.active {
  border-color: var(--accent-2);
  background: rgba(125, 33, 28, 0.94);
  color: #fff8ee;
  box-shadow:
    0 0 0 1px rgba(240, 184, 76, 0.34),
    0 0 18px rgba(240, 184, 76, 0.18);
}

#rollButton {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  background: var(--gt-red);
  color: #fff8ee;
  font-weight: 850;
  cursor: pointer;
  transition:
    background 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

#rollButton:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

#rollButton:not(:disabled):hover {
  background: #9a2a23;
  transform: translateY(-1px);
}

.meter {
  width: 100%;
  height: 12px;
  margin: 20px 0 10px;
  overflow: hidden;
  border: 1px solid rgba(244, 239, 228, 0.18);
  border-radius: 999px;
  background: rgba(20, 18, 15, 0.58);
}

.meterFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gt-red), var(--accent-2), var(--gt-green));
  transition: width 120ms ease;
}

.hint {
  min-height: 1.45em;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.historyPanel {
  grid-column: 1 / -1;
  width: min(720px, 100%);
  justify-self: center;
}

.historyHeading {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.log {
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 100%;
  max-height: 142px;
  min-height: 42px;
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
  overflow-y: auto;
  scrollbar-color: rgba(240, 184, 76, 0.45) rgba(20, 18, 15, 0.35);
}

.log li {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  max-width: 100%;
  padding: 0 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 239, 228, 0.16);
  border-radius: 6px;
  background: rgba(20, 18, 15, 0.5);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 850;
  text-align: center;
  overflow-wrap: anywhere;
}

.siteFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 46px);
  border-top: 5px solid var(--gt-green);
  background: var(--gt-brown);
  color: #fff;
}

.siteFooter div {
  display: grid;
  gap: 4px;
}

.siteFooter strong {
  color: #fff;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.siteFooter span,
.siteFooter p {
  margin: 0;
  color: #f2ddd2;
  font-size: 0.88rem;
}

.helpMain {
  min-height: 100%;
  padding: clamp(22px, 5vw, 54px);
  background:
    linear-gradient(135deg, rgba(101, 127, 53, 0.14), transparent 32%),
    linear-gradient(315deg, rgba(149, 69, 47, 0.2), transparent 38%),
    #161412;
  color: var(--text);
}

.helpArticle {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px);
  border: 1px solid rgba(244, 239, 228, 0.16);
  border-radius: 8px;
  background: rgba(35, 37, 34, 0.94);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.28);
}

.helpLogo {
  width: min(340px, 100%);
  height: auto;
  display: block;
  margin: 0 0 18px;
}

.helpArticle h1 {
  max-width: none;
  color: #fff;
  font-size: clamp(1.9rem, 5vw, 3.2rem);
}

.helpVersion {
  margin: 8px 0 0;
  color: #b8c79a;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.helpArticle h2 {
  margin: 28px 0 10px;
  color: var(--accent-2);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.helpArticle p,
.helpArticle li {
  color: var(--muted);
  line-height: 1.65;
}

.helpArticle ol,
.helpArticle ul {
  padding-left: 1.25rem;
}

.helpArticle a {
  color: #fff;
  font-weight: 850;
}

.helpBack {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-top: 18px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--gt-brown);
  color: #fff;
  font-weight: 850;
  text-decoration: none;
}

.legalNotice {
  margin: 28px 0 0;
  padding-top: 18px;
  border-top: 1px solid rgba(244, 239, 228, 0.16);
  font-size: 0.82rem;
}

@media (max-width: 760px) {
  .siteHeader,
  .siteFooter {
    align-items: flex-start;
    flex-direction: column;
  }

  .headerActions {
    align-items: flex-start;
    flex-direction: column;
  }

  .headerLinks {
    align-items: flex-start;
    flex-direction: column;
  }

  .version {
    align-self: flex-start;
  }

  .brandLogo {
    width: min(100%, 245px);
  }

  .siteNav {
    flex-wrap: wrap;
  }

  .app {
    padding: 10px 14px 18px;
  }

  .roller {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    min-height: 0;
    gap: 16px;
    padding: 18px;
  }

  .dieStage {
    grid-row: auto;
    min-height: 195px;
  }

  .dieFace {
    max-width: 118px;
  }

  .dieStage[data-dice-count="1"] .dieFace {
    max-width: 195px;
  }

  .rollValue {
    width: 100%;
    min-width: 58px;
    min-height: 58px;
    margin-top: 14px;
    font-size: 1.7rem;
  }

  .controls {
    width: min(520px, 100%);
    padding: 16px;
  }

  .historyPanel {
    width: min(520px, 100%);
  }
}

[hidden] {
  display: none !important;
}

.appCornerActions {
  position: absolute;
  top: clamp(14px, 2.5vw, 26px);
  right: clamp(14px, 2.5vw, 26px);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
}

.appHelpButton {
  width: 28px;
  height: 28px;
  font-size: 0.82rem;
}

.appVersion {
  align-self: center;
  color: #c7df77;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.textBrand {
  color: #f4efe4;
  font-size: clamp(1.15rem, 3vw, 1.55rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.helpOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 28px);
  background: rgba(0, 0, 0, 0.68);
}

.helpDialog {
  position: relative;
  width: min(920px, 100%);
  max-height: min(82vh, 820px);
  overflow: auto;
}

.closeHelpButton {
  position: sticky;
  top: 0;
  float: right;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: #fff;
  color: #b82820;
  font-size: 1rem;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

@media (max-width: 760px) {
  .status {
    padding: 20px 92px 0 12px;
  }

  .helpDialog {
    max-height: 88vh;
  }
}





.helpArticle h3 {
  margin: 14px 0 4px;
  color: var(--accent-2);
  font-size: 0.98rem;
  letter-spacing: 0.04em;
}

@media (max-width: 480px) {
  .app {
    padding-inline: 8px;
  }

  .roller {
    padding: 14px;
  }

  .dieStage {
    min-height: 175px;
  }

  .dieStage[data-dice-count="1"] .dieFace {
    max-width: 170px;
  }

  .log {
    grid-template-columns: 1fr;
    max-height: 158px;
  }
}

/* Two-panel tabletop layout */
.roller {
  width: min(1040px, 100%);
  min-height: 760px;
  grid-template-columns: minmax(320px, 0.78fr) minmax(430px, 1.22fr);
  grid-template-rows: auto 420px 170px;
  align-items: start;
  gap: 18px;
}

.controls {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  width: 100%;
  height: 420px;
  box-sizing: border-box;
}

.historyPanel {
  grid-column: 1;
  grid-row: 3;
  width: 100%;
  height: 170px;
  padding: 12px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid rgba(244, 239, 228, 0.12);
  border-radius: 10px;
  background: rgba(20, 18, 15, 0.34);
}

.historyPanel .log {
  grid-template-columns: 1fr;
  width: 100%;
  gap: 5px;
  max-height: none;
  overflow: hidden;
}

.dieStage {
  grid-column: 2;
  grid-row: 2 / 4;
  align-self: stretch;
  height: 608px;
  min-height: 608px;
  box-sizing: border-box;
  padding: 34px;
  overflow: hidden;
  border: 1px solid #27150d;
  border-radius: 16px;
  background:
    linear-gradient(88deg, transparent 0 22%, rgba(255, 225, 177, 0.09) 23%, transparent 25% 58%, rgba(36, 13, 4, 0.18) 60%, transparent 62%),
    repeating-linear-gradient(7deg, rgba(255, 220, 165, 0.06) 0 2px, rgba(53, 24, 11, 0.08) 3px 7px),
    linear-gradient(135deg, #8a552d, #5d321a 48%, #774421);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.34),
    inset 0 0 0 4px rgba(255, 222, 171, 0.08),
    inset 0 0 18px rgba(35, 12, 4, 0.7);
}

.dieStage::before {
  content: "";
  position: absolute;
  inset: 15px;
  border: 2px solid rgba(22, 12, 7, 0.78);
  border-radius: 8px;
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.035) 0 1px, transparent 2px),
    radial-gradient(circle at 75% 70%, rgba(0, 0, 0, 0.08) 0 1px, transparent 2px),
    linear-gradient(145deg, #315c3b, #244d32 55%, #1d402a);
  background-size: 17px 17px, 23px 23px, auto;
  box-shadow:
    inset 0 0 28px rgba(0, 0, 0, 0.48),
    0 0 0 5px rgba(41, 20, 9, 0.2);
}

.trayTitle {
  position: absolute;
  top: 27px;
  left: 31px;
  z-index: 2;
  display: block;
  color: rgba(235, 226, 196, 0.68);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.diceTray {
  position: relative;
  z-index: 2;
  width: min(88%, 390px);
}

.dieStage[data-dice-count="1"] .diceTray {
  width: min(82%, 330px);
}

.dieStage[data-dice-count="1"] .dieFace {
  max-width: 280px;
}

.rollValue {
  height: 72px;
  box-sizing: border-box;
  overflow: hidden;
}

.historyPanel .log li {
  min-height: 32px;
  font-size: 0.84rem;
}

.dieStage[data-dice-count="5"] .diceTray,
.dieStage[data-dice-count="6"] .diceTray,
.dieStage[data-dice-count="7"] .diceTray,
.dieStage[data-dice-count="8"] .diceTray,
.dieStage[data-dice-count="9"] .diceTray,
.dieStage[data-dice-count="10"] .diceTray,
.dieStage[data-dice-count="11"] .diceTray,
.dieStage[data-dice-count="12"] .diceTray {
  width: 94%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dieStage[data-dice-count="5"] .dieFace,
.dieStage[data-dice-count="6"] .dieFace,
.dieStage[data-dice-count="7"] .dieFace,
.dieStage[data-dice-count="8"] .dieFace,
.dieStage[data-dice-count="9"] .dieFace,
.dieStage[data-dice-count="10"] .dieFace,
.dieStage[data-dice-count="11"] .dieFace,
.dieStage[data-dice-count="12"] .dieFace {
  max-width: 88px;
}

@media (max-width: 760px) {
  .app {
    padding: 8px;
  }

  .roller {
    grid-template-columns: minmax(235px, 0.82fr) minmax(285px, 1.18fr);
    grid-template-rows: auto 390px 160px;
    min-height: 698px;
    gap: 12px;
    padding: 14px;
  }

  .status {
    padding-top: 28px;
  }

  .copy {
    font-size: 0.9rem;
  }

  .controls {
    padding: 14px;
    height: 390px;
  }

  .diceControls {
    gap: 9px;
    margin-bottom: 12px;
  }

  .dieStage {
    grid-row: 2 / 4;
    height: 562px;
    min-height: 562px;
    padding: 26px;
  }

  .dieStage[data-dice-count="1"] .dieFace {
    max-width: 220px;
  }

  .rollValue {
    min-height: 58px;
  }

  .historyPanel {
    width: 100%;
    height: 160px;
  }
}

@media (max-width: 540px) {
  .roller {
    grid-template-columns: 1fr;
    grid-template-rows: auto 390px 340px 160px;
    min-height: 0;
  }

  .controls,
  .historyPanel,
  .dieStage {
    grid-column: 1;
  }

  .controls {
    grid-row: 2;
  }

  .dieStage {
    grid-row: 3;
    height: 340px;
    min-height: 340px;
  }

  .historyPanel {
    grid-row: 4;
  }
}

.helpArticle h3 + ul {
  margin-top: 0;
}
