:root {
  --paper: #f7f0e3;
  --paper-deep: #ecdcc7;
  --ink: #351310;
  --ink-soft: #75534c;
  --line: rgba(82, 22, 17, 0.15);
  --card: rgba(255, 251, 242, 0.94);
  --red: #cf2d21;
  --red-deep: #8e1613;
  --gold: #c7982e;
  --green: #55725a;
  --blue: #386aa5;
  --shadow: 0 24px 60px rgba(92, 35, 23, 0.12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 5%, rgba(207, 45, 33, 0.13), transparent 28rem),
    radial-gradient(circle at 96% 35%, rgba(199, 152, 46, 0.1), transparent 34rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), transparent 46%),
    var(--paper);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(56, 106, 165, 0.24);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 calc(110px + var(--safe-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand h1 {
  margin: 2px 0 0;
  font-family: "STSong", "Songti SC", "Noto Serif CJK SC", serif;
  font-size: clamp(25px, 3vw, 34px);
  letter-spacing: 0.04em;
  line-height: 1;
}

.brand-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 52px;
  height: 52px;
  border: 2px solid var(--ink);
  border-radius: 17px;
  background: var(--card);
  box-shadow: 4px 4px 0 var(--ink);
}

.brand-mark span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

.brand-mark span:nth-child(2) {
  background: var(--gold);
}

.brand-mark span:nth-child(3) {
  background: #8e1613;
}

.eyebrow {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.icon-button {
  display: inline-grid;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  place-items: center;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.icon-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(23, 35, 31, 0.1);
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.spinning svg {
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.view {
  animation: rise-in 240ms ease both;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(270px, 0.7fr);
  gap: 32px;
  overflow: hidden;
  padding: clamp(28px, 5vw, 54px);
  border-radius: var(--radius-xl);
  color: #f8f2e7;
  background:
    radial-gradient(circle at 90% 15%, rgba(232, 188, 90, 0.32), transparent 32%),
    linear-gradient(130deg, #68120f 0%, #941b16 55%, #c33323 100%);
  box-shadow: var(--shadow);
}

.hero-card::after {
  position: absolute;
  right: -60px;
  bottom: -110px;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow:
    0 0 0 38px rgba(255, 255, 255, 0.035),
    0 0 0 82px rgba(255, 255, 255, 0.02);
  content: "";
}

.hero-copy,
.status-board {
  position: relative;
  z-index: 1;
}

.hero-copy .eyebrow {
  color: rgba(255, 255, 255, 0.48);
}

.hero-copy h2 {
  margin: 15px 0;
  font-family: "STSong", "Songti SC", "Noto Serif CJK SC", serif;
  font-size: clamp(34px, 5vw, 62px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.hero-copy > p:last-child {
  max-width: 570px;
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 15px;
  line-height: 1.8;
}

.status-board {
  align-self: end;
  padding: 20px 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(12px);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13px;
}

.status-row.muted {
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.56);
}

.status-row strong {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e4c47a;
  box-shadow: 0 0 0 5px rgba(228, 196, 122, 0.14);
}

.status-dot.online {
  background: #79c59f;
  box-shadow: 0 0 0 5px rgba(121, 197, 159, 0.14);
}

.status-dot.offline {
  background: #e07363;
  box-shadow: 0 0 0 5px rgba(224, 115, 99, 0.14);
}

.text-button {
  padding: 7px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.text-button.light {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.28);
  text-underline-offset: 5px;
}

.draw-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.draw-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.draw-card .game-name {
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 800;
}

.draw-card .draw-time {
  color: var(--ink-soft);
  font-size: 12px;
}

.countdown {
  white-space: nowrap;
  color: var(--red-deep);
  font-family: "Consolas", monospace;
  font-size: 14px;
  font-weight: 800;
}

section {
  margin-top: 38px;
}

.section-heading,
.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 17px;
}

.section-heading h3,
.page-heading h2 {
  margin: 5px 0 0;
  font-family: "STSong", "Songti SC", "Noto Serif CJK SC", serif;
  font-size: clamp(25px, 4vw, 36px);
  line-height: 1.15;
}

.page-heading {
  align-items: center;
  margin: 20px 0 24px;
}

.page-heading > div > p:last-child {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.primary-button,
.secondary-button,
.quiet-button,
.danger-button {
  min-height: 43px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  border: 1px solid var(--red-deep);
  color: #fff;
  background: var(--red-deep);
  box-shadow: 0 8px 20px rgba(114, 20, 16, 0.2);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 22px rgba(23, 35, 31, 0.14);
}

.primary-button.compact {
  min-height: 38px;
  padding: 0 16px;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fffdf8;
}

.quiet-button {
  padding-inline: 8px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
}

.quiet-button:hover {
  color: var(--ink);
}

.danger-button {
  border: 1px solid rgba(216, 75, 53, 0.32);
  color: var(--red-deep);
  background: rgba(216, 75, 53, 0.06);
}

.win-center {
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 247, 0.56);
}

.empty-state {
  display: grid;
  min-height: 120px;
  padding: 24px;
  border: 1px dashed rgba(23, 35, 31, 0.22);
  border-radius: var(--radius-lg);
  color: var(--ink-soft);
  text-align: center;
  place-items: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
}

.empty-state p {
  max-width: 520px;
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}

.win-banner {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  overflow: hidden;
  padding: 20px;
  border: 1px solid rgba(231, 191, 91, 0.65);
  border-radius: 20px;
  color: #fff9ec;
  background:
    radial-gradient(circle at 100% 0, rgba(238, 197, 95, 0.26), transparent 38%),
    linear-gradient(120deg, #7c1210, #c92b1f);
  box-shadow: 0 18px 38px rgba(132, 25, 19, 0.22);
}

.win-banner + .win-banner {
  margin-top: 12px;
}

.win-rank {
  display: grid;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  font-family: "STSong", "Songti SC", serif;
  font-size: 20px;
  font-weight: 800;
  place-items: center;
}

.win-main h4 {
  margin: 0 0 5px;
  font-size: 16px;
}

.win-main p {
  margin: 0;
  color: rgba(255, 250, 241, 0.72);
  font-size: 12px;
  line-height: 1.55;
}

.win-amount {
  text-align: right;
}

.win-amount strong {
  display: block;
  font-family: "Consolas", monospace;
  font-size: clamp(21px, 4vw, 30px);
}

.win-amount span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.result-card {
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.game-tag,
.status-tag,
.rank-tag {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.game-tag.dlt {
  color: #8d3028;
  background: rgba(216, 75, 53, 0.1);
}

.game-tag.ssq {
  color: #2f6294;
  background: rgba(56, 106, 165, 0.1);
}

.issue-meta {
  color: var(--ink-soft);
  font-size: 12px;
  text-align: right;
}

.ball-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.ball {
  display: inline-grid;
  width: 35px;
  height: 35px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fffdf8;
  font-family: "Consolas", monospace;
  font-size: 13px;
  font-weight: 800;
  place-items: center;
}

.ball.front {
  border-color: rgba(216, 75, 53, 0.28);
  color: var(--red-deep);
  background: rgba(216, 75, 53, 0.055);
}

.ball.back {
  border-color: rgba(56, 106, 165, 0.25);
  color: #2f6294;
  background: rgba(56, 106, 165, 0.055);
}

.ball.small {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.ball-separator {
  width: 9px;
  height: 1px;
  margin: 0 2px;
  background: var(--line);
}

.prize-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 11px;
}

.prize-line strong {
  color: var(--ink);
}

.ticket-preview-list,
.ticket-list {
  display: grid;
  gap: 12px;
}

.ticket-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 21px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  transition: border-color 160ms ease, transform 160ms ease;
}

.ticket-card:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 35, 31, 0.25);
}

.ticket-card.winning {
  border-color: rgba(212, 166, 52, 0.62);
  box-shadow: inset 4px 0 0 var(--gold);
}

.ticket-card.paused {
  opacity: 0.68;
}

.ticket-title-line,
.ticket-actions,
.store-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.ticket-title-line {
  margin-bottom: 13px;
}

.ticket-title-line h4 {
  margin: 0;
  font-size: 16px;
}

.status-tag.active {
  color: var(--green);
  background: rgba(47, 107, 81, 0.09);
}

.status-tag.paused {
  color: var(--ink-soft);
  background: rgba(23, 35, 31, 0.06);
}

.rank-tag {
  color: #795813;
  background: rgba(212, 166, 52, 0.16);
}

.store-line {
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 12px;
}

.phone-link {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.win-main .phone-link {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.48);
  text-underline-offset: 4px;
}

.win-main .text-button.light {
  color: rgba(255, 255, 255, 0.78);
}

.ticket-actions {
  align-content: center;
  justify-content: end;
}

.mini-button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.mini-button.alert {
  border-color: rgba(216, 75, 53, 0.25);
  color: var(--red-deep);
  background: rgba(216, 75, 53, 0.06);
}

.ticket-check {
  margin-top: 13px;
  color: var(--ink-soft);
  font-size: 12px;
}

.ticket-check strong {
  color: var(--ink);
}

.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-chip {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.5);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.filter-chip.active {
  border-color: var(--red-deep);
  color: #fff;
  background: var(--red-deep);
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 190px;
  gap: 20px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
}

.history-issue strong {
  display: block;
  font-family: "Consolas", monospace;
  font-size: 15px;
}

.history-issue span {
  color: var(--ink-soft);
  font-size: 11px;
}

.history-prizes {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.75;
  text-align: right;
}

.history-prizes strong {
  color: var(--ink);
}

.analysis-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(24px, 4vw, 36px);
  border-radius: var(--radius-xl);
  color: #f8f2e7;
  background:
    radial-gradient(circle at 88% 10%, rgba(232, 188, 90, 0.3), transparent 36%),
    linear-gradient(125deg, #a21d17, #67110f);
  box-shadow: var(--shadow);
}

.analysis-kicker {
  display: inline-flex;
  min-height: 25px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  align-items: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.analysis-hero h3 {
  margin: 13px 0 7px;
  font-family: "STSong", "Songti SC", serif;
  font-size: clamp(28px, 5vw, 43px);
}

.analysis-hero p {
  max-width: 610px;
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  line-height: 1.7;
}

.analysis-hero .primary-button {
  flex: 0 0 auto;
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--ink);
  background: #f7f0e3;
}

.analysis-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.metric-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
}

.metric-card span {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
}

.metric-card strong {
  font-family: "Consolas", monospace;
  font-size: 16px;
}

.suggestion-list {
  display: grid;
  gap: 10px;
}

.suggestion-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.suggestion-card.main {
  border-color: rgba(216, 75, 53, 0.38);
  box-shadow: inset 4px 0 0 var(--red);
}

.suggestion-index {
  display: grid;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  font-family: "Consolas", monospace;
  font-size: 11px;
  font-weight: 800;
  place-items: center;
}

.suggestion-card.main .suggestion-index {
  color: #fff;
  background: var(--red);
}

.suggestion-info {
  min-width: 0;
}

.suggestion-info .ball-row {
  margin-bottom: 7px;
}

.suggestion-info p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.settings-card {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 17px;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.settings-icon {
  display: grid;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  color: #fff;
  background: var(--red-deep);
  font-family: "Consolas", monospace;
  font-size: 13px;
  font-weight: 700;
  place-items: center;
}

.settings-copy h3 {
  margin: 1px 0 7px;
  font-size: 17px;
}

.settings-copy > p {
  margin: 0 0 15px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.permission-note {
  margin-top: 11px !important;
  margin-bottom: 0 !important;
  font-size: 11px !important;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.file-button {
  position: relative;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.notice-card {
  margin-top: 18px;
  padding: 21px 24px;
  border-left: 4px solid var(--gold);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: rgba(212, 166, 52, 0.08);
}

.notice-card strong {
  font-family: "STSong", "Songti SC", serif;
  font-size: 19px;
}

.notice-card p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.75;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  bottom: calc(16px + var(--safe-bottom));
  left: 50%;
  display: flex;
  width: min(540px, calc(100% - 28px));
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background: rgba(111, 17, 14, 0.95);
  box-shadow: 0 18px 55px rgba(81, 16, 12, 0.3);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.nav-item {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 0;
  border-radius: 18px;
  color: rgba(255, 255, 255, 0.46);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-glyph {
  font-size: 18px;
  line-height: 1;
}

dialog {
  width: min(680px, calc(100% - 24px));
  max-height: min(90vh, 850px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 28px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 100px rgba(23, 35, 31, 0.36);
}

dialog::backdrop {
  background: rgba(12, 20, 17, 0.62);
  backdrop-filter: blur(5px);
}

#ticketForm {
  padding: 28px;
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 22px;
}

.dialog-head h2 {
  margin: 5px 0 0;
  font-family: "STSong", "Songti SC", serif;
  font-size: 30px;
}

.dialog-head .icon-button {
  width: 38px;
  height: 38px;
  font-size: 25px;
  line-height: 1;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  border-radius: 15px;
  background: var(--paper-deep);
}

.segmented button {
  min-height: 41px;
  border: 0;
  border-radius: 12px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.segmented button.active {
  color: var(--ink);
  background: #fffdf8;
  box-shadow: 0 4px 14px rgba(23, 35, 31, 0.08);
}

.form-grid {
  display: grid;
  gap: 13px;
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

.field > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.field input {
  width: 100%;
  height: 45px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.85);
}

.number-picker {
  margin: 3px 0 20px;
}

.picker-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.picker-heading strong {
  color: var(--ink);
  font-family: "Consolas", monospace;
}

.number-grid {
  display: grid;
  gap: 6px;
}

.front-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.back-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.number-button {
  display: grid;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  background: #fffdf8;
  font-family: "Consolas", monospace;
  font-size: 12px;
  font-weight: 700;
  place-items: center;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}

.number-button:hover {
  transform: translateY(-2px);
}

.number-button.selected.front-selected {
  border-color: var(--red-deep);
  color: #fff;
  background: var(--red-deep);
}

.number-button.selected.back-selected {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 0 14px;
  font-size: 13px;
  font-weight: 700;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}

.form-note,
.form-error {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.7;
}

.form-error {
  min-height: 18px;
  margin-top: 6px;
  color: var(--red-deep);
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 17px;
}

.dialog-actions .spacer {
  flex: 1;
}

.toast {
  position: fixed;
  z-index: 100;
  top: 20px;
  left: 50%;
  max-width: min(460px, calc(100% - 30px));
  padding: 13px 18px;
  border-radius: 14px;
  color: #fff;
  background: rgba(23, 35, 31, 0.94);
  box-shadow: 0 16px 40px rgba(23, 35, 31, 0.24);
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.auth-gate {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  padding: 20px;
  background:
    radial-gradient(circle at 10% 10%, rgba(207, 45, 33, 0.2), transparent 24rem),
    rgba(247, 240, 227, 0.94);
  backdrop-filter: blur(18px);
  place-items: center;
}

.auth-card {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.auth-card .brand-mark {
  margin-bottom: 24px;
}

.auth-card h2 {
  margin: 6px 0 10px;
  font-family: "STSong", "Songti SC", serif;
  font-size: 34px;
}

.auth-card > p:not(.eyebrow, .form-error) {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.auth-card .primary-button {
  width: 100%;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 680px);
    padding-top: 17px;
  }

  .topbar {
    padding-bottom: 18px;
  }

  .brand-mark {
    width: 45px;
    height: 45px;
    border-radius: 14px;
    box-shadow: 3px 3px 0 var(--ink);
  }

  .hero-card {
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 28px 23px;
  }

  .hero-copy h2 {
    font-size: clamp(34px, 12vw, 48px);
  }

  .status-board {
    align-self: auto;
  }

  .draw-strip,
  .result-grid,
  .settings-grid,
  .analysis-metrics {
    grid-template-columns: 1fr;
  }

  .analysis-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-hero {
    align-items: start;
    flex-direction: column;
  }

  .suggestion-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .suggestion-card > .mini-button {
    grid-column: 2;
    justify-self: start;
  }

  .page-heading {
    align-items: start;
  }

  .page-heading .primary-button {
    flex: 0 0 auto;
  }

  .ticket-card {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .ticket-actions {
    justify-content: start;
  }

  .history-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .history-prizes {
    text-align: left;
  }

  .win-banner {
    grid-template-columns: auto 1fr;
  }

  .win-amount {
    grid-column: 2;
    text-align: left;
  }

  .settings-card {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 19px;
  }

  .settings-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }
}

@media (max-width: 520px) {
  section {
    margin-top: 30px;
  }

  .section-heading {
    align-items: center;
  }

  .draw-card {
    padding: 16px;
  }

  .result-card,
  .ticket-card {
    padding: 17px;
  }

  .ball {
    width: 31px;
    height: 31px;
    font-size: 12px;
  }

  .ticket-preview-list .ticket-card:nth-child(n+4) {
    display: none;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  #ticketForm {
    padding: 21px 17px 24px;
  }

  .number-grid {
    gap: 4px;
  }

  .number-button {
    font-size: 11px;
  }

  .dialog-actions {
    flex-wrap: wrap;
  }

  .dialog-actions .spacer {
    display: none;
  }
}

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