:root {
  color-scheme: light;
  --blue: #24bde8;
  --blue-soft: #eafaff;
  --border: #d9f3fb;
  --text: #111827;
  --muted: #8793a0;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: linear-gradient(180deg, #f9fdff 0%, #eef9fd 100%);
  color: var(--text);
}
.wrap {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 38px 14px 24px;
}
.card {
  width: min(390px, 100%);
  background: rgba(255,255,255,.97);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(17, 157, 205, .11);
  padding: 15px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.title-block { flex: 1; }
h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -.2px;
  font-weight: 900;
}
.period {
  margin: 7px 0 0;
  color: #98a2ad;
  font-size: 14px;
}
.period b {
  color: #151b23;
  font-size: 16px;
  letter-spacing: .2px;
}
.next-block {
  min-width: 84px;
  text-align: right;
  padding-top: 2px;
}
.next-label {
  color: #7a8793;
  font-size: 12px;
  line-height: 1;
  margin-bottom: 4px;
}
.next-time {
  color: #0e1726;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .2px;
}
.scratch-card {
  position: relative;
  overflow: hidden;
  height: 148px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #eef5f8;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 10px 22px rgba(10, 46, 64, .07);
  user-select: none;
  touch-action: none;
  margin-top: 18px;
}
.result-panel {
  position: absolute;
  inset: 10px;
  z-index: 1;
  border-radius: 13px;
  background: linear-gradient(145deg, #fbffff, #effaff);
  border: 1px solid #e1f4f9;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.formula {
  font-size: 25px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .8px;
  color: #101827;
}
#scratchCanvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
}
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.action-btn {
  height: 42px;
  border-radius: 13px;
  border: 1px solid #d8e3ea;
  background: #fff;
  color: #1d2733;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 6px 15px rgba(14, 42, 59, .05);
}
.action-btn.primary {
  border-color: #87dff2;
  background: #ecfbff;
  color: #087ca2;
}
.action-btn:active { transform: translateY(1px); }
@media (max-width: 360px) {
  .card { padding: 14px; border-radius: 18px; }
  h1 { font-size: 19px; }
  .period { font-size: 13px; }
  .period b { font-size: 15px; }
  .scratch-card { height: 138px; }
  .formula { font-size: 23px; }
}
