:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --text: #111827;
  --muted: #64748b;
  --line: #e5e7eb;
  --soft: #f8fafc;
  --blue: #2563eb;
  --blue-soft: #eef6ff;
  --teal: #14b8a6;
  --amber: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, #edf2f7 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

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

.page {
  width: min(100%, 580px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 16px
    max(36px, env(safe-area-inset-bottom));
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 30px 20px 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 56px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(10px);
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--blue), var(--teal), var(--amber));
}

h1,
h2,
p {
  margin: 0;
}

.brand-mark {
  display: flex;
  width: fit-content;
  min-width: 96px;
  min-height: 42px;
  margin: 0 auto 16px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: #0f172a;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.18);
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  text-align: center;
}

.subtitle {
  margin-top: 9px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

.name-field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.name-field span {
  flex: 0 0 auto;
  min-width: 42px;
  margin-bottom: 0;
  color: #334155;
  font-size: 15px;
  font-weight: 800;
}

.name-field input {
  flex: 1;
  width: 0;
  height: 42px;
  min-width: 0;
  padding: 0 4px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
  font-size: 17px;
}

.name-field:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.name-field input:disabled {
  color: #64748b;
}

.result-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 156px;
  margin-top: 18px;
  padding: 20px;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.result-box.active {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.result-box.error {
  background: #fff1f2;
  border-color: #fb7185;
}

.result-box.error .placeholder {
  color: #be123c;
  font-weight: 800;
}

.result {
  color: #0f172a;
  font-size: 82px;
  font-weight: 900;
  line-height: 1;
}

.placeholder {
  color: #94a3b8;
  font-size: 19px;
  line-height: 1.45;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.stat {
  position: relative;
  display: flex;
  min-height: 66px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--teal);
}

.stat:nth-child(2)::before {
  background: var(--amber);
}

.stat strong {
  font-size: 23px;
  line-height: 1.1;
}

.stat span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.primary-button {
  display: block;
  width: 100%;
  min-height: 50px;
  margin-top: 16px;
  color: #ffffff;
  background: var(--blue);
  border: 0;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.primary-button:disabled {
  background: #94a3b8;
  box-shadow: none;
}

.history {
  margin-top: 22px;
  padding: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.07);
}

h2 {
  margin: 0;
  padding: 16px 18px;
  color: #334155;
  font-size: 18px;
  background: linear-gradient(90deg, #f8fafc, #ffffff);
  border-bottom: 1px solid #e2e8f0;
}

.number-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 6px 12px 12px;
}

.number-chip {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 54px;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 12px 4px;
  color: #334155;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  border-radius: 0;
  font-size: 16px;
}

.number-chip:last-child {
  border-bottom: 0;
}

.draw-index {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
}

.draw-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1f2937;
  font-weight: 700;
}

.draw-number {
  display: grid;
  min-width: 42px;
  height: 34px;
  place-items: center;
  color: #ffffff;
  background: var(--blue);
  border-radius: 8px;
  font-size: 20px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.empty-chip {
  display: block;
  padding: 18px 8px;
  color: #94a3b8;
  text-align: center;
}
