:root {
  color-scheme: only light;
  --page-bg: #f8f4ec;
  --panel-text: #fffdf8;
  --ink: #1f2937;
  --muted: rgba(255, 253, 248, 0.8);
  --card: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.2);
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  --team-one: #0f766e;
  --team-two: #b45309;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  touch-action: manipulation;
}

body {
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.5), transparent 35%),
    linear-gradient(135deg, #fff9ef 0%, var(--page-bg) 45%, #e6f0ef 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  gap: 1rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(10px);
}

.brand-mark__goal,
.brand-mark__track {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.1rem;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  font-size: clamp(1rem, 1.2vw + 0.9rem, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-mark__goal {
  background: linear-gradient(135deg, #111827, #2f3c58);
  color: #fffdf8;
}

.brand-mark__track {
  border: 1px solid rgba(17, 24, 39, 0.12);
  color: #111827;
}

.brand-copy {
  margin: 0.45rem 0 0;
  color: rgba(31, 41, 55, 0.72);
  font-size: 0.95rem;
}

.reset-button,
.ghost-button,
.danger-button {
  border-radius: 999px;
  padding: 0.9rem 1.2rem;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background-color 140ms ease;
}

.reset-button {
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.reset-button:hover,
.ghost-button:hover,
.danger-button:hover,
.team-panel:hover {
  transform: translateY(-1px);
}

.scoreboard {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.team-panel {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  color: var(--panel-text);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  border-radius: 2rem;
  box-shadow: var(--shadow);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.24), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 38%),
    linear-gradient(145deg, rgba(7, 10, 20, 0.22), transparent 52%),
    linear-gradient(145deg, var(--panel-color), var(--panel-color));
}

.team-panel::after {
  content: "";
  position: absolute;
  inset: auto -10% -30% auto;
  width: 16rem;
  height: 16rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  filter: blur(10px);
}

.team-panel__inner {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: clamp(1rem, 2vw, 1.5rem);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
}

.team-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.team-name-field {
  min-width: 0;
}

.team-name-field input {
  width: min(100%, 11ch);
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: clamp(1.8rem, 1.2rem + 2vw, 3.2rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.team-name-field input::placeholder {
  color: rgba(255, 253, 248, 0.8);
}

.team-name-field input:focus-visible,
.color-control input:focus-visible,
.reset-button:focus-visible,
.ghost-button:focus-visible,
.danger-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: 4px;
}

.color-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.color-control__label {
  display: inline-flex;
  align-items: center;
  min-height: 2.3rem;
  padding: 0.1rem 0.75rem;
  border-radius: 999px;
  background: rgba(7, 10, 20, 0.2);
  color: rgba(255, 253, 248, 0.92);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.color-control input {
  width: 2.6rem;
  height: 2.6rem;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
}

.color-control input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-control input::-webkit-color-swatch {
  border: 2px solid rgba(255, 253, 248, 0.68);
  border-radius: 50%;
}

.color-control input::-moz-color-swatch {
  border: 2px solid rgba(255, 253, 248, 0.68);
  border-radius: 50%;
}

.score-readout {
  align-self: center;
  justify-self: center;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.35rem;
  width: 100%;
}

.score-readout__label,
.tap-hint {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.84rem;
}

.score-readout__value {
  font-size: clamp(6.5rem, 18vw, 13rem);
  line-height: 0.8;
  font-weight: 700;
  letter-spacing: -0.08em;
}

.score-adjust {
  justify-self: center;
  min-height: 2.8rem;
  min-width: 4.25rem;
  padding: 0.35rem 1rem 0.55rem;
  border-radius: 999px;
  background: rgba(7, 10, 20, 0.22);
  border: 1px solid rgba(255, 253, 248, 0.18);
  color: #fffdf8;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.score-adjust:hover {
  transform: translateY(-1px);
  background: rgba(7, 10, 20, 0.3);
}

.tap-hint {
  align-self: end;
  justify-self: center;
}

.confirm-dialog {
  border: 0;
  padding: 0;
  border-radius: 1.5rem;
  width: min(92vw, 26rem);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
}

.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
}

.confirm-dialog__content {
  margin: 0;
  padding: 1.4rem;
  background: #fffdf8;
  color: #111827;
}

.confirm-dialog__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.confirm-dialog__copy {
  margin: 0.5rem 0 0;
  color: rgba(17, 24, 39, 0.75);
  line-height: 1.5;
}

.confirm-dialog__actions {
  margin-top: 1.2rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.ghost-button {
  background: rgba(17, 24, 39, 0.08);
  color: #111827;
}

.danger-button {
  background: #b91c1c;
  color: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  .scoreboard {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .team-name-field input {
    width: min(100%, 12ch);
  }

  .brand-mark {
    gap: 0.25rem;
    padding-inline: 0.45rem;
  }

  .brand-mark__goal,
  .brand-mark__track {
    padding-inline: 0.55rem;
  }
}
