:root {
  --bg-base: #0b0f19;
  --bg-elevated: #1a2133;
  --bg-soft: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(245, 197, 66, 0.28);
  --text-primary: #edf0f7;
  --text-secondary: #9ca3ba;
  --text-muted: #666d86;
  --gold: #f5c542;
  --gold-dark: #cb9727;
  --gold-glow: rgba(245, 197, 66, 0.2);
  --cyan: #5dd6ff;
  --danger: #f43f5e;
  --success: #44d49b;
  --shadow-deep: 0 18px 60px rgba(0, 0, 0, 0.45);
  --shadow-gold: 0 0 36px rgba(245, 197, 66, 0.12);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-full: 9999px;
  --font-body: "BIZ UDPGothic", "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Meiryo", system-ui, sans-serif;
  --font-mono: "Roboto Mono", "SF Mono", "Courier New", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text-primary);
  background:
    radial-gradient(circle at 15% 0%, rgba(93, 214, 255, 0.12), transparent 30%),
    radial-gradient(circle at 100% 20%, rgba(245, 197, 66, 0.08), transparent 32%),
    linear-gradient(180deg, #0b0f19 0%, #090d15 100%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 1.5rem;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  background: rgba(8, 11, 18, 0.8);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #081019;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: -0.08em;
  box-shadow: 0 6px 24px var(--gold-glow);
}

.logo-wordmark {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.logo-accent {
  color: var(--gold);
}

.header-tagline {
  color: var(--text-muted);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
}

.page-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.95fr);
  gap: 1.25rem;
  align-items: start;
}

.primary-column,
.sidebar-column {
  display: grid;
  gap: 1rem;
}

.panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-deep);
}

.summary-panel,
.workspace-panel,
.jackpot-panel,
.results-card {
  padding: 1.6rem;
}

.jackpot-panel {
  padding: 1.2rem;
}

.jackpot-panel .zone-label {
  margin-bottom: 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.summary-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line);
}

.summary-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

#total-amount,
#hit-count {
  display: inline-flex;
  align-items: baseline;
  gap: 0.02em;
  font-family: var(--font-mono);
  font-size: clamp(1.55rem, 2.4vw, 2.2rem);
  font-weight: 900;
  color: var(--gold);
  line-height: 1.1;
}

.amount-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.35em) scale(0.92);
  animation: amount-digit-reveal 360ms cubic-bezier(0.18, 0.8, 0.22, 1) forwards;
}

.amount-char.is-digit {
  min-width: 0.62em;
  text-align: center;
}

@keyframes amount-digit-reveal {
  from {
    opacity: 0;
    transform: translateY(0.35em) scale(0.92);
    filter: blur(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.comment-banner {
  padding: 0.95rem 1.15rem;
  border-radius: 16px;
  border: 1px solid rgba(93, 214, 255, 0.22);
  background: rgba(93, 214, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #b8dbef;
  font-size: 0.92rem;
  line-height: 1.55;
}

.comment-banner[data-tone="error"] {
  border-color: rgba(244, 63, 94, 0.28);
  background: rgba(244, 63, 94, 0.12);
  color: #ffbac9;
}

.comment-banner[data-tone="warning"] {
  border-color: rgba(245, 197, 66, 0.3);
  background: rgba(245, 197, 66, 0.1);
  color: #ffe199;
}

.comment-banner[data-tone="success"] {
  border-color: rgba(68, 212, 155, 0.25);
  background: rgba(68, 212, 155, 0.1);
  color: #baf3de;
}

.zone-card {
  padding: 1.35rem;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.workspace-panel {
  display: grid;
  gap: 1rem;
}

.zone-label,
.results-label {
  margin-bottom: 0.9rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.input-guide,
.results-copy {
  margin-bottom: 0.9rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.number-slots {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.slot-card {
  min-height: 92px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.slot-card--filled {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(245, 197, 66, 0.16), rgba(245, 197, 66, 0.05));
  box-shadow: inset 0 1px 0 rgba(245, 197, 66, 0.16), 0 0 18px rgba(245, 197, 66, 0.08);
}

.slot-value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  margin-top: 0.2rem;
}

.slot-card:not(.slot-card--filled) .slot-value {
  color: var(--text-muted);
}

.mini-clear {
  min-width: 34px;
  height: 24px;
  padding: 0 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(244, 63, 94, 0.22);
  background: rgba(244, 63, 94, 0.1);
  color: #ff9bb3;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mini-clear:not(:disabled):hover {
  background: rgba(244, 63, 94, 0.2);
}

.mini-clear:disabled {
  opacity: 0.25;
  cursor: default;
}

.action-row {
  display: flex;
  gap: 0.7rem;
  margin-top: 1.25rem;
}

.action-button {
  min-height: 48px;
  padding: 0 1.3rem;
  border-radius: 12px;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.action-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-button.primary {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #091019;
  box-shadow: 0 10px 26px var(--gold-glow);
}

.action-button.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text-primary);
}

.keyboard-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.48rem;
}

.key-button {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: 700;
  cursor: pointer;
}

.key-button:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(245, 197, 66, 0.08);
}

.key-button.is-selected {
  color: var(--gold);
  border-color: var(--line-strong);
  background: rgba(245, 197, 66, 0.12);
}

.key-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.preset-zone {
  margin-top: 1rem;
}

.preset-list {
  display: grid;
  gap: 0.65rem;
}

.preset-button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  border-radius: 16px;
  padding: 1rem 1.05rem;
  cursor: pointer;
  display: grid;
  gap: 0.35rem;
}

.preset-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.preset-title {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.preset-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: rgba(93, 214, 255, 0.12);
  color: var(--cyan);
}

.preset-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mini-ball {
  min-width: 30px;
  height: 30px;
  padding: 0 0.45rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(245, 197, 66, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold);
  background: rgba(245, 197, 66, 0.08);
}

.sidebar-column {
  position: sticky;
  top: 92px;
}

.jackpot-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.38rem;
  align-items: stretch;
}

.jackpot-card {
  width: 100%;
  height: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.12), rgba(93, 214, 255, 0.06));
  border: 1px solid var(--line-strong);
  color: var(--text-primary);
  box-shadow: var(--shadow-gold);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.jackpot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.jackpot-meta {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex: 1;
}

.jackpot-rank {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.jackpot-amount {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--gold);
  white-space: nowrap;
}

.jackpot-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.45rem;
}

.jackpot-icon {
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
}

.jackpot-ball {
  min-width: 24px;
  height: 24px;
  padding: 0 0.3rem;
  font-size: 0.64rem;
}

@media (min-width: 1101px) {
  .jackpot-card {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  .jackpot-numbers {
    margin-top: 0.35rem;
  }
}

.jackpot-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.84rem;
}

.results-card {
  border-color: var(--line-strong);
}

.results-shell {
  display: grid;
  gap: 0.85rem;
  height: 720px;
}

.results-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.85rem;
  height: 100%;
  min-height: 0;
}

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
}

.results-head .results-label {
  margin-bottom: 0.9rem;
}

.results-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.sort-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.sort-chip:hover,
.sort-chip:focus-visible,
.sort-chip.current {
  color: var(--text-primary);
  border-color: var(--line-strong);
  background: rgba(245, 197, 66, 0.12);
  outline: none;
}

.result-detail-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 0.45rem;
}

.result-detail-box.empty-detail {
  color: var(--text-muted);
}

.result-detail-box strong {
  font-size: 0.95rem;
}

.detail-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.detail-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  padding-top: 0.15rem;
}

.detail-ball {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.detail-ball--matched {
  color: var(--gold);
  border-color: var(--line-strong);
  background: rgba(245, 197, 66, 0.12);
}

.detail-ball--bonus {
  color: #ff9bb3;
  border-color: rgba(255, 92, 168, 0.28);
  background: rgba(255, 92, 168, 0.12);
}

.detail-bonus-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin: 0 0.15rem;
}

.results-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

.results-list.empty-state {
  display: grid;
  place-items: center;
  min-height: 100%;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.result-history-list {
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow-y: auto;
  height: 100%;
  min-height: 0;
  background: rgba(255, 255, 255, 0.02);
}

.result-history-item + .result-history-item {
  border-top: 1px solid var(--line);
}

.result-link {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  border: 0;
  cursor: pointer;
}

.result-link:hover,
.result-link:focus-visible,
.result-link.current {
  background: rgba(245, 197, 66, 0.06);
  outline: none;
}

.result-rank {
  min-width: 56px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.rank-1,
.rank-2,
.rank-3,
.rank-4,
.rank-5 {
  background: rgba(245, 197, 66, 0.14);
  color: var(--gold);
  border: 1px solid rgba(245, 197, 66, 0.24);
}

.result-meta {
  min-width: 0;
}

.result-draw-no {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
}

.result-date {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.result-prize {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--gold);
  white-space: nowrap;
}

.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar-column {
    position: static;
  }

  .results-shell {
    height: auto;
    min-height: 0;
  }

  .jackpot-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .page-shell {
    padding: 1.25rem 1rem 3rem;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .number-slots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .header-tagline {
    display: none;
  }
}

@media (max-width: 640px) {
  .workspace-panel,
  .summary-panel,
  .jackpot-panel,
  .results-card {
    padding: 1.1rem;
  }

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

  .action-row {
    flex-direction: column;
  }
}
