:root {
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-strong: #ecf5ee;
  --ink: #16211b;
  --muted: #66706b;
  --line: #dfe7e1;
  --green: #109a68;
  --green-dark: #087348;
  --teal: #13b7ac;
  --gold: #d69d2f;
  --red: #b44b4b;
  --shadow: 0 18px 45px rgba(24, 46, 34, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(236, 245, 238, 0.92), rgba(246, 248, 245, 0.98) 360px),
    var(--bg);
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-cube {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: #0f352b;
  border: 1px solid rgba(19, 183, 172, 0.22);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(8, 115, 72, 0.16);
}

.brand-cube canvas {
  width: 48px;
  height: 48px;
  display: block;
  cursor: grab;
  touch-action: none;
}

.brand strong {
  display: block;
  font-family: "League Spartan", Inter, sans-serif;
  font-size: 25px;
  line-height: 0.9;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: 28px;
  align-items: stretch;
}

.hero-copy {
  min-height: 330px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px 0;
}

.eyebrow,
.muted-label {
  margin: 0 0 10px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 650px;
  margin-bottom: 18px;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero-text {
  max-width: 590px;
  margin-bottom: 0;
  color: #44504a;
  font-size: 18px;
  line-height: 1.65;
}

.result-panel,
.checker-panel,
.summary-panel,
details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.result-panel {
  padding: 24px;
  align-self: center;
}

.panel-head,
.next-draw,
.actions,
.game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2,
.section-title h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

.status-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  color: var(--green-dark);
  background: var(--surface-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.error {
  color: var(--red);
  background: #fff0ef;
}

.draw-balls {
  display: grid;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  gap: 10px;
  margin: 24px 0;
}

.ball {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--green), var(--teal));
  border-radius: 50%;
  font-size: clamp(17px, 4vw, 23px);
  font-weight: 800;
  box-shadow: inset 0 -7px 12px rgba(0, 60, 42, 0.14);
}

.contest-tools {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.contest-tools label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.contest-controls {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto auto;
  gap: 8px;
}

.contest-controls input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfdfb;
  border: 1px solid #cad9cf;
  border-radius: 8px;
  outline: none;
  font-weight: 800;
}

.contest-controls input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(16, 154, 104, 0.12);
}

.next-draw {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.next-draw span,
.small-note,
.helper-text,
.empty-state {
  color: var(--muted);
}

.next-draw strong {
  text-align: right;
}

.small-note {
  margin: 16px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.checker-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: 28px;
  margin-top: 28px;
}

.checker-panel,
.summary-panel {
  padding: 24px;
}

.section-title {
  margin-bottom: 18px;
}

.label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
}

.label-row .muted-label {
  margin-bottom: 0;
}

.site-credit {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: -2px 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.summary-draw-balls {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
}

.summary-draw-ball {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--green), var(--teal));
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.share-button {
  min-height: 36px;
  margin-top: 2px;
  padding: 0 12px;
  font-size: 13px;
}

.share-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.share-links:empty {
  display: none;
}

.share-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: var(--green-dark);
  background: #fff;
  border: 1px solid #cbded2;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.share-link:hover {
  background: var(--surface-strong);
}

.share-status {
  max-height: 132px;
  margin: 8px 0 0;
  padding: 9px 10px;
  overflow: auto;
  white-space: pre-wrap;
  color: #405049;
  background: #f6faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.share-status:empty {
  display: none;
}

textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  padding: 16px;
  color: var(--ink);
  background: #fbfdfb;
  border: 1px solid #cad9cf;
  border-radius: 8px;
  outline: none;
  line-height: 1.7;
}

textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(16, 154, 104, 0.12);
}

.actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 14px;
}

.primary-button,
.ghost-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: var(--green-dark);
}

.primary-button:hover {
  background: #065d3b;
}

.ghost-button {
  color: var(--green-dark);
  background: #fff;
  border-color: #cbded2;
}

.ghost-button:hover {
  background: var(--surface-strong);
}

.primary-button:disabled,
.ghost-button:disabled,
.contest-controls input:disabled {
  cursor: wait;
  opacity: 0.62;
}

.compact-button {
  min-width: 64px;
  padding: 0 12px;
}

.helper-text {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.55;
}

.summary-list {
  display: grid;
  gap: 6px;
}

.game-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfdfb;
}

.game-head {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.game-title {
  flex: 0 0 auto;
  font-weight: 800;
}

.game-subtitle {
  min-width: 0;
  margin-top: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hit-count {
  flex: 0 0 auto;
  min-width: 74px;
  padding: 6px 9px;
  text-align: center;
  color: #fff;
  background: var(--green);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.compact-game-head {
  gap: 8px;
}

.game-main {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.hit-count.low {
  color: #5d4a15;
  background: #f6dfab;
}

.hit-count.warn {
  color: #8a2e2e;
  background: #ffe2df;
}

.game-body {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.game-result.open .game-body {
  display: block;
}

.mini-balls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.mini-ball {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #38423d;
  background: #edf4ef;
  border: 1px solid #d6e4da;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}

.mini-ball.hit {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.warning-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--red);
  font-size: 13px;
  line-height: 1.5;
}

.details-zone {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

details {
  padding: 0;
  box-shadow: none;
}

summary {
  padding: 18px 20px;
  cursor: pointer;
  font-weight: 800;
}

.details-content {
  padding: 0 20px 20px;
  color: #3f4c45;
  line-height: 1.6;
}

.details-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.details-content th,
.details-content td {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  text-align: left;
}

.technical a {
  color: var(--green-dark);
  font-weight: 800;
}

@media (max-width: 840px) {
  .app-shell {
    width: min(100% - 22px, 680px);
  }

  .topbar {
    padding-bottom: 18px;
  }

  .hero,
  .checker-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: 0;
    padding: 20px 0 6px;
  }

  .result-panel,
  .checker-panel,
  .summary-panel {
    padding: 18px;
  }

  .draw-balls {
    gap: 8px;
  }

  .contest-controls {
    grid-template-columns: minmax(100px, 1fr) auto auto;
  }
}

@media (max-width: 480px) {
  .topbar {
    align-items: flex-start;
  }

  .brand strong {
    font-size: 22px;
  }

  h1 {
    font-size: 42px;
  }

  .hero-text {
    font-size: 16px;
  }

  .panel-head,
  .next-draw {
    align-items: flex-start;
    flex-direction: column;
  }

  .compact-game-head {
    align-items: center;
    flex-direction: row;
  }

  .game-main {
    gap: 6px;
  }

  .game-subtitle {
    font-size: 12px;
  }

  .draw-balls {
    grid-template-columns: repeat(3, 1fr);
  }

  .contest-controls {
    grid-template-columns: 1fr;
  }

  .hit-count,
  .next-draw strong {
    text-align: left;
  }
}
