:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b1016;
  color: #eef3f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1080px;
  background:
    linear-gradient(180deg, rgba(36, 44, 54, 0.72), rgba(11, 16, 22, 0.82)),
    #0b1016;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

#app {
  min-height: 100vh;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 78px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1;
  font-weight: 760;
  letter-spacing: 0;
}

#clock {
  margin: 0;
  color: #9cadbd;
  font-size: 13px;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  min-width: 58px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  color: #c6d1dc;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.icon-btn.active {
  color: #091017;
  background: #eef3f8;
}

.history-panel {
  margin-top: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(14, 21, 29, 0.82);
  overflow: hidden;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.history-head h2 {
  margin: 0 0 5px;
  font-size: 17px;
}

.history-head p {
  margin: 0;
  color: #93a3b5;
  font-size: 12px;
}

.history-mode {
  display: flex;
  gap: 7px;
}

.mode-btn,
.query-btn {
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  color: #d6e0ea;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
}

.mode-btn {
  min-width: 70px;
}

.mode-btn.active,
.query-btn {
  color: #091017;
  background: #eef3f8;
}

.history-form {
  display: flex;
  gap: 10px;
  align-items: end;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.period-fields,
.hash-fields {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1.8fr 1fr 0.8fr;
  gap: 10px;
}

.hash-fields {
  grid-template-columns: 1fr;
}

.hidden {
  display: none !important;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: #91a2b3;
  font-size: 11px;
}

select,
input {
  width: 100%;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  padding: 0 10px;
  color: #eef3f8;
  background: rgba(6, 10, 15, 0.85);
  outline: none;
}

.query-btn {
  min-width: 76px;
}

.history-result {
  min-height: 54px;
  padding: 12px 16px;
  color: #9cadbd;
  font-size: 12px;
}

.result-number {
  margin-bottom: 10px;
  color: #f7fbff;
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.result-grid {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 12px;
  align-items: start;
}

.result-grid span {
  color: #8294a7;
}

.result-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #dce6ef;
  font-weight: 600;
}

.error-text {
  color: #ffb0a7;
}

.radar-panel {
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(14, 21, 29, 0.82);
  overflow: hidden;
}

.radar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.radar-head h2 {
  margin: 0 0 5px;
  font-size: 17px;
}

.radar-head p {
  margin: 0;
  color: #93a3b5;
  font-size: 12px;
}

.radar-total {
  min-width: 90px;
  text-align: right;
  color: #dce6ef;
  font-size: 13px;
  font-weight: 700;
}

.alarm-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.alarm-empty,
.alarm-item {
  min-height: 54px;
  padding: 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
}

.alarm-empty {
  grid-column: 1 / -1;
  color: #91a2b3;
}

.alarm-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.alarm-item.warn {
  border-color: rgba(255, 209, 102, 0.45);
}

.alarm-item.danger {
  border-color: rgba(255, 105, 97, 0.55);
  background: rgba(255, 105, 97, 0.09);
}

.alarm-item strong,
.alarm-item span {
  display: block;
}

.alarm-item strong {
  margin-bottom: 5px;
  color: #f7fbff;
  font-size: 12px;
}

.alarm-item span {
  color: #aebdcb;
  font-size: 11px;
  line-height: 1.35;
}

.radar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 16px 14px;
}

.radar-card {
  min-height: 92px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
}

.radar-card.warn {
  border-color: rgba(255, 209, 102, 0.45);
}

.radar-card.danger {
  border-color: rgba(255, 105, 97, 0.55);
}

.radar-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #dce6ef;
  font-size: 12px;
}

.radar-card-top span {
  color: #91a2b3;
}

.radar-card-main {
  margin-top: 10px;
  color: #f7fbff;
  font-size: 18px;
  font-weight: 800;
}

.radar-card p {
  margin: 8px 0 0;
  color: #9cadbd;
  font-size: 11px;
  line-height: 1.35;
}

.games {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 18px;
}

.chain {
  min-height: calc(100vh - 124px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(14, 21, 29, 0.9);
  overflow: hidden;
}

.chain-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chain-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.chain-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
}

h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.meta {
  margin-top: 7px;
  color: #93a3b5;
  font-size: 12px;
}

.chain-status {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: #9ff1c8;
  font-size: 12px;
}

.chain-status.offline {
  color: #ffb0a7;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.now-strip {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.now-strip > div {
  min-width: 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.035);
}

.now-strip span {
  display: block;
  margin-bottom: 6px;
  color: #8fa0b1;
  font-size: 11px;
}

.now-strip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.game-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.game-tab {
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  background: rgba(10, 16, 23, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #d7e0ea;
  text-align: left;
  cursor: pointer;
}

.game-tab.active {
  background: color-mix(in srgb, var(--accent), #101722 76%);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.game-tab:hover {
  background: rgba(255, 255, 255, 0.08);
}

.game-tab strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.game-tab span {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #8fa0b1;
  font-size: 11px;
}

.slot-grid {
  flex: 1;
  overflow: auto;
  padding: 10px;
  display: grid;
  align-content: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.slot {
  min-height: 114px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 11px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
}

.slot.confirmed {
  border-color: color-mix(in srgb, var(--accent), transparent 50%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), transparent 88%), rgba(255, 255, 255, 0.045));
}

.slot.fetching {
  border-color: rgba(255, 217, 126, 0.55);
}

.slot-top,
.slot-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: #91a2b3;
  font-size: 11px;
}

.draw-number {
  font-variant-numeric: tabular-nums;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  color: #f7fbff;
}

.slot.confirmed .draw-number {
  color: color-mix(in srgb, var(--accent), white 26%);
}

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

  .chain {
    min-height: 560px;
  }

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