:root {
  color-scheme: dark;
  --red: #e63946;
  --red-soft: rgba(230, 57, 70, 0.2);
  --black: #0b0c10;
  --black-soft: rgba(11, 12, 16, 0.65);
  --green: #2a9d8f;
  --green-soft: rgba(42, 157, 143, 0.18);
  --text: #f7f7f7;
  --muted: rgba(247, 247, 247, 0.72);
  --danger: #f94144;
  --success: #61e294;
  font-family: 'Chakra Petch', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, var(--red-soft), transparent 55%),
              radial-gradient(circle at bottom right, var(--green-soft), transparent 55%),
              var(--black);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: relative;
}

.background-gradient {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(230, 57, 70, 0.12), transparent 40%),
              linear-gradient(315deg, rgba(42, 157, 143, 0.12), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

header, main, footer {
  position: relative;
  z-index: 1;
}

header {
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 5vw, 4rem) clamp(1rem, 4vw, 2rem);
  text-align: center;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  margin-bottom: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.lead {
  max-width: 740px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
}

main {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  padding: 0 clamp(1.5rem, 5vw, 4rem) clamp(2.5rem, 5vw, 4rem);
}

section {
  background: rgba(8, 8, 8, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: clamp(1.75rem, 4vw, 2.5rem);
  backdrop-filter: blur(18px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
}

section h2 {
  margin-top: 0;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.field-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.field span,
.field legend {
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--muted);
}

.field input[type="number"] {
  margin-top: 0.5rem;
  width: 100%;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input[type="number"]:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.25);
}

.field small {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

.bet-choice {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-radius: 14px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
}

.bet-choice label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-weight: 600;
}

.bet-choice input[type="radio"] {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.chip.red {
  background: linear-gradient(135deg, var(--red), rgba(230, 57, 70, 0.6));
}

.chip.black {
  background: linear-gradient(135deg, #111, rgba(0, 0, 0, 0.7));
  color: #f1f1f1;
}

.run-btn {
  align-self: flex-start;
  border: none;
  border-radius: 14px;
  padding: 0.9rem 1.7rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--text);
  background: linear-gradient(135deg, var(--green), rgba(42, 157, 143, 0.7));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.run-btn:hover,
.run-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(42, 157, 143, 0.35);
}

.helper-text {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.9rem;
  line-height: 1.5;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.copy-btn {
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--text);
  background: rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.copy-btn:hover,
.copy-btn:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.copy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.summary {
  background: rgba(0, 0, 0, 0.55);
  border-radius: 14px;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.55;
  font-size: 0.98rem;
}

.summary strong {
  color: var(--green);
}

.summary-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.summary-block {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.summary-block h3 {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.key-value-list {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.key-value-list div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.key-value-list dt {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.66);
}

.key-value-list dd {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.outcome-line {
  margin: 0;
}

.value-emphasis {
  font-weight: 700;
}

.stop-reason {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.summary .loss {
  color: var(--danger);
}

.summary .win {
  color: var(--success);
}

.round-log {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem;
}

.round-log table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.round-log th,
.round-log td {
  padding: 0.55rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.round-log tbody tr:last-child td {
  border-bottom: none;
}

.round-log td .tag {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  font-weight: 700;
}

.tag.win {
  background: rgba(97, 226, 148, 0.18);
  color: var(--success);
  border: 1px solid rgba(97, 226, 148, 0.6);
}

.tag.loss {
  background: rgba(249, 65, 68, 0.18);
  color: var(--danger);
  border: 1px solid rgba(249, 65, 68, 0.6);
}

.tag.green {
  background: rgba(42, 157, 143, 0.16);
  border: 1px solid rgba(42, 157, 143, 0.55);
  color: var(--green);
}

.tag.red {
  background: rgba(230, 57, 70, 0.16);
  border: 1px solid rgba(230, 57, 70, 0.55);
  color: var(--red);
}

.tag.black {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #e8e8e8;
}

footer {
  text-align: center;
  padding: 2rem 1rem 3rem;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  header {
    text-align: left;
  }

  .lead {
    font-size: 1rem;
  }

  main {
    padding-inline: clamp(1rem, 4vw, 1.5rem);
  }
}
