* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #eef2f5;
  color: #17202b;
}

.topbar {
  min-height: 68px;
  background: #121b18;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  gap: 20px;
}

.topbar small {
  letter-spacing: .16em;
  color: #a8c5b5;
}

.topbar h1 {
  font-size: 22px;
  margin: 2px 0 0;
}

.topbar nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar a {
  color: #fff;
  text-decoration: none;
  padding: 8px 11px;
  border: 1px solid #52665d;
  border-radius: 8px;
}

.wrap {
  width: min(1080px, calc(100% - 28px));
  margin: 24px auto 50px;
}

.hero {
  background: linear-gradient(135deg, #20352b, #111915);
  color: #fff;
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 16px;
  box-shadow: 0 14px 35px rgba(0, 0, 0, .13);
}

.hero h2 {
  margin: 5px 0 8px;
  font-size: clamp(24px, 5vw, 38px);
}

.hero p {
  margin: 0;
  color: #c9d8d1;
}

.kicker {
  font-size: 12px;
  letter-spacing: .18em;
}

.panel {
  background: #fff;
  border: 1px solid #d7dee3;
  border-radius: 16px;
  padding: 20px;
  margin-top: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .05);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.section-head small {
  color: #76828c;
  letter-spacing: .12em;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef2f5;
  color: #44515c;
  font-size: 12px;
  font-weight: 700;
}

.badge.hit {
  background: #dff5e7;
  color: #17663a;
}

.badge.miss {
  background: #fde7e8;
  color: #9d2630;
}

.oyaji-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.oyaji-card {
  appearance: none;
  width: 100%;
  border: 2px solid #dce2e6;
  background: #f8fafb;
  border-radius: 14px;
  padding: 18px 12px;
  cursor: pointer;
  text-align: left;
  transition: .15s;
}

.oyaji-card:hover {
  transform: translateY(-2px);
  border-color: #94a69c;
}

.oyaji-card.selected {
  border-color: #236b48;
  background: #eaf6ef;
  box-shadow: 0 0 0 2px rgba(35, 107, 72, .12);
}

.oyaji-card .num {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #17261f;
  color: #fff;
  font-weight: 800;
  margin-bottom: 12px;
}

.oyaji-card b {
  display: block;
  font-size: 16px;
  color: #17261f;
}

.oyaji-card span {
  display: block;
  color: #7a858e;
  font-size: 12px;
  margin-top: 4px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  gap: 10px;
}

.actions.split {
  justify-content: space-between;
  flex-wrap: wrap;
}

button,
.button-link {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  background: #205f42;
  color: #fff;
  text-decoration: none;
  display: inline-block;
}

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

.secondary {
  background: #e9eef1;
  color: #26333b;
}

.danger {
  background: #9e2f36;
}

.message {
  display: none;
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
}

.message.show {
  display: block;
}

.message.success {
  background: #e6f5eb;
  color: #1b6b3d;
}

.message.error {
  background: #fde9ea;
  color: #9b2f36;
}

.result-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.result-list li {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  border: 1px solid #e0e5e8;
  border-radius: 10px;
  padding: 11px 13px;
}

.result-list li:first-child {
  border-color: #d5ba68;
  background: #fff9e8;
}

.result-list strong {
  font-size: 18px;
}

.pick-mark {
  font-size: 12px;
  color: #236b48;
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 11px;
  border-bottom: 1px solid #e2e6e9;
  white-space: nowrap;
}

th {
  font-size: 12px;
  color: #6f7a83;
}

tr.me {
  background: #eef8f2;
}

td small {
  color: #236b48;
  font-weight: 700;
}

.test-panel {
  border-style: dashed;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .oyaji-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wrap {
    width: min(100% - 18px, 1080px);
  }

  .panel {
    padding: 14px;
  }
}

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

  .oyaji-card {
    padding: 13px 10px;
  }

  .oyaji-card b {
    font-size: 14px;
  }
}


/* =========================================================
   PWA STATUS
========================================================= */

.pwa-status {
  margin: .45rem 0 0;
  font-size: .82rem;
  opacity: .72;
}

.pwa-status[data-ready="1"] {
  font-weight: 700;
  opacity: .9;
}


/* =========================================================
   RACE COUNTDOWN
========================================================= */

.race-countdown {
  display: inline-flex !important;
  margin-top: 14px !important;
  padding: 8px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .09);
  color: #f3d77f !important;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.race-countdown.closing {
  background: rgba(190, 69, 60, .22);
  color: #ffd2cc !important;
}


/* =========================================================
   REWARD TICKET PANEL
========================================================= */

.ticket-panel {
  background: linear-gradient(180deg, #fff, #fbfcfb);
}

.ticket-balance {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #edf7f1;
  color: #175b3b;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.ticket-balance strong {
  font-size: 22px;
  line-height: 1;
}

.ticket-copy {
  margin: 0 0 14px;
  color: #59666f;
}

.reward-ad-button {
  width: 100%;
  min-height: 50px;
  font-size: 16px;
  background: #205f42;
}

.reward-ad-message {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: #6b767e;
  font-size: 13px;
}


/* =========================================================
   RACE WATCH / RECONNECT
========================================================= */

.result-list li.race-ready {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.55;
}

.result-list li.race-ready strong {
  display: block;
  width: 100%;
  line-height: 1.2;
}

.result-list li.race-ready span {
  display: block;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-list li.reconnect-ready strong {
  text-align: center;
  letter-spacing: .12em;
}

.result-list li.reconnect-ready {
  gap: 14px;
}

@media (max-width: 560px) {
  .result-list li.race-ready {
    gap: 9px;
    padding: 12px;
  }

  .result-list li.reconnect-ready {
    gap: 12px;
  }

  .result-list li.reconnect-ready strong {
    font-size: 16px;
  }

  .result-list li.race-ready span {
    font-size: 14px;
  }
}


/* =========================================================
   REWARD MODAL
========================================================= */

.reward-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(4px);
}

.reward-modal.is-open {
  display: flex;
}

.reward-modal-box {
  position: relative;
  width: min(100%, 420px);
  padding: 30px 24px 24px;
  border: 1px solid rgba(224, 187, 85, .42);
  border-radius: 18px;
  background: linear-gradient(
    145deg,
    #103d2d,
    #071f17
  );
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  text-align: center;
}

.reward-modal-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(224, 187, 85, .45);
  background: rgba(221, 185, 85, .08);
  font-size: 30px;
}

.reward-modal-title {
  margin: 0;
  color: var(--gold2);
  font-size: 21px;
  font-weight: 900;
}

.reward-modal-text {
  margin: 14px 0 0;
  color: #d4ded8;
  font-size: 14px;
  line-height: 1.8;
}

.reward-modal-text strong {
  color: var(--gold2);
  font-size: 18px;
}

.reward-modal-note {
  margin: 16px 0 0;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  color: #aebdb4;
  font-size: 12px;
  line-height: 1.6;
}

.reward-modal-close {
  width: 100%;
  margin-top: 20px;
  padding: 13px 18px;
  border: 1px solid rgba(224, 187, 85, .4);
  border-radius: 11px;
  background: rgba(224, 187, 85, .1);
  color: var(--gold2);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.reward-modal-close:hover {
  background: rgba(224, 187, 85, .16);
}

.reward-modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  color: #d7e1db;
  font-size: 20px;
  cursor: pointer;
}

.reward-modal-x:hover {
  background: rgba(255, 255, 255, .12);
}
