:root {
  --cream: #f8ddbd;
  --cream-soft: #fff0d8;
  --gold: #f9ce16;
  --gold-deep: #d39b05;
  --ink: #11182e;
  --muted: #5c4c40;
  --red: #dc3538;
  --purple: #4b168b;
  --purple-deep: #2f0a62;
  --line: #e86254;
  --paper: #fff9ef;
  --shadow: 0 10px 24px rgba(61, 31, 8, .13);
}

* { box-sizing: border-box; }
html { background: var(--cream); }
body { margin: 0; min-width: 320px; background: #ffcf9e; color: #050505; font-family: Arial, Helvetica, sans-serif; }
a { color: inherit; }
button, input, select { font: inherit; }

.site-header { padding: 4px 7px 8px; background: #ffcf9e; border-bottom: 2px solid #ef1d1d; }
.brand { max-width: 560px; min-height: 98px; margin: 0 auto; display: flex; align-items: center; justify-content: center; text-decoration: none; border: 4px solid #f01919; border-radius: 16px; background: #ffcf9e; }
.brand-logo { display: block; width: clamp(270px, 57vw, 335px); height: auto; }

.public-shell { max-width: 576px; min-height: calc(100vh - 116px); margin: 0 auto; padding: 10px 7px 0; border-right: 2px solid #ef1d1d; border-left: 2px solid #ef1d1d; background: #ffcf9e; }
.chart-shell { max-width: 1250px; margin: 0 auto; padding: 18px 20px 26px; }
.result-panel { overflow: hidden; border: 0; border-radius: 0; background: #ffcf9e; box-shadow: none; }
.game-title-row { min-height: 59px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 5px; padding: 6px 8px 6px 12px; background: #ffdf00; border: 2px solid #050505; border-radius: 22px; }
.game-title-row p { min-width: 0; margin: 0; overflow: visible; font-family: Arial, Helvetica, sans-serif; font-size: clamp(1rem, 4.25vw, 1.65rem); font-style: italic; font-weight: 900; letter-spacing: 0; line-height: 1; text-align: left; white-space: nowrap; }
.chart-link { position: static; display: inline-flex; align-items: center; justify-content: center; min-height: 29px; padding: 3px 8px 4px; border-radius: 5px; background: #070707; color: #fff; font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; font-style: italic; font-weight: 700; line-height: 1; text-decoration: none; white-space: nowrap; }
.chart-link:hover, .chart-link:focus-visible { background: var(--purple); }

.wheel-area { min-height: 365px; padding: 17px 10px 14px; display: grid; justify-items: center; align-content: center; }
.eyebrow { margin: 0 0 4px; color: var(--red); font-size: .74rem; font-weight: 850; text-transform: uppercase; letter-spacing: .13em; }
.wheel-wrap { width: 335px; height: 335px; margin: 0; position: relative; display: grid; place-items: center; }
.wheel-disc { width: 335px; height: 335px; position: absolute; border-radius: 50%; background: conic-gradient(from -18deg, #f71921 0deg 36deg, #fbf30a 36deg 72deg, #ed10df 72deg 108deg, #1913eb 108deg 144deg, #14dce8 144deg 180deg, #f71921 180deg 216deg, #fbf30a 216deg 252deg, #ed10df 252deg 288deg, #1913eb 288deg 324deg, #14dce8 324deg 360deg); box-shadow: none; animation: wheel-spin 18s linear infinite; }
.wheel-disc::after { content: ""; position: absolute; inset: 0; border: 0; border-radius: 50%; }
.wheel-disc.is-revealing { animation-duration: .42s; }
.wheel-number { width: 36px; height: 36px; position: absolute; top: calc(50% - 18px); left: calc(50% - 18px); display: grid; place-items: center; color: #050505; font-family: Arial, Helvetica, sans-serif; font-size: 2.1rem; font-weight: 900; transform: rotate(var(--angle)) translateY(-129px); text-shadow: none; }
.wheel-core { width: 151px; height: 151px; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px; border-radius: 50%; background: #ffcf9e; box-shadow: none; text-align: center; }
.wheel-core span { color: #5f4736; font-size: .57rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.wheel-core strong { max-width: 140px; overflow: hidden; color: #14245d; font-size: clamp(1.3rem, 6vw, 2rem); line-height: 1.16; text-overflow: ellipsis; white-space: nowrap; }
.wheel-core small { max-width: 104px; color: #624533; font-size: .63rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wheel-core.reveal-pop { animation: reveal-pop .72s cubic-bezier(.2, .9, .25, 1); }
.ist-clock { margin: 0; color: #5b4431; font-size: .78rem; font-weight: 700; }

.slots-section { margin: 0; padding: 0; border: 0; border-radius: 0; background: #ffcf9e; box-shadow: none; }
.section-heading { margin-bottom: 15px; display: flex; gap: 15px; justify-content: space-between; align-items: end; }
.section-heading h1, .chart-title-row h1 { margin: 0; color: var(--ink); font-size: clamp(1.25rem, 3vw, 1.7rem); line-height: 1.1; }
.date-chip { padding: 6px 10px; border-radius: 999px; background: #fff6e8; color: #64442d; font-size: .8rem; font-weight: 800; white-space: nowrap; }
.slots-labels { display: grid; grid-template-columns: 1.3fr .85fr 1.3fr .85fr; border: 1px solid #ed3535; border-bottom: 0; background: #fff; color: #050505; font-family: Arial, Helvetica, sans-serif; font-size: 1.12rem; font-style: italic; font-weight: 700; text-align: center; }
.slots-labels span { padding: 5px 3px; border-right: 1px solid #ed3535; }
.slots-labels span:last-child { border-right: 0; }
.slot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid #ed3535; border-left: 1px solid #ed3535; }
.slot-card { min-height: 33px; display: grid; grid-template-columns: 1.3fr .85fr; border-right: 1px solid #ed3535; border-bottom: 1px solid #ed3535; background: #ffcf9e; }
.slot-time, .slot-result { display: flex; align-items: center; justify-content: center; padding: 2px 3px; }
.slot-time { border-right: 1px solid #ed3535; color: #050505; font-family: Arial, Helvetica, sans-serif; font-size: 1.05rem; font-style: italic; font-weight: 700; }
.slot-result { color: #050505; font-family: Arial, Helvetica, sans-serif; font-size: 1.03rem; font-weight: 700; }
.slot-result.has-result { color: var(--purple-deep); }
.refresh-row { position: fixed; z-index: 5; right: max(15px, calc((100vw - 560px) / 2 + 7px)); bottom: 11px; min-height: 0; padding: 0; }
.refresh-button { cursor: pointer; padding: 8px 11px; border: 0; border-radius: 6px; background: #052f81; color: #fff; font-family: Arial, Helvetica, sans-serif; font-size: 1rem; font-weight: 400; text-transform: uppercase; box-shadow: none; }
.refresh-button:hover { background: #12489f; }
.refresh-button:active { transform: translateY(2px); box-shadow: 0 1px 0 #061b43; }
.refresh-button:focus-visible, a:focus-visible { outline: 3px solid #5a1d9a; outline-offset: 3px; }
.system-notice { margin: 0 0 16px; padding: 13px 15px; border: 1px solid #bb2b35; border-radius: 10px; background: #fff2ef; color: #811d2b; font-weight: 750; }
.site-footer { padding: 18px; border-top: 1px solid rgba(183,93,37,.22); color: #6b4b39; font-size: .75rem; text-align: center; }

.chart-shell { max-width: 1280px; }
.chart-title-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 6px 2px 20px; }
.chart-title-row h1 { color: #d1282c; font-size: clamp(1.22rem, 3vw, 1.75rem); }
.back-link { padding: 9px 12px; border-radius: 7px; background: var(--purple); color: #fff; font-size: .82rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.history-list { display: grid; gap: 22px; }
.history-day { overflow: hidden; border: 1px solid #d7aa7b; border-radius: 9px; background: #ffe4c4; box-shadow: 0 6px 15px rgba(61, 31, 8, .09); }
.history-date { margin: 0; padding: 12px 16px; background: var(--purple); color: white; font-family: Georgia, serif; font-size: 1rem; text-align: center; }
.history-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.history-cell { min-height: 72px; display: grid; place-content: center; gap: 4px; padding: 8px; border-right: 1px solid #f0188b; border-bottom: 1px solid #f0188b; text-align: center; }
.history-cell:nth-child(4n) { border-right: 0; }
.history-cell:nth-last-child(-n+4) { border-bottom: 0; }
.history-time { font-size: .8rem; font-weight: 900; }
.history-result { min-height: 18px; color: #332244; font-size: .88rem; font-weight: 800; }
.history-result.has-result { color: #521086; font-size: 1rem; }
.history-loading { padding: 35px 15px; color: var(--muted); text-align: center; }

@keyframes wheel-spin { to { transform: rotate(360deg); } }
@keyframes reveal-pop { 0% { transform: scale(1); } 35% { transform: scale(1.16); background: #fff0a0; } 100% { transform: scale(1); } }

@media (max-width: 650px) {
  .site-header { padding: 4px 7px 8px; }
  .brand { min-height: 98px; border-width: 4px; }
  .public-shell { padding: 10px 7px 0; }
  .game-title-row { min-height: 59px; grid-template-columns: minmax(0, 1fr) auto; padding: 6px 8px 6px 12px; }
  .wheel-area { min-height: 365px; padding: 17px 10px 14px; }
  .wheel-wrap { transform: none; margin: 0; }
  /* Keep the reference layout on phones: Time | Result | Time | Result. */
  .slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; border-top-color: #ed3535; }
  .slot-card { min-height: 33px; grid-template-columns: 1.3fr .85fr !important; }
  .slot-time, .slot-result { justify-content: center; padding: 2px 3px; }
  .chart-title-row { align-items: start; flex-direction: column; gap: 10px; }
  .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-cell:nth-child(4n) { border-right: 1px solid #f0188b; }
  .history-cell:nth-child(2n) { border-right: 0; }
  .history-cell:nth-last-child(-n+4) { border-bottom: 1px solid #f0188b; }
  .history-cell:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) { .wheel-disc, .wheel-disc.is-revealing, .wheel-core.reveal-pop { animation: none; } }
