﻿:root {
  --bg: #061315;
  --surface: rgba(255, 255, 255, 0.075);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --text: #f0fdfa;
  --muted: #99f6e4;
  --primary: #2dd4bf;
  --primary-dark: #0f766e;
  --accent: #facc15;
  --danger: #fb7185;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.12), transparent 360px), radial-gradient(circle at top right, rgba(250, 204, 21, 0.14), transparent 260px), var(--bg);
  color: var(--text);
}

body.settings-open,
body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.hero,
.panel,
.team-card,
.modal-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 24px;
}

.hero {
  position: sticky;
  top: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(1.9rem, 5vw, 3.4rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.08rem;
}

.subtitle {
  margin-bottom: 0;
  color: rgba(240, 253, 250, 0.72);
  font-size: 0.92rem;
}

.install-btn,
.score-btn,
.ghost-btn {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  color: white;
  font-weight: 850;
  touch-action: manipulation;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.install-btn,
.score-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.install-btn {
  padding: 12px 16px;
  white-space: nowrap;
}

.ghost-btn {
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

button:hover {
  transform: translateY(-2px);
}

.hero-actions,
.setting-actions,
.action-row,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.panel {
  padding: 16px;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(4px);
}

.setup-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(420px, 92vw);
  height: 100dvh;
  overflow: auto;
  border-radius: 24px 0 0 24px;
  transform: translateX(105%);
  transition: transform 0.22s ease;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.26), transparent 220px), #071b1c;
}

.settings-open .setup-panel {
  transform: translateX(0);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 12px 13px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  outline: none;
}

.scoreboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px minmax(0, 1fr);
  gap: 14px;
  margin: 14px 0;
}

.team-card {
  min-height: 300px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 26px;
}

.team-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.team-meta h2 {
  font-size: clamp(1.15rem, 4vw, 1.55rem);
}

.server-dot {
  order: 2;
  opacity: 0;
  width: fit-content;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.16);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 950;
}

.server-dot.active {
  opacity: 1;
}

.point {
  font-size: clamp(4.6rem, 13vw, 8rem);
  font-weight: 950;
  line-height: 1;
  text-align: center;
  letter-spacing: -0.1em;
  text-shadow: 0 10px 32px rgba(45, 212, 191, 0.2);
}

.score-btn {
  width: 100%;
  padding: 16px;
  font-size: 1rem;
}

.match-center {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  text-align: center;
  border-radius: 24px;
}

.status-pill {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(250, 204, 21, 0.14);
  color: #fde68a;
  font-size: 0.88rem;
  font-weight: 900;
}

.sets-row,
.games-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sets-row div,
.games-row div {
  padding: 12px 8px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
}

.sets-row span,
.games-row span {
  display: block;
  font-size: 2rem;
  font-weight: 950;
}

small {
  color: var(--muted);
  font-weight: 800;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.quick-actions .ghost-btn {
  min-height: 54px;
}

.timeline,
.history-list,
.saved-winners {
  min-height: auto;
  max-height: 210px;
  overflow: auto;
}

.set-chip,
.history-list li,
.winner-card,
.rules-grid div {
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
}

.history-list {
  padding-left: 22px;
}

.winner-card {
  display: grid;
  gap: 5px;
}

.winner-card strong {
  color: var(--accent);
  font-size: 1.05rem;
}

.winner-card span,
.winner-card small {
  color: #c7ffef;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.rules-grid strong,
.rules-grid span {
  display: block;
}

.rules-grid span {
  margin-top: 6px;
  color: #c7ffef;
  font-size: 0.9rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(720px, 100%);
  max-height: min(760px, 88dvh);
  overflow: auto;
  padding: 22px;
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.16), transparent 260px), #071b1c;
}

.modal-heading {
  position: sticky;
  top: -22px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -22px -22px 16px;
  padding: 18px 22px;
  background: linear-gradient(180deg, rgba(7, 27, 28, 0.98), rgba(7, 27, 28, 0.76));
  backdrop-filter: blur(12px);
}

.modal-heading h2 {
  margin-bottom: 0;
}

.match-over .score-btn {
  background: linear-gradient(135deg, #64748b, #334155);
}

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

  .scoreboard .match-center {
    grid-column: 1 / -1;
    order: -1;
  }
  .quick-actions,
  .rules-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .install-btn {
    flex: 1;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .hero {
    position: static;
    gap: 12px;
    padding: 14px;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .scoreboard {
    gap: 10px;
  }

  .team-card {
    min-height: 178px;
    padding: 14px;
    border-radius: 22px;
  }

  .team-meta {
    display: grid;
    gap: 8px;
  }

  .point {
    font-size: clamp(3.45rem, 18vw, 5rem);
  }

  .score-btn {
    padding: 13px 8px;
    font-size: 0.92rem;
  }

  .match-center {
    padding: 14px;
  }

  .sets-row span,
  .games-row span {
    font-size: 1.8rem;
  }

  .setup-panel {
    width: min(360px, 94vw);
    border-radius: 22px 0 0 22px;
  }

  .setup-panel .section-heading {
    position: sticky;
    top: 0;
    z-index: 1;
    padding-bottom: 12px;
    background: linear-gradient(180deg, rgba(7, 27, 28, 0.96), rgba(7, 27, 28, 0.76));
    backdrop-filter: blur(12px);
  }

  .setting-actions {
    width: 100%;
  }

  .setting-actions .ghost-btn,
  .score-btn,
  .install-btn,
  .ghost-btn {
    width: 100%;
  }

  .modal-overlay {
    align-items: end;
    padding: 10px;
  }

  .modal-card {
    max-height: 84dvh;
    padding: 18px;
    border-radius: 24px 24px 18px 18px;
  }

  .modal-heading {
    align-items: stretch;
    flex-direction: column;
    margin: -18px -18px 14px;
    padding: 16px 18px;
  }
}

@media (max-width: 390px) {
  .hero {
    padding: 12px;
  }

  h1 {
    font-size: 2.2rem;
  }

  .team-card {
    min-height: 164px;
  }

  .point {
    font-size: 3.4rem;
  }

  .score-btn {
    font-size: 0.84rem;
  }
}

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

  .scoreboard .match-center {
    grid-column: auto;
  }

  .team-card {
    min-height: 150px;
  }

  .team-meta {
    display: flex;
    align-items: center;
  }
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

.app-shell,
.hero,
.panel,
.team-card,
.match-center,
.scoreboard,
.quick-actions,
.hero-actions,
.setting-actions,
.form-grid,
.rules-grid,
.modal-card {
  min-width: 0;
  max-width: 100%;
}

button,
input,
select {
  min-width: 0;
  max-width: 100%;
}

.install-btn,
.ghost-btn,
.score-btn {
  white-space: normal;
}

@media (max-width: 560px) {
  .scoreboard,
  .quick-actions,
  .rules-grid {
    width: 100%;
    max-width: 100%;
  }

  .sets-row,
  .games-row {
    min-width: 0;
  }

  .sets-row div,
  .games-row div {
    min-width: 0;
  }

  .setup-panel {
    width: 92vw;
    max-width: 92vw;
  }

  .modal-overlay {
    width: 100vw;
    max-width: 100vw;
  }
}

.confirm-card {
  width: min(420px, 100%);
}

.confirm-message {
  margin: 4px 0 18px;
  color: rgba(240, 253, 250, 0.82);
  line-height: 1.5;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 430px) {
  .confirm-actions {
    grid-template-columns: 1fr;
  }
}

