:root {
  color-scheme: light;
  --ink: #182033;
  --muted: #647087;
  --paper: #ffffff;
  --soft: #f4f7fb;
  --line: #dbe3ef;
  --blue: #2364aa;
  --blue-strong: #164a85;
  --green: #1f7a5c;
  --coral: #d95d39;
  --amber: #a66300;
  --shadow: 0 18px 45px rgb(24 32 51 / 9%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(135deg, rgb(35 100 170 / 10%), transparent 34%),
    linear-gradient(315deg, rgb(217 93 57 / 10%), transparent 38%),
    var(--soft);
  color: var(--ink);
}

button,
input,
select,
textarea {
  max-width: 100%;
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 700;
  overflow-wrap: anywhere;
}

button:hover {
  filter: brightness(1.08);
}

button.secondary {
  background: #e8eef7;
  color: var(--ink);
}

button.danger {
  background: #a7352a;
}

button.ghost {
  min-height: 34px;
  padding: 0 10px;
  background: transparent;
  color: var(--blue);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

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

.inline-check input {
  width: auto;
  min-height: auto;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  width: min(1180px, calc(100% - 28px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  font-size: 1.3rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 1.15rem;
}

.family-pill {
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.container {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.gate-panel {
  width: min(520px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.gate-panel h1,
.section h2,
.card h3 {
  margin: 0;
  letter-spacing: 0;
}

.gate-panel h1 {
  font-size: clamp(2.2rem, 9vw, 4.6rem);
  line-height: 0.96;
}

.lead {
  color: var(--muted);
  line-height: 1.65;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 20px;
  align-items: start;
}

.section,
.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.section {
  padding: 22px;
  box-shadow: var(--shadow);
}

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

.section h2 {
  font-size: 1.25rem;
}

.section > h3 {
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.card {
  padding: 16px;
}

.prize-card {
  display: grid;
  gap: 10px;
}

.prize-card h3,
.prize-card p {
  margin: 0;
}

.prize-image,
.podium-prize-image {
  width: 100%;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fbff;
}

.prize-image {
  aspect-ratio: 16 / 9;
}

.admin-thumb {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.metric {
  font-size: 2rem;
  font-weight: 900;
}

.odds-card {
  display: grid;
  gap: 10px;
}

.odds-card h3,
.odds-card p {
  margin: 0;
}

.mini-chart {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf6;
}

.mini-chart span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  max-width: 100%;
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef4fb;
  color: var(--blue-strong);
  font-size: 0.9rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.tag[title] {
  cursor: help;
}

.tag.green {
  background: #e8f5f0;
  color: var(--green);
}

.tag.coral {
  background: #fff0eb;
  color: var(--coral);
}

.tag.amber {
  background: #fff5d8;
  color: #9b6500;
}

.image-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.site-image {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.site-image img,
.image-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #eef4fb;
}

.fit-contain {
  object-fit: contain;
}

.fit-cover {
  object-fit: cover;
}

.site-image-body {
  padding: 13px 14px 15px;
}

.site-image h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.site-image p {
  margin: 0;
  line-height: 1.45;
}

.image-preview {
  border-radius: 6px;
  border: 1px solid var(--line);
}

.name-cloud {
  min-height: 140px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.name-cloud canvas {
  display: none;
  width: 100%;
  height: auto;
}

.name-cloud.is-rendered canvas {
  display: block;
}

.name-cloud-fallback {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.name-cloud.is-rendered .name-cloud-fallback {
  display: none;
}

.podium-grid,
.ticket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.birth-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.birth-list-item {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.birth-list-item.reserved {
  border-color: rgb(217 93 57 / 32%);
  background: #fffaf7;
}

.birth-list-item.group-open {
  border-color: rgb(241 173 45 / 58%);
  background: #fffdf4;
}

.birth-list-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #eef4fb;
}

.birth-list-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.birth-list-body h3,
.birth-list-body p {
  margin: 0;
}

.birth-list-reserve {
  margin-top: 4px;
}

.birth-list-participants,
.birth-list-admin-participants {
  display: grid;
  gap: 8px;
}

.birth-list-participant {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgb(241 173 45 / 32%);
  border-radius: 8px;
  background: rgb(255 255 255 / 72%);
}

.birth-list-participant .tag {
  width: fit-content;
  min-height: 24px;
  padding: 2px 8px;
  font-size: 0.78rem;
}

.birth-list-comment {
  padding: 10px 12px;
  border-left: 3px solid var(--coral);
  border-radius: 6px;
  background: rgb(217 93 57 / 8%);
  color: var(--ink);
  font-style: italic;
}

.podium-item,
.record-item,
.prediction-ticket {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.podium-item,
.record-item {
  padding: 14px;
}

.podium-item span,
.podium-item small,
.record-item span,
.record-item small,
.ticket-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.podium-item strong,
.record-item strong {
  display: block;
  margin: 4px 0;
  font-size: 1.25rem;
}

.consensus-box {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgb(31 122 92 / 24%);
  border-radius: 8px;
  background: #f1faf6;
}

.consensus-box strong {
  display: block;
  margin-top: 8px;
}

.consensus-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e4;
}

.consensus-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.record-list {
  display: grid;
  gap: 10px;
}

.family-overview-card {
  display: grid;
  gap: 14px;
}

.family-overview-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.family-overview-summary div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #eef4fb;
}

.family-overview-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 1.35rem;
}

.family-overview-list {
  display: grid;
  gap: 8px;
}

.family-overview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.family-overview-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.family-overview-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.admin-family-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.admin-family-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.admin-family-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-family-head h3,
.admin-family-head p {
  margin: 0;
}

.admin-family-invitations,
.admin-member-list {
  display: grid;
  gap: 8px;
}

.admin-family-invitations span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.admin-member-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 0.75fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.admin-member-row strong,
.admin-member-row span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-member-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-export-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 900;
}

.admin-export-panel[open] summary {
  margin-bottom: 14px;
  color: var(--ink);
}

.prediction-ticket {
  padding: 16px;
}

.ticket-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ticket-head h3,
.ticket-main strong {
  display: block;
  margin: 0;
}

.ticket-main {
  margin: 16px 0;
}

.ticket-main strong {
  font-size: 1.5rem;
}

.ticket-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.ticket-facts span {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f4f7fb;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.vs-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.vs-tile {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.vs-tile.family {
  border-color: rgb(31 122 92 / 28%);
  background: linear-gradient(180deg, #ffffff, #f1faf6);
}

.vs-tile.global {
  background: linear-gradient(180deg, #ffffff, #f5f8fc);
}

.vs-badge {
  width: 42px;
  height: 42px;
  align-self: center;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 24px rgb(24 32 51 / 16%);
}

.vs-lines {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.vs-line {
  display: grid;
  gap: 3px;
}

.vs-line span,
.vs-line small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.vs-line strong {
  font-size: 1.05rem;
}

.delta-good {
  color: var(--green) !important;
}

.delta-bad {
  color: #b83b2f !important;
}

.delta-neutral {
  color: var(--muted) !important;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tab {
  background: #e8eef7;
  color: var(--ink);
}

.tab.active {
  background: var(--blue);
  color: white;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.full {
  grid-column: 1 / -1;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  -webkit-overflow-scrolling: touch;
}

.table tbody,
.table thead {
  min-width: 640px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.ranking-podium {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.podium-card {
  position: relative;
  min-height: 280px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.podium-card.first {
  border-color: rgb(166 99 0 / 42%);
  background: linear-gradient(145deg, #fff8e8, #ffffff 62%);
  box-shadow: 0 18px 40px rgb(166 99 0 / 13%);
}

.podium-card.second {
  border-color: rgb(100 112 135 / 52%);
  background:
    radial-gradient(circle at 85% 16%, rgb(255 255 255 / 90%), transparent 24%),
    linear-gradient(145deg, #eef3f8, #ffffff 58%, #f7f9fc);
  box-shadow: 0 16px 34px rgb(100 112 135 / 12%);
}

.podium-card.third {
  border-color: rgb(166 99 0 / 52%);
  background:
    radial-gradient(circle at 86% 20%, rgb(217 93 57 / 24%), transparent 24%),
    linear-gradient(145deg, #ffe4d6, #ffffff 62%, #fff1e8);
  box-shadow: 0 16px 34px rgb(166 99 0 / 14%);
}

.podium-rank,
.podium-label,
.podium-prize {
  position: relative;
  z-index: 3;
}

.podium-prize-image {
  position: relative;
  z-index: 1;
  height: clamp(150px, 18vw, 220px);
  margin-bottom: 14px;
  background: white;
}

.podium-card.first .podium-prize-image {
  height: clamp(170px, 20vw, 245px);
}

.podium-rank {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.podium-card h3 {
  position: relative;
  z-index: 3;
  margin: 12px 0 4px;
  font-size: 1.35rem;
}

.podium-score {
  position: relative;
  z-index: 3;
  margin: 12px 0 6px;
  font-size: 2rem;
  font-weight: 900;
}

.podium-label {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.podium-prize {
  margin: 12px 0 0;
  color: var(--green);
  font-weight: 900;
}

.confetti,
.firework,
.bronze-bubble,
.silver-ribbon {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.confetti {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  opacity: 0;
  animation: sparkle-burst 2.8s ease-out infinite;
  filter: drop-shadow(0 0 5px rgb(255 248 232 / 72%));
}

.confetti-a {
  top: 32px;
  left: 30%;
  background: var(--coral);
  box-shadow:
    0 -20px 0 -1px var(--amber),
    18px -8px 0 -1px var(--blue),
    18px 12px 0 -1px var(--green),
    0 22px 0 -1px var(--coral),
    -18px 10px 0 -1px var(--blue),
    -18px -10px 0 -1px var(--green);
}

.confetti-b {
  top: 78px;
  right: 24%;
  background: var(--green);
  animation-delay: -1.15s;
  box-shadow:
    0 -18px 0 -1px var(--blue),
    16px -6px 0 -1px var(--amber),
    16px 10px 0 -1px var(--coral),
    0 20px 0 -1px var(--green),
    -16px 8px 0 -1px var(--amber),
    -16px -8px 0 -1px var(--blue);
}

.confetti-c {
  left: 48%;
  bottom: 58px;
  background: var(--amber);
  animation-delay: -0.55s;
  box-shadow:
    0 -22px 0 -1px var(--coral),
    22px -10px 0 -1px var(--green),
    24px 12px 0 -1px var(--blue),
    0 24px 0 -1px var(--amber),
    -22px 12px 0 -1px var(--coral),
    -24px -12px 0 -1px var(--green);
}

.firework {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  opacity: 0;
  animation: firework-pop 2.4s ease-out infinite;
  filter: drop-shadow(0 0 7px rgb(166 99 0 / 35%));
}

.firework-a {
  top: 24px;
  right: 44px;
}

.firework-b {
  top: 54px;
  left: 44px;
  animation-delay: -1s;
}

.firework-c {
  right: 54px;
  bottom: 62px;
  animation-delay: -1.65s;
}

.silver-ribbon {
  inset: -20% auto -20% -78%;
  width: 62%;
  transform: skewX(-18deg);
  background: linear-gradient(90deg, transparent 0%, rgb(255 255 255 / 28%) 28%, rgb(255 255 255 / 95%) 50%, rgb(186 198 214 / 42%) 62%, transparent 100%);
  filter: blur(0.2px);
  animation: silver-shine 2.7s ease-in-out infinite;
}

.bronze-bubble {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff1e8, #c26a35 44%, #8f4b22 100%);
  opacity: 0.52;
  animation: bronze-float 3.2s ease-in-out infinite;
}

.bubble-a {
  right: 18px;
  top: 26px;
}

.bubble-b {
  right: 58px;
  bottom: 34px;
  animation-delay: -1.4s;
}

.bubble-c {
  left: 30px;
  bottom: 24px;
  animation-delay: -2.1s;
}

@keyframes sparkle-burst {
  0% {
    opacity: 0;
    transform: scale(0.45) rotate(0deg);
  }
  18% {
    opacity: 0.95;
  }
  72% {
    opacity: 0.4;
  }
  100% {
    opacity: 0;
    transform: scale(1.35) rotate(34deg);
  }
}

@keyframes firework-pop {
  0% {
    opacity: 0;
    box-shadow: 0 0 0 0 var(--amber);
  }
  24% {
    opacity: 1;
    box-shadow: 0 -22px 0 0 var(--amber), 20px -10px 0 0 var(--coral), 20px 12px 0 0 var(--green), 0 22px 0 0 var(--blue), -20px 10px 0 0 var(--coral), -20px -12px 0 0 var(--green);
  }
  70%,
  100% {
    opacity: 0;
    box-shadow: 0 -44px 0 -3px var(--amber), 38px -20px 0 -3px var(--coral), 38px 22px 0 -3px var(--green), 0 44px 0 -3px var(--blue), -38px 20px 0 -3px var(--coral), -38px -22px 0 -3px var(--green);
  }
}

@keyframes silver-shine {
  0% {
    transform: translateX(0) skewX(-18deg);
  }
  56%,
  100% {
    transform: translateX(370%) skewX(-18deg);
  }
}

@keyframes bronze-float {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-12px) scale(1.12);
  }
}

.official-result-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.official-result-panel h3 {
  margin: 0;
}

.official-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.official-result-item {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.official-result-item span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.official-result-item strong {
  display: block;
  margin-top: 3px;
}

.ranking-detail-row td {
  padding-top: 0;
  background: #f8fbff;
}

.score-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 12px 0;
}

.score-line {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.score-line.score-exact {
  border-color: rgb(31 122 92 / 45%);
  background: #f1faf6;
}

.score-line.score-close {
  border-color: rgb(31 122 92 / 30%);
  background: #f7fcf9;
}

.score-line.score-far {
  border-color: rgb(166 99 0 / 34%);
  background: #fff8e8;
}

.score-line.score-miss {
  border-color: rgb(217 93 57 / 34%);
  background: #fff3ee;
}

.score-line span,
.score-line small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.score-line strong {
  display: block;
  margin: 3px 0;
}

.score-points {
  min-width: 72px;
  text-align: right;
}

.score-points.score-exact strong,
.score-points.score-close strong {
  color: var(--green);
}

.score-points.score-far strong {
  color: var(--amber);
}

.score-points.score-miss strong {
  color: var(--coral);
}

.notice {
  padding: 12px 14px;
  border-left: 4px solid var(--amber);
  background: #fff8e8;
  color: #5c3b00;
}

.tutorial-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(24 32 51 / 54%);
}

.tutorial-dialog {
  position: relative;
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgb(24 32 51 / 28%);
}

.tutorial-dialog h2 {
  margin: 12px 42px 8px 0;
  font-size: clamp(1.55rem, 6vw, 2.3rem);
  letter-spacing: 0;
}

.tutorial-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  min-height: 38px;
  padding: 0;
  background: #e8eef7;
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.tutorial-steps {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.tutorial-step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.tutorial-step span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.tutorial-step p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.error {
  min-height: 24px;
  color: #9a2f25;
  font-weight: 800;
}

.success {
  min-height: 24px;
  color: var(--green);
  font-weight: 800;
}

.split-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.copy-url-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.copy-url-row input {
  min-width: 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .dashboard,
  .grid.two,
  .grid.three,
  .form-grid,
  .ranking-podium {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
  }

  .section-head {
    display: grid;
  }

  .vs-board {
    grid-template-columns: 1fr;
  }

  .vs-badge {
    justify-self: center;
  }

  .copy-url-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  body {
    background: var(--soft);
  }

  .topbar {
    position: static;
  }

  .topbar-inner,
  .container {
    width: min(100% - 20px, 1180px);
  }

  .topbar-inner {
    gap: 12px;
  }

  .brand {
    width: 100%;
    font-size: 1.08rem;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
  }

  .family-pill {
    max-width: 100%;
    font-size: 0.9rem;
  }

  .container {
    padding: 16px 0 36px;
  }

  .gate {
    min-height: 100dvh;
    padding: 14px;
    place-items: start center;
  }

  .gate-panel,
  .section,
  .card,
  .tutorial-dialog {
    border-radius: 8px;
  }

  .gate-panel,
  .section {
    padding: 16px;
  }

  .gate-panel {
    margin-top: 10px;
  }

  .lead {
    line-height: 1.5;
  }

  .tabs {
    margin-inline: -10px;
    padding: 0 10px 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .section-head {
    gap: 10px;
    margin-bottom: 14px;
  }

  .section h2 {
    font-size: 1.12rem;
  }

  .cards,
  .image-strip,
  .podium-grid,
  .ticket-grid,
  .birth-list-grid,
  .score-comparison {
    grid-template-columns: 1fr;
  }

  .card,
  .prediction-ticket,
  .birth-list-body {
    padding: 14px;
  }

  .metric {
    font-size: 1.65rem;
  }

  .tag-row {
    gap: 6px;
  }

  .tag {
    min-height: 28px;
    padding: 4px 9px;
    font-size: 0.82rem;
  }

  .name-cloud {
    min-height: 110px;
    padding: 10px;
  }

  .family-overview-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .family-overview-summary div {
    padding: 8px;
  }

  .family-overview-summary strong {
    font-size: 1.15rem;
  }

  .family-overview-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .family-overview-row span {
    white-space: normal;
  }

  .admin-family-head,
  .admin-member-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ticket-head {
    display: grid;
  }

  .ticket-main {
    margin: 12px 0;
  }

  .ticket-main strong {
    font-size: 1.28rem;
  }

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

  .vs-tile,
  .podium-card {
    padding: 14px;
  }

  .ranking-podium {
    margin: 14px 0;
  }

  .podium-card {
    min-height: 0;
  }

  .podium-prize-image,
  .podium-card.first .podium-prize-image {
    height: auto;
    aspect-ratio: 16 / 10;
  }

  .score-line {
    display: grid;
    gap: 8px;
  }

  .score-points {
    min-width: 0;
    text-align: left;
  }

  .table {
    margin-inline: -6px;
    width: calc(100% + 12px);
    font-size: 0.86rem;
  }

  .table th,
  .table td {
    padding: 10px 7px;
  }

  .split-actions,
  .row {
    align-items: stretch;
    flex-direction: column;
  }

  .split-actions button,
  .row button {
    width: 100%;
  }

  .copy-url-row {
    gap: 6px;
  }

  .official-result-grid {
    grid-template-columns: 1fr;
  }

  .tutorial-backdrop {
    padding: 10px;
    align-items: start;
  }

  .tutorial-dialog {
    max-height: calc(100dvh - 20px);
    padding: 18px;
  }

  .tutorial-step {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .tutorial-step span {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 420px) {
  button {
    width: 100%;
    padding-inline: 12px;
  }

  button.ghost {
    width: auto;
  }

  .tab {
    width: auto;
  }

  .gate-panel,
  .section {
    padding: 14px;
  }

  .brand {
    align-items: flex-start;
  }

  .family-overview-summary,
  .ticket-facts {
    grid-template-columns: 1fr;
  }

  .birth-list-image,
  .site-image img,
  .image-preview,
  .prize-image {
    aspect-ratio: 4 / 3;
  }

  .podium-score {
    font-size: 1.65rem;
  }

  .podium-card h3 {
    font-size: 1.15rem;
  }

  .table {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .confetti,
  .firework,
  .bronze-bubble,
  .silver-ribbon {
    animation: none;
  }
}
