@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --ink: #1b2925;
  --muted: #79857f;
  --green: #167351;
  --green-dark: #105a40;
  --green-pale: #e8f2eb;
  --line: #e8ece7;
  --surface: #ffffff;
  --canvas: #f5f6f2;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 88% 10%, rgba(213, 231, 214, .48), transparent 29rem),
    var(--canvas);
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.page-shell { width: min(1120px, calc(100% - 56px)); margin: 0 auto; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(30, 68, 52, .08); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: Manrope, sans-serif; font-size: 19px; font-weight: 800; letter-spacing: -.8px; }
.brand-light { color: #839087; font-weight: 500; }
.brand-mark { width: 27px; height: 27px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; transform: rotate(-8deg); }
.brand-mark span { border-radius: 50%; background: var(--green); }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(3) { background: #79b193; }
.topbar-note { display: inline-flex; align-items: center; gap: 8px; color: #65756c; font-size: 10px; font-weight: 700; letter-spacing: 1.25px; }
.live-dot, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: #49a676; box-shadow: 0 0 0 3px rgba(73, 166, 118, .12); }

.intro { min-height: 244px; display: flex; align-items: center; justify-content: space-between; padding: 39px 46px 34px 7px; }
.eyebrow, .section-kicker { margin: 0 0 11px; color: #648173; font-size: 10px; font-weight: 700; letter-spacing: 1.55px; }
.intro h1 { margin: 0; font-family: Manrope, sans-serif; font-size: clamp(38px, 5vw, 54px); line-height: 1.08; font-weight: 700; letter-spacing: -2.5px; }
.mobile-break { display: none; }
.intro-description { max-width: 480px; margin: 13px 0 0; color: #6c7972; font-size: 14px; line-height: 1.65; }
.intro-stamp { width: 138px; height: 138px; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 0 0 auto; margin-right: 9%; border: 1px solid rgba(39, 117, 80, .22); border-radius: 50%; color: var(--green); transform: rotate(7deg); }
.stamp-number { font-family: Manrope, sans-serif; font-size: 43px; font-weight: 700; line-height: 1; letter-spacing: -2px; }
.stamp-label { margin-top: 5px; font-size: 8px; font-weight: 700; letter-spacing: 1.3px; line-height: 1.35; text-align: center; }
.stamp-divider { width: 23px; height: 1px; margin: 7px 0 5px; background: #b9d5c4; }
.stamp-total { color: #77867d; font-size: 10px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .88fr); gap: 18px; align-items: stretch; }
.card { background: var(--surface); border: 1px solid rgba(29, 61, 47, .07); border-radius: 16px; box-shadow: 0 12px 34px rgba(26, 53, 40, .045); }
.draw-card { min-height: 383px; padding: 24px 26px 18px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.section-kicker { margin-bottom: 6px; font-size: 9px; }
h2 { margin: 0; font-family: Manrope, sans-serif; font-size: 19px; font-weight: 700; letter-spacing: -.5px; }
.game-index { color: #88948d; font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 500; letter-spacing: 0; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 27px; padding: 0 10px; border: 1px solid #e7ece8; border-radius: 20px; color: #738079; font-size: 10px; font-weight: 600; white-space: nowrap; }
.status-pill .status-dot { width: 6px; height: 6px; background: #a5b0aa; box-shadow: none; }
.status-pill[data-state='drawing'] { color: var(--green); background: #f0f7f2; border-color: #e1eee4; }
.status-pill[data-state='drawing'] .status-dot { background: #33a16b; box-shadow: 0 0 0 3px rgba(51, 161, 107, .12); animation: blink 1s infinite; }
.status-pill[data-state='done'] { color: #24794f; background: #eef7f0; border-color: #deeddf; }
.status-pill[data-state='done'] .status-dot { background: #35a36b; box-shadow: none; }
.status-pill[data-state='stopped'] { color: #a57232; background: #fbf6ee; border-color: #f0e5d1; }
.status-pill[data-state='stopped'] .status-dot { background: #c8974c; box-shadow: none; }
@keyframes blink { 50% { opacity: .4; } }

.progress-row { display: flex; justify-content: space-between; margin: 24px 0 8px; color: var(--ink); font-size: 11px; font-weight: 700; }
.muted { color: #8d9891; font-weight: 500; }
#progress-percent { color: #6b8b78; font-size: 10px; font-weight: 600; }
.progress-track { height: 5px; overflow: hidden; border-radius: 5px; background: #edf1ed; }
.progress-track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2d9465, #85c49a); transition: width .22s ease; }
.number-board { display: grid; grid-template-columns: repeat(5, minmax(34px, 1fr)); gap: 9px; margin-top: 23px; }
.number-ball { position: relative; display: grid; aspect-ratio: 1; place-items: center; border: 1px solid #e9eeea; border-radius: 50%; background: #fbfcfa; color: #536259; font-family: Manrope, sans-serif; font-size: 13px; font-weight: 700; transition: transform .2s ease, color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.number-ball.selected { border-color: var(--green); background: var(--green); color: white; box-shadow: 0 4px 12px rgba(22, 115, 81, .2); transform: scale(1.05); animation: pop .28s ease-out; }
.number-ball.last-drawn::after { position: absolute; inset: -4px; border: 1px solid rgba(35, 145, 91, .36); border-radius: inherit; content: ''; animation: ring .8s ease-out both; }
@keyframes pop { 0% { transform: scale(.8); } 75% { transform: scale(1.12); } 100% { transform: scale(1.05); } }
@keyframes ring { from { opacity: .9; transform: scale(.9); } to { opacity: 0; transform: scale(1.28); } }
.draw-message { min-height: 17px; margin: 17px 0 0; color: #849088; font-size: 10px; text-align: center; }

.settings-card { padding: 26px 23px 20px; }
.settings-heading { display: flex; align-items: center; gap: 12px; }
.settings-icon { display: grid; width: 37px; height: 37px; place-items: center; border-radius: 11px; background: #edf5ef; color: var(--green); font-size: 19px; }
.settings-heading .section-kicker { margin-bottom: 4px; }
.settings-heading h2 { font-size: 17px; }
.settings-description { margin: 17px 0 21px; color: #77837c; font-size: 12px; line-height: 1.65; }
.field-label { display: block; margin-bottom: 8px; color: #405249; font-size: 11px; font-weight: 700; }
.quantity-control { display: grid; height: 44px; grid-template-columns: 42px 1fr 42px; overflow: hidden; border: 1px solid #e3e9e4; border-radius: 9px; background: #fcfdfb; }
.quantity-button { border: 0; background: transparent; color: #527061; font-size: 21px; cursor: pointer; }
.quantity-button:hover { background: #f0f6f1; }
#game-count { width: 100%; border: 0; border-right: 1px solid #e8ede9; border-left: 1px solid #e8ede9; outline: 0; background: transparent; color: var(--ink); font-size: 14px; font-weight: 700; text-align: center; appearance: textfield; }
#game-count::-webkit-inner-spin-button, #game-count::-webkit-outer-spin-button { margin: 0; appearance: none; }
#game-count:focus-visible { box-shadow: inset 0 0 0 2px #77b58c; }
.field-hint { min-height: 14px; margin: 7px 0 20px; color: #929d96; font-size: 10px; }
.primary-button { width: 100%; min-height: 47px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 9px; background: var(--green); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; transition: background .18s ease, transform .18s ease, box-shadow .18s ease; }
.primary-button:hover:not(:disabled) { background: var(--green-dark); box-shadow: 0 6px 14px rgba(16, 90, 64, .18); transform: translateY(-1px); }
.primary-button:disabled { opacity: .76; cursor: wait; }
.button-spark { font-size: 16px; }
.button-arrow { margin-left: auto; padding-right: 13px; font-size: 16px; font-weight: 400; }
.button-spark { margin-left: auto; padding-left: 12px; }
.stop-button { width: 100%; margin-top: 8px; padding: 8px; border: 0; background: transparent; color: #98734a; font-size: 10px; font-weight: 600; cursor: pointer; }
.stop-button:hover { color: #74542f; text-decoration: underline; }
.random-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 14px 0 0; color: #99a39d; font-size: 9px; }

.history-panel { display: grid; grid-template-columns: minmax(225px, .78fr) minmax(0, 1.5fr); gap: 24px; align-items: center; margin-top: 17px; padding: 19px 21px; }
.history-heading { display: flex; align-items: center; gap: 12px; }
.history-heading .section-kicker { margin-bottom: 4px; }
.history-heading h2 { font-size: 16px; }
.history-icon { display: grid; width: 37px; height: 37px; flex: 0 0 auto; place-items: center; border-radius: 11px; background: #edf5ef; color: var(--green); font-size: 23px; }
.history-description { margin: 0 0 12px; color: #77837c; font-size: 11px; line-height: 1.5; }
.history-upload-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-file-info { min-width: 0; display: flex; align-items: center; gap: 9px; color: #718078; font-size: 10px; }
.history-file-info > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-icon { display: grid; width: 30px; height: 32px; flex: 0 0 auto; place-items: center; border: 1px solid #dce8de; border-radius: 6px; background: #f7faf7; color: #62806c; font-size: 8px; font-weight: 700; }
.upload-button { position: relative; display: inline-flex; min-height: 35px; flex: 0 0 auto; align-items: center; justify-content: center; overflow: hidden; padding: 0 13px; border: 1px solid #dce6de; border-radius: 8px; background: #f9fbf9; color: #42634f; font-size: 10px; font-weight: 700; cursor: pointer; }
.upload-button:hover { border-color: #a8c7b0; background: #f1f7f2; }
.upload-button:focus-within { outline: 3px solid rgba(54, 135, 85, .2); outline-offset: 2px; }
.upload-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.history-status { min-height: 14px; margin: 9px 0 0; color: #8c9890; font-size: 9px; line-height: 1.5; }
.history-status[data-state='ready'] { color: #397b53; }
.history-status[data-state='error'] { color: #a15b4d; }
.history-status[data-state='loading'] { color: #5f7a6a; }

.results-section { margin-top: 39px; }
.results-heading { display: flex; align-items: flex-end; justify-content: space-between; margin: 0 2px 14px; }
.results-heading .section-kicker { margin-bottom: 4px; }
.results-heading h2 { font-size: 20px; }
.results-count { display: inline-grid; min-width: 21px; height: 21px; place-items: center; margin-left: 4px; border-radius: 50%; background: #e7f0e9; color: #477359; font-family: 'DM Sans', sans-serif; font-size: 10px; vertical-align: 2px; }
.copy-button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid #e0e7e1; border-radius: 8px; background: rgba(255,255,255,.64); color: #5d6c63; font-size: 10px; font-weight: 600; cursor: pointer; }
.copy-button:hover:not(:disabled) { border-color: #a7c7b0; color: var(--green); }
.copy-button:disabled { opacity: .5; cursor: not-allowed; }
.results-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.empty-state { grid-column: 1 / -1; min-height: 145px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px dashed #dbe4dc; border-radius: 13px; background: rgba(255,255,255,.36); color: #738078; text-align: center; }
.empty-icon { margin-bottom: 8px; color: #83a68d; font-size: 21px; }
.empty-state p { margin: 0 0 4px; color: #526259; font-size: 12px; font-weight: 700; }
.empty-state > span:last-child { color: #929d96; font-size: 10px; }
.result-card { padding: 17px 17px 15px; border: 1px solid #e5ebe6; border-radius: 12px; background: #fff; box-shadow: 0 5px 15px rgba(26, 53, 40, .025); animation: card-in .25s ease-out; }
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.result-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.result-card-title { color: #526259; font-size: 11px; font-weight: 700; }
.result-card-badge { color: #78a183; font-size: 9px; font-weight: 600; }
.result-numbers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.result-number { display: grid; aspect-ratio: 1; place-items: center; border-radius: 50%; background: #edf5ef; color: #27744f; font-family: Manrope, sans-serif; font-size: 11px; font-weight: 700; }
.verification { display: flex; flex-direction: column; gap: 3px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #eef1ee; }
.verification-label { font-size: 10px; font-weight: 700; }
.verification-details { color: #8a968e; font-size: 9px; line-height: 1.45; }
.verification.pending .verification-label { color: #829087; }
.verification.found .verification-label { color: #24794f; }
.verification.found .verification-details { color: #63816d; }
.verification.not-found .verification-label { color: #617c6a; }
.footer { display: flex; justify-content: space-between; padding: 31px 2px 24px; margin-top: 22px; border-top: 1px solid rgba(30, 68, 52, .08); color: #89958d; font-size: 10px; }
.footer-mark { color: #647b6e; font-weight: 600; }
.footer-mark span { padding: 0 4px; color: #aeb9b0; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 32px, 540px); }
  .topbar { height: 67px; }
  .intro { min-height: auto; padding: 42px 3px 27px; }
  .intro h1 { font-size: 42px; }
  .intro-description { max-width: 370px; font-size: 13px; }
  .intro-stamp { width: 106px; height: 106px; margin-right: 0; }
  .stamp-number { font-size: 34px; }
  .stamp-label { font-size: 7px; }
  .workspace { grid-template-columns: 1fr; gap: 13px; }
  .draw-card { min-height: 0; padding: 21px 19px 14px; }
  .number-board { gap: clamp(6px, 2vw, 10px); margin-top: 20px; }
  .number-ball { font-size: 12px; }
  .settings-card { padding: 20px; }
  .settings-description { margin: 12px 0 15px; }
  .field-hint { margin-bottom: 15px; }
  .history-panel { grid-template-columns: 1fr; gap: 12px; padding: 17px 18px; }
  .history-description { margin-bottom: 10px; }
  .results-section { margin-top: 29px; }
}

@media (max-width: 440px) {
  .page-shell { width: calc(100% - 26px); }
  .topbar-note { font-size: 8px; letter-spacing: 1px; }
  .intro { align-items: flex-start; padding-top: 35px; }
  .intro h1 { font-size: 36px; letter-spacing: -1.8px; }
  .mobile-break { display: block; }
  .intro-description { max-width: 238px; font-size: 12px; }
  .intro-stamp { width: 83px; height: 83px; margin-top: 36px; }
  .stamp-number { font-size: 27px; }
  .stamp-label { margin-top: 2px; font-size: 6px; }
  .stamp-divider { width: 17px; margin: 4px 0 3px; }
  .stamp-total { font-size: 8px; }
  .draw-card { padding: 18px 15px 11px; }
  .card-heading { align-items: center; }
  h2 { font-size: 17px; }
  .status-pill { padding: 0 8px; font-size: 9px; }
  .number-board { gap: 6px; }
  .number-ball { font-size: 11px; }
  .draw-message { font-size: 9px; }
  .results-list { grid-template-columns: 1fr; }
  .history-panel { padding: 15px; }
  .history-upload-row { gap: 8px; }
  .upload-button { padding: 0 10px; }
  .footer { gap: 12px; align-items: flex-start; font-size: 9px; }
  .footer-mark { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
