:root {
  --cream: #fff7df;
  --cream-2: #fffdf5;
  --gold: #d89a16;
  --gold-dark: #9f6500;
  --red: #c60c0c;
  --red-dark: #8f0707;
  --blue: #072f91;
  --blue-dark: #041b57;
  --ink: #161616;
  --line: #dfb044;
  --shadow: 0 7px 18px rgba(113, 73, 0, .16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,224,133,.28), transparent 35%),
    linear-gradient(180deg, var(--cream-2), var(--cream));
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
}

.wrap {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 14px 14px 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) 1.4fr 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 0 14px;
}

.lakshmi {
  width: 100%;
  max-width: 190px;
  display: block;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.title {
  align-self: center;
  text-align: center;
  line-height: .88;
  font-weight: 900;
  color: var(--red);
  text-shadow: 0 3px 0 #ffc443, 0 6px 10px rgba(125,0,0,.18);
  font-size: clamp(38px, 11vw, 76px);
}
.title span { display: block; }

.round-box {
  align-self: center;
  background: white;
  border: 3px solid var(--gold);
  border-radius: 14px;
  padding: 15px 8px;
  text-align: center;
  color: var(--red);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 900;
  font-size: clamp(18px, 5vw, 34px);
  box-shadow: var(--shadow);
}

.values {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: end;
  margin: 6px 0 16px;
}

.value-card { text-align: center; min-width: 0; }
.value-label {
  display: block;
  width: 100%;
  border: 2px solid var(--gold);
  background: linear-gradient(#ffe99b, #f4bd32);
  border-radius: 22px;
  padding: 7px 10px;
  color: var(--blue-dark);
  font-weight: 900;
  font-size: clamp(24px, 7vw, 42px);
  box-shadow: var(--shadow);
}
.value-number {
  margin-top: 6px;
  background: white;
  border: 3px solid var(--gold);
  border-radius: 17px;
  min-height: 90px;
  display: grid;
  place-items: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(48px, 14vw, 90px);
  font-weight: 900;
  line-height: 1;
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}
.times-sign {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--red);
  font-size: clamp(38px, 10vw, 68px);
  font-weight: 900;
  padding-bottom: 10px;
}

.chart-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.chart-btn {
  display: block;
  text-decoration: none;
  text-align: center;
  color: white;
  font-weight: 900;
  font-size: clamp(20px, 5.5vw, 34px);
  padding: 14px 8px;
  border-radius: 999px;
  border: 3px solid var(--gold);
  box-shadow: var(--shadow);
}
.chart-btn.red { background: linear-gradient(#df1515, #970707); }
.chart-btn.blue { background: linear-gradient(#0d55c8, #052277); }
.next-result {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3px 12px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 2px solid var(--gold);
  border-radius: 14px;
  background: linear-gradient(135deg, #fff5d1, #fffdf5);
  box-shadow: var(--shadow);
  color: var(--blue-dark);
  font-family: Arial, Helvetica, sans-serif;
}
.next-result-info { display: flex; flex-direction: column; gap: 3px; }
.next-result-label { color: var(--red-dark); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.next-result-info strong { font-size: clamp(15px, 4vw, 20px); }
.next-result-clock { grid-column: 2; grid-row: 1 / span 2; color: var(--red-dark); font: 900 clamp(20px, 5.4vw, 30px) Arial, Helvetica, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.next-result-note { color: #6b5b39; font-size: 11px; }
.chart-btn:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #222;
  outline-offset: 3px;
}

.schedule {
  border: 3px solid var(--gold);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255,255,255,.54);
  box-shadow: var(--shadow);
}
.schedule-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr .8fr 1.1fr;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
}
.schedule-row:last-child { border-bottom: 0; }
.schedule-row {
  position: relative;
  transition: background .22s ease, box-shadow .22s ease, transform .22s ease;
}
.schedule-row.active-round {
  background: linear-gradient(90deg, rgba(255, 218, 88, .82), rgba(255, 246, 196, .96), rgba(255, 218, 88, .82));
  box-shadow: inset 5px 0 0 var(--red), inset -5px 0 0 var(--red), 0 0 0 2px rgba(198, 12, 12, .16);
  transform: scale(1.012);
  z-index: 1;
}
.schedule-row.active-round .rname,
.schedule-row.active-round .eq,
.schedule-row.active-round .rtime {
  font-weight: 900;
}
.schedule-row.active-round .rname::after {
  content: '  • LIVE';
  color: var(--red);
  font-family: Arial, Helvetica, sans-serif;
  font-size: .52em;
  letter-spacing: .03em;
  vertical-align: middle;
}
.schedule-row > div { padding: 8px 6px; text-align: center; }
.schedule-head { display: grid; grid-template-columns: 1.1fr 1fr .8fr 1.1fr; background: #fff0bd; border-bottom: 2px solid var(--gold); color: var(--blue-dark); font: 900 14px Arial, Helvetica, sans-serif; text-align: center; }
.schedule-head > div { padding: 8px 4px; border-right: 1px solid var(--line); }
.schedule-head > div:last-child { border-right: 0; }
.rresult { color: var(--red-dark); font: 900 clamp(15px, 3.8vw, 24px) Arial, Helvetica, sans-serif; overflow-wrap: anywhere; }
.schedule-row.active-round .rresult { color: var(--blue-dark); }
.rname {
  color: var(--blue-dark);
  font-weight: 900;
  font-size: clamp(20px, 5vw, 32px);
}
.rtime {
  color: var(--red);
  font-weight: 900;
  font-size: clamp(20px, 5vw, 31px);
  white-space: nowrap;
}

.status {
  margin: 10px 0 0;
  min-height: 22px;
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  color: #6b5b39;
}

/* Automatic India date above current round */
.round-stack {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  min-width: 0;
}
.live-date {
  text-align: center;
  padding: 7px 8px;
  border: 2px solid var(--gold);
  border-radius: 10px;
  background: linear-gradient(180deg, #fffdf5, #fff2c9);
  color: var(--red-dark);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(14px, 3.6vw, 20px);
  font-weight: 900;
  letter-spacing: .3px;
  box-shadow: 0 4px 10px rgba(107,74,0,.12);
}

/* Admin */
.admin-wrap {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 24px 14px 40px;
  font-family: Arial, Helvetica, sans-serif;
}
.admin-brand {
  text-align: center;
  margin-bottom: 18px;
}
.admin-brand h1 {
  margin: 0;
  color: var(--red);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(36px, 9vw, 58px);
}
.admin-brand p { margin: 6px 0 0; color: #6b5b39; }
.panel {
  background: rgba(255,255,255,.86);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.panel h2 { margin-top: 0; color: var(--blue-dark); }
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-weight: 800;
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #bda86f;
  background: white;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 17px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
button {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}
.primary { background: var(--red); color: white; }
.secondary { background: var(--blue); color: white; }
.ghost { background: #eee6d1; color: #3d3524; }
button:disabled { opacity: .55; cursor: not-allowed; }
.msg {
  margin-top: 12px;
  min-height: 22px;
  color: #5d4d2b;
  font-weight: 700;
}
.preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.preview div {
  border: 1px solid #dfc06c;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  background: #fffaf0;
}
.preview strong { display: block; margin-bottom: 6px; color: var(--blue-dark); }
.hidden { display: none !important; }
.small-note { font-size: 13px; color: #6b5b39; margin-top: 10px; }

@media (max-width: 470px) {
  .wrap { padding-left: 9px; padding-right: 9px; }
  .hero { grid-template-columns: .9fr 1.15fr 1fr; gap: 5px; }
  .round-box { border-width: 2px; padding: 10px 4px; }
  .values { gap: 6px; }
  .value-number { min-height: 76px; border-width: 2px; }
  .chart-buttons { gap: 6px; }
  .next-result { gap: 3px 8px; padding: 9px 10px; }
  .next-result-note { font-size: 10px; }
  /* Keep all four result columns on one line on mobile too. */
  .schedule-head,
  .schedule-row { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1.1fr); }
  .schedule-row > div { min-width: 0; }
  .schedule-row > div { padding: 8px 4px; }
  .preview { grid-template-columns: 1fr; }
}


/* Public one-year history charts */
.history-wrap {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 18px 10px 38px;
  font-family: Arial, Helvetica, sans-serif;
}
.history-brand { text-align: center; position: relative; margin-bottom: 12px; }
.history-brand h1 {
  margin: 0 0 8px;
  color: var(--red);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(34px, 8vw, 58px);
}
.history-title {
  display: inline-block;
  min-width: min(92vw, 430px);
  padding: 10px 24px;
  border-radius: 14px;
  color: #fff;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 900;
  font-size: clamp(25px, 6vw, 38px);
  border: 3px solid var(--gold);
  box-shadow: var(--shadow);
}
.history-title.sutta { background: linear-gradient(#df1515, #970707); }
.history-title.patti { background: linear-gradient(#0d55c8, #052277); }
.history-brand p { margin: 8px 0 0; color: #6b5b39; font-weight: 800; }
.back-home {
  display: inline-block;
  margin-bottom: 9px;
  color: var(--blue-dark);
  font-weight: 800;
  text-decoration: none;
}
.history-tip {
  margin: 10px auto 14px;
  width: fit-content;
  max-width: 96%;
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff4c7;
  border: 1px solid #e6c56d;
  color: #6b4d00;
  font-size: 13px;
  font-weight: 800;
}
.history-month {
  margin: 0 0 22px;
  background: rgba(255,255,255,.88);
  border: 2px solid var(--red);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.history-month h2 {
  margin: 0;
  padding: 10px 12px;
  text-align: center;
  color: #fff;
  background: linear-gradient(180deg, #d51c1c, #9d0808);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(21px, 5vw, 30px);
}
.history-scroll { overflow-x: auto; overscroll-behavior-inline: contain; }
.history-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: #fffdf8;
}
.history-table th, .history-table td {
  width: 96px;
  min-width: 96px;
  height: 44px;
  padding: 7px 4px;
  text-align: center;
  border-right: 1px solid #d7b86c;
  border-bottom: 1px solid #d7b86c;
  color: #191919;
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
}
.history-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  color: #fff;
  background: #c71313;
  font-size: 14px;
}
.history-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 88px;
  min-width: 88px;
  background: #fff1c6;
  color: var(--red-dark);
  box-shadow: 2px 0 0 rgba(179,123,0,.18);
}
.history-table thead .sticky-col { z-index: 4; background: #991010; color: white; }
.history-table td.has-result { background: #fff8df; color: var(--blue-dark); font-size: 17px; }
.history-table tbody tr:hover td, .history-table tbody tr:hover th { background-color: #fff1b1; }
.history-empty { margin: 0; padding: 14px; text-align: center; color: #7a6a44; font-weight: 700; }
.history-status { text-align: center; color: #6b5b39; font-size: 13px; font-weight: 700; }

@media (max-width: 470px) {
  .history-wrap { padding-left: 6px; padding-right: 6px; }
  .history-table { width: 100%; min-width: 0; table-layout: fixed; }
  .history-table th, .history-table td {
    width: auto;
    min-width: 0;
    padding: 5px 1px;
    font-size: clamp(8px, 2.7vw, 11px);
  }
  .history-table thead th { font-size: clamp(8px, 2.7vw, 11px); }
  .history-table .sticky-col { width: 18%; min-width: 0; }
  .history-table td.has-result { font-size: clamp(9px, 3vw, 12px); }
}

/* Past-result and holiday admin controls */
.history-admin { margin-top: 22px; padding: 18px; border: 2px solid var(--gold); border-radius: 16px; background: rgba(255,253,245,.9); }
.history-admin h2 { margin-top: 0; color: var(--red-dark); }
.history-admin .field { margin: 12px 0; }
.history-admin input, .history-admin select { width: 100%; min-height: 44px; padding: 10px; border: 1px solid #a88a4c; border-radius: 8px; font-size: 16px; background: white; }
.history-current { padding: 10px; border-radius: 8px; background: #fff2c9; color: #49360d; }
.holiday-row { background: #fff0bd; }
.holiday-cell { text-align: center; font-family: Arial, Helvetica, sans-serif; font-weight: 900; letter-spacing: .08em; color: #8f0707; background: #ffe18b; }

@media (max-width: 430px) {
  .schedule-row > div { padding: 8px 3px; }
  .schedule-head { font-size: 12px; }
  .rname, .rtime { font-size: clamp(14px, 3.6vw, 18px); }
  .rresult { font-size: clamp(14px, 3.8vw, 18px); }
}
