:root {
  --felt: #05261b;
  --felt2: #0a3d2a;
  --parchment: #f4e9d0;
  --gold: #fbbf24;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Bricolage Grotesque', sans-serif;
  color: var(--parchment);
  background:
    radial-gradient(circle at 20% 20%, rgba(16,120,80,0.35), transparent 55%),
    radial-gradient(circle at 80% 70%, rgba(6,60,40,0.6), transparent 50%),
    linear-gradient(160deg, #04211a 0%, #072b1f 60%, #041a14 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* subtle felt texture */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 4px 4px;
  pointer-events: none;
}

.text-parchment { color: var(--parchment); }

.title {
  font-weight: 800;
  font-size: clamp(2.6rem, 9vw, 4rem);
  line-height: 1;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #fde68a, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 20px rgba(245,158,11,0.25);
}
.tagline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(244,233,208,0.5);
  margin-top: 0.4rem;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(52,211,153,0.15);
  padding: 0.35rem;
  border-radius: 1rem;
  margin-bottom: 1.5rem;
}
.tab {
  flex: 1;
  padding: 0.65rem;
  border-radius: 0.75rem;
  font-weight: 800;
  font-size: 1rem;
  color: rgba(167,243,208,0.7);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.tab:hover { color: var(--parchment); }
.tab-active {
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  color: #052e1b;
  box-shadow: 0 4px 14px rgba(245,158,11,0.35);
}

.panel {
  background: rgba(3,30,22,0.75);
  border: 1px solid rgba(52,211,153,0.18);
  border-radius: 1.25rem;
  padding: 1.25rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 30px rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  animation: fadeUp 0.4s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(167,243,208,0.6);
  font-weight: 700;
}
.notation {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  color: var(--gold);
  font-size: 0.95rem;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

.roll-btn {
  width: 100%;
  padding: 1.1rem;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  color: #052e1b;
  background: linear-gradient(180deg, #fde68a 0%, #fbbf24 45%, #f59e0b 100%);
  border: none;
  border-radius: 1rem;
  cursor: pointer;
  box-shadow: 0 6px 0 #b45309, 0 12px 24px rgba(0,0,0,0.4);
  transition: transform 0.08s, box-shadow 0.08s;
}
.roll-btn:hover { filter: brightness(1.05); }
.roll-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #b45309, 0 6px 12px rgba(0,0,0,0.4);
}
.roll-btn:disabled { opacity: 0.7; cursor: wait; }

.sub-btn {
  padding: 1.1rem 1.4rem;
  font-weight: 800;
  font-size: 1rem;
  color: var(--parchment);
  background: rgba(52,211,153,0.12);
  border: 1px solid rgba(52,211,153,0.3);
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.15s;
}
.sub-btn:hover { background: rgba(52,211,153,0.22); }

/* Dice faces */
.die-face {
  width: 66px;
  height: 66px;
  border-radius: 14px;
  background: linear-gradient(155deg, #fffef8, #e7ddc4);
  border: 1px solid rgba(0,0,0,0.15);
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.8), inset 0 -3px 6px rgba(0,0,0,0.18), 0 6px 12px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1f2937;
  animation: settle 0.35s ease both;
}
@keyframes settle {
  0% { transform: scale(0.6) rotate(-15deg); opacity: 0; }
  70% { transform: scale(1.08) rotate(4deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.die-rolling { animation: tumble 0.55s ease-in-out; }
@keyframes tumble {
  0% { transform: rotate(0) translateY(0); }
  25% { transform: rotate(-90deg) translateY(-14px) scale(1.1); }
  50% { transform: rotate(90deg) translateY(6px); }
  75% { transform: rotate(-45deg) translateY(-8px) scale(1.05); }
  100% { transform: rotate(0) translateY(0); }
}
.die-num { font-family: 'JetBrains Mono', monospace; font-weight: 800; }
.die-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.die-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(31,41,55,0.45);
  margin-top: 2px;
}

.pip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 44px;
  height: 44px;
}
.pip { width: 10px; height: 10px; border-radius: 50%; justify-self: center; align-self: center; }
.pip-on { background: #1f2937; box-shadow: inset 0 -1px 1px rgba(0,0,0,0.4); }
.pip-off { background: transparent; }

.total-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: clamp(2.5rem, 12vw, 3.8rem);
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 3px 16px rgba(245,158,11,0.4);
}

.stat {
  background: rgba(3,30,22,0.7);
  border: 1px solid rgba(52,211,153,0.18);
  border-radius: 1rem;
  padding: 0.75rem 0.5rem;
  text-align: center;
}
.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(167,243,208,0.5);
}
.stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 1.8rem;
  color: var(--parchment);
}

.game-over { animation: shake 0.5s ease, fadeUp 0.4s ease both; border-color: rgba(244,63,94,0.4); }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}