* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #e5e7eb;
}

.app {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero {
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: #fbbf24;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.75rem;
  font-size: clamp(2rem, 5vw, 3rem);
}

.subtitle {
  max-width: 48rem;
  color: #cbd5e1;
  line-height: 1.55;
}

.panel {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.3rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: #0f172a;
  background: #fbbf24;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

button.secondary {
  color: #e5e7eb;
  background: #334155;
}

.status {
  margin-bottom: 0;
  color: #cbd5e1;
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.dice-panel,
.progress-panel,
.stats-panel {
  grid-column: 1 / -1;
}

.dice-panel,
.progress-panel,
.stats-panel,
.history-panel {
  padding: 1.25rem;
}

.dice-panel {
  max-width: none;
  padding: 1rem;
}

.dice-content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
}

.dice-wrap {
  display: flex;
  gap: 0.75rem;
  margin: 0.75rem 0;
  flex-wrap: nowrap;
}

.dice-stats {
  min-width: 90px;
  text-align: left;
}

.die {
  width: 92px;
  aspect-ratio: 1;
  padding: 0.7rem;
  border-radius: 18px;
  background: #f8fafc;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  box-shadow: inset 0 0 0 4px #e2e8f0, 0 8px 18px rgba(15, 23, 42, 0.28);
}

.pip {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #0f172a;
  place-self: center;
}

.hidden {
  visibility: hidden;
}

.sum-display,
.roll-count {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #cbd5e1;
}

.roll-count {
  margin-bottom: 0;
}

.targets {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.5rem;
}

.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.stat-card {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0;
}

.stat-label {
  color: #94a3b8;
  font-size: 0.9rem;
}

.stat-value {
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 400;
  color: #e5e7eb;
}

.target {
  padding: 0.85rem 0.5rem;
  border-radius: 14px;
  text-align: center;
  font-weight: 700;
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid transparent;
}

.target.hit {
  background: rgba(16, 185, 129, 0.18);
  color: #d1fae5;
  border-color: rgba(16, 185, 129, 0.55);
}

.target.current {
  outline: 2px solid rgba(251, 191, 36, 0.9);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.history-list {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding-left: 0;
  list-style: none;
  color: #cbd5e1;
}

.history-list li {
  padding: 0.3rem 0;
}

.history-list strong {
  color: #f8fafc;
}

.history-list .ats-hit {
  color: #86efac;
}

.history-list .not-counted {
  color: #94a3b8;
}

@media (max-width: 640px) {
  .app {
    width: min(100% - 1rem, 1100px);
    padding-top: 1rem;
  }

  .die {
    width: 92px;
  }
}
