*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', system-ui, sans-serif;
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --glass: rgba(255, 255, 255, 0.72);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --separator: rgba(60, 60, 67, 0.12);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-secondary: rgba(120, 120, 128, 0.08);
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --accent-press: #0066d6;
  --red: #ff3b30;
  --green: #34c759;
  --orange: #ff9500;
  --purple: #af52de;
  --teal: #5ac8fa;
  --indigo: #5856d6;
  --pink: #ff2d55;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --glass: rgba(28, 28, 30, 0.78);
    --text: #f5f5f7;
    --text-secondary: #98989d;
    --text-tertiary: #636366;
    --separator: rgba(84, 84, 88, 0.45);
    --fill: rgba(120, 120, 128, 0.24);
    --fill-secondary: rgba(120, 120, 128, 0.16);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --accent-press: #409cff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.47;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding:
    max(0.75rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  width: 100%;
}

.header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.next-match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.next-match[hidden] {
  display: none !important;
}

.next-match__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.next-match__title {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.next-match__meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.next-match__countdown {
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
  white-space: nowrap;
}

.controls__actions {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
}

.controls__actions .btn-primary {
  flex: 1;
}

.btn-secondary {
  flex-shrink: 0;
  min-height: 50px;
  padding: 0.85rem 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--fill);
  color: var(--accent);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, transform 0.1s;
}

.btn-secondary:active {
  transform: scale(0.985);
}

.icon-btn--text {
  width: auto;
  min-width: 44px;
  padding: 0 0.85rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
}

.calendar__day--today .calendar__day-num {
  color: var(--accent);
  position: relative;
}

.calendar__day--today .calendar__day-num::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -3px;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.match-day-header {
  list-style: none;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 0.85rem 0 0.35rem;
  letter-spacing: -0.01em;
}

.match-day-header:first-child {
  padding-top: 0.15rem;
}

.header__eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.header__edition {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.header h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.header__subtitle {
  margin-top: 0.4rem;
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.doki-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 1rem 1.15rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
}

.doki-hero__copy {
  flex: 1;
  min-width: 0;
}

.doki-hero__badge {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.doki-hero__quote {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.doki-hero__quote--pop {
  transform: scale(1.03);
}

.doki-hero__hint {
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.doki-hero__btn {
  position: relative;
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  border-radius: 20px;
}

.doki-hero__img {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border: 2px solid var(--bg-elevated);
}

.doki-hero__btn--wiggle .doki-hero__img {
  animation: dokiWiggle 0.45s ease;
}

.doki-hero__btn--spin .doki-hero__img {
  animation: dokiSpin 0.7s ease;
}

.doki-hero__btn--jump .doki-hero__img {
  animation: dokiJump 0.65s ease;
}

.doki-hero__btn--bark .doki-hero__img {
  animation: dokiBark 0.5s ease;
}

.doki-hero__btn--zoom .doki-hero__img {
  animation: dokiZoom 0.55s ease;
}

.doki-hero--shake {
  animation: dokiHeroShake 0.45s ease;
}

.doki-hero--bounce {
  animation: dokiHeroBounce 0.55s ease;
}

.doki-ai-badge {
  color: var(--accent);
  font-weight: 700;
}

.doki-ai-badge--loading {
  opacity: 0.55;
  animation: dokiPulseText 1s ease infinite;
}

.doki-comics {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.doki-comic {
  position: absolute;
  bottom: 0.5rem;
  font-size: 1.35rem;
  animation: dokiFloatUp 2.4s ease-out forwards;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.next-match--live {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(255, 59, 48, 0.25), var(--shadow);
}

.next-match--live .next-match__countdown {
  color: var(--red);
}

.match-card__score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.35rem 0 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: var(--fill-secondary);
}

.match-card__score--live {
  background: rgba(255, 59, 48, 0.12);
}

.match-card__score-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.match-card__score--live .match-card__score-label {
  color: var(--red);
}

.match-card__score-line {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.match-card--finished {
  opacity: 0.92;
}

.match-card--live {
  box-shadow: inset 0 0 0 1.5px rgba(255, 59, 48, 0.35);
}

.calendar__event--live {
  background: rgba(255, 59, 48, 0.18) !important;
  font-weight: 700;
}

.calendar__event--finished {
  opacity: 0.88;
}

@keyframes dokiSpin {
  from { transform: rotate(0) scale(1); }
  to { transform: rotate(360deg) scale(1.05); }
}

@keyframes dokiJump {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-14px) rotate(-3deg); }
  70% { transform: translateY(-4px); }
}

@keyframes dokiBark {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.12) rotate(5deg); }
  60% { transform: scale(0.96) rotate(-4deg); }
}

@keyframes dokiZoom {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@keyframes dokiHeroShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@keyframes dokiHeroBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes dokiFloatUp {
  0% { opacity: 0; transform: translateY(12px) scale(0.7); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-72px) scale(1.1); }
}

@keyframes dokiPulseText {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.doki-hero__pulse {
  position: absolute;
  inset: -4px;
  border-radius: 24px;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: dokiPulse 2.5s ease-out infinite;
  pointer-events: none;
}

@keyframes dokiWiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-4deg) scale(1.04); }
  75% { transform: rotate(4deg) scale(1.04); }
}

@keyframes dokiPulse {
  0% { opacity: 0.5; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.12); }
}

.doki-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--fill-secondary);
  list-style: none;
}

.doki-empty__img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 18px;
  margin: 0 auto 0.75rem;
  box-shadow: var(--shadow);
}

.doki-empty__title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.doki-empty__text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.footer__doki {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-style: italic;
}

.glass {
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--separator);
  box-shadow: var(--shadow);
}

.controls {
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.controls__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

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

.control__label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.control__select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  padding: 0.65rem 2rem 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--fill);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  touch-action: manipulation;
}

.segmented {
  display: flex;
  padding: 3px;
  background: var(--fill);
  border-radius: var(--radius-sm);
  gap: 2px;
}

.segmented__btn {
  flex: 1;
  min-height: 44px;
  padding: 0.5rem 0.35rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.segmented__btn--active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 50px;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover {
  background: var(--accent-press);
}

.btn-primary:active {
  transform: scale(0.985);
}

.layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
  align-items: start;
}

.layout--solo {
  grid-template-columns: 1fr;
}

.layout__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.layout__main > [data-view] {
  width: 100%;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 1rem;
  overflow: hidden;
}

.panel--sidebar {
  position: sticky;
  top: 1rem;
  scroll-margin-top: 0.75rem;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

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

.panel__title-wrap {
  text-align: center;
  flex: 1;
}

.panel__header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel__hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--fill);
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}

.icon-btn:hover {
  background: var(--fill-secondary);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.calendar__weekday {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.35rem 0 0.5rem;
}

.calendar__day {
  position: relative;
  min-height: 76px;
  padding: 0.35rem 0.25rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1.5px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.calendar__day--empty {
  pointer-events: none;
}

.calendar__day--has-match {
  cursor: pointer;
  background: var(--fill-secondary);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.calendar__day--has-match:hover {
  background: var(--fill);
}

.calendar__day--selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.calendar__day-num {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}

.calendar__count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.calendar__events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 0.25rem;
}

.calendar__event {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2px;
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 0.5625rem;
  font-weight: 600;
  background: var(--bg-elevated);
  border-left: 2px solid var(--accent);
  overflow: hidden;
}

.calendar__event span:first-child {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.calendar__more {
  font-size: 0.5625rem;
  color: var(--text-tertiary);
  text-align: center;
}

.g-a .calendar__event, .match-card.g-a { border-left-color: var(--red); }
.g-b .calendar__event, .match-card.g-b { border-left-color: #ff6482; }
.g-c .calendar__event, .match-card.g-c { border-left-color: var(--green); }
.g-d .calendar__event, .match-card.g-d { border-left-color: var(--accent); }
.g-e .calendar__event, .match-card.g-e { border-left-color: var(--purple); }
.g-f .calendar__event, .match-card.g-f { border-left-color: var(--orange); }
.g-g .calendar__event, .match-card.g-g { border-left-color: #ff6723; }
.g-h .calendar__event, .match-card.g-h { border-left-color: #ff2d55; }
.g-i .calendar__event, .match-card.g-i { border-left-color: var(--teal); }
.g-j .calendar__event, .match-card.g-j { border-left-color: #64d2ff; }
.g-k .calendar__event, .match-card.g-k { border-left-color: #30d158; }
.g-l .calendar__event, .match-card.g-l { border-left-color: var(--indigo); }
.g-ko .calendar__event, .match-card.g-ko { border-left-color: var(--text-tertiary); }

.match-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 68vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.match-list::-webkit-scrollbar {
  width: 4px;
}

.match-list::-webkit-scrollbar-thumb {
  background: var(--separator);
  border-radius: 4px;
}

.match-card {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--fill-secondary);
  border-left: 3px solid var(--accent);
  transition: transform 0.15s;
}

.match-card:active {
  transform: scale(0.99);
}

.match-card--empty {
  border-left-color: var(--separator);
  color: var(--text-secondary);
  text-align: center;
}

.match-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.match-card__time {
  font-size: 1.0625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.match-card__badge {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--fill);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.match-card__teams {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.25rem;
}

.match-card__vs {
  margin: 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
}

.match-card__meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.modal {
  border: none;
  padding: 0;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.modal__sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top)));
  background: var(--bg-elevated);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  animation: sheetUp 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal__handle {
  width: 36px;
  height: 5px;
  border-radius: 999px;
  background: var(--separator);
  margin: 0.5rem auto 0;
  flex-shrink: 0;
}

.modal__body {
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (min-width: 640px) {
  .modal__sheet {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    max-width: 480px;
    margin: auto;
    border-radius: var(--radius-lg);
    max-height: 85vh;
  }

  .modal[open] {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }
}

.modal__header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--separator);
}

.modal__header h2 {
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

.modal__close {
  justify-self: start;
  border: none;
  background: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.modal__done {
  justify-self: end;
  border: none;
  background: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.modal__close,
.modal__done {
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem;
  touch-action: manipulation;
}

.modal__desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
}

.modal__desc strong {
  color: var(--accent);
  font-weight: 600;
}

.export-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.export-mode__btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.75rem 0.85rem;
  border: 1.5px solid var(--separator);
  border-radius: var(--radius-sm);
  background: var(--fill-secondary);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.export-mode__btn--active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.export-mode__title {
  font-size: 0.9375rem;
  font-weight: 600;
}

.export-mode__sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.glass-inset {
  background: var(--fill-secondary);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
}

.export-preview__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.export-preview__name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.export-preview__count {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.export-custom {
  margin-bottom: 0.85rem;
}

.export-match-preview {
  list-style: none;
  margin-top: 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--fill-secondary);
  overflow: hidden;
}

.export-match-preview li {
  display: flex;
  gap: 0.65rem;
  align-items: baseline;
  padding: 0.55rem 0.85rem;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--separator);
}

.export-match-preview li:last-child {
  border-bottom: none;
}

.export-match-preview__time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  min-width: 2.5rem;
}

.export-match-preview__more,
.export-match-preview__empty {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  justify-content: center;
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.pill {
  padding: 0.4rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

.pill--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0;
  border-top: 1px solid var(--separator);
  border-bottom: 1px solid var(--separator);
  margin-bottom: 0.85rem;
  font-size: 0.9375rem;
}

.toggle {
  appearance: none;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  background: var(--fill);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
}

.toggle:checked {
  background: var(--green);
}

.toggle:checked::after {
  transform: translateX(20px);
}

.search {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--fill);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.search::placeholder {
  color: var(--text-tertiary);
}

.export-teams {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 280px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  background: var(--fill-secondary);
}

.export-team {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--separator);
  cursor: pointer;
  font-size: 0.9375rem;
}

.export-team:last-child {
  border-bottom: none;
}

.export-team input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.export-team__group {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

/* ── iPhone & mobile ── */
@media (max-width: 430px) {
  .header {
    margin-bottom: 1rem;
  }

  .next-match {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.85rem 1rem;
  }

  .next-match__countdown {
    text-align: left;
  }

  .controls__actions {
    flex-direction: column;
  }

  .btn-secondary {
    width: 100%;
  }

  .doki-hero {
    padding: 0.85rem;
    gap: 0.75rem;
  }

  .doki-hero__quote {
    font-size: 1rem;
  }

  .doki-hero__img {
    width: 84px;
    height: 84px;
    border-radius: 18px;
  }

  .header h1 {
    font-size: 1.75rem;
  }

  .header__subtitle {
    font-size: 0.875rem;
  }

  .controls {
    padding: 0.85rem;
    border-radius: var(--radius);
    gap: 0.75rem;
  }

  .panel {
    padding: 0.75rem;
    border-radius: var(--radius);
  }

  .panel--sidebar {
    position: static;
  }

  .panel__header h2 {
    font-size: 1.125rem;
  }

  .calendar {
    gap: 2px;
  }

  .calendar__weekday {
    font-size: 0.5625rem;
    padding: 0.25rem 0 0.35rem;
    letter-spacing: 0;
  }

  .calendar__day {
    min-height: 54px;
    padding: 0.2rem 0.1rem;
    border-radius: 8px;
  }

  .calendar__day-num {
    font-size: 0.8125rem;
  }

  .calendar__count {
    top: 2px;
    right: 2px;
    min-width: 14px;
    height: 14px;
    font-size: 0.5625rem;
    line-height: 14px;
  }

  .calendar__events {
    gap: 1px;
    margin-top: 0.15rem;
  }

  .calendar__event {
    justify-content: center;
    padding: 1px 2px;
    font-size: 0.5rem;
    border-left-width: 0;
    border-radius: 3px;
  }

  .calendar__event span:last-child {
    display: none;
  }

  .calendar__more {
    font-size: 0.5rem;
  }

  .match-list {
    max-height: none;
  }

  .match-card {
    padding: 0.75rem 0.85rem;
  }

  .match-card__time {
    font-size: 1rem;
  }

  .match-card__teams {
    font-size: 0.875rem;
  }

  .export-mode {
    grid-template-columns: 1fr;
  }

  .export-mode__btn {
    min-height: 52px;
  }

  .export-teams {
    max-height: 40dvh;
  }

  .pill {
    min-height: 44px;
    padding: 0.5rem 0.85rem;
  }

  .search {
    font-size: 16px;
    min-height: 44px;
  }

  .export-team {
    min-height: 48px;
    padding: 0.65rem 0.85rem;
  }

  .export-team input {
    width: 22px;
    height: 22px;
  }

  .modal__handle {
    display: block;
  }

  .modal__header {
    padding-top: 0.25rem;
  }
}

@media (min-width: 431px) {
  .modal__handle {
    display: none;
  }
}

/* iPhone landscape & small tablets */
@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .panel--sidebar {
    position: static;
  }
}

/* Very small iPhone SE */
@media (max-width: 360px) {
  .segmented__btn {
    font-size: 0.6875rem;
    padding: 0.5rem 0.2rem;
  }

  .calendar__day {
    min-height: 48px;
  }

  .calendar__event {
    font-size: 0.4375rem;
  }
}

:root.theme-light {
  color-scheme: light;
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --glass: rgba(255, 255, 255, 0.72);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --separator: rgba(60, 60, 67, 0.12);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-secondary: rgba(120, 120, 128, 0.08);
}

:root.theme-dark {
  color-scheme: dark;
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --glass: rgba(28, 28, 30, 0.78);
  --text: #f5f5f7;
  --text-secondary: #98989d;
  --text-tertiary: #636366;
  --separator: rgba(84, 84, 88, 0.45);
  --fill: rgba(120, 120, 128, 0.24);
  --fill-secondary: rgba(120, 120, 128, 0.16);
}

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

.header__tools {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.icon-btn--active {
  background: var(--accent-soft);
  color: var(--accent);
}

.today-widget {
  margin-bottom: 0.75rem;
  padding: 0.85rem 1rem;
}

.today-widget__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.today-widget__list {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}

.today-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--fill-secondary);
  border-left: 3px solid var(--accent);
  font-size: 0.75rem;
  cursor: pointer;
}

.today-chip--live {
  border-left-color: var(--red);
  animation: pulse-live 1.5s ease-in-out infinite;
}

.today-chip__time {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.app-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.35rem;
  margin-bottom: 0.75rem;
  overflow-x: auto;
}

.app-tab {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app-tab--active {
  background: var(--accent);
  color: #fff;
}

.view-panel {
  padding: 1rem;
  margin-bottom: 0;
  border-radius: var(--radius-lg);
}

.view-panel h2 {
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

.standings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.standings-card h3 {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.standings-table {
  width: 100%;
  font-size: 0.6875rem;
  border-collapse: collapse;
}

.standings-table th,
.standings-table td {
  padding: 0.25rem 0.15rem;
  text-align: center;
}

.standings-table th:nth-child(2),
.standings-table td:nth-child(2) {
  text-align: left;
}

.standings__row--qualify {
  background: var(--accent-soft);
}

.bracket-tree {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.bracket-col {
  flex: 0 0 200px;
}

.bracket-col h3 {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.bracket-match {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  border: none;
  background: var(--fill-secondary);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  margin-bottom: 0.4rem;
  font: inherit;
  font-size: 0.6875rem;
  cursor: pointer;
}

.bracket-match--live {
  box-shadow: 0 0 0 1px var(--red);
}

.bracket-match__teams {
  font-weight: 600;
}

.venues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.venue-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.75rem;
  border: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.venue-card--active {
  outline: 2px solid var(--accent);
}

.venue-card__flag {
  font-size: 1.25rem;
}

.venue-card__city {
  font-weight: 600;
  font-size: 0.8125rem;
}

.venue-card__count {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

.match-card--highlight {
  outline: 2px solid var(--accent);
  box-shadow: var(--shadow-lg);
}

.match-card__actions {
  margin-top: 0.35rem;
}

.pill--sm {
  font-size: 0.6875rem;
  padding: 0.2rem 0.5rem;
}

.segmented__btn--icon {
  flex: 0 0 auto;
  min-width: 2.25rem;
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.35rem;
  max-height: 50vh;
  overflow-y: auto;
}

.fav-team {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--fill-secondary);
}

.webcal-block {
  margin-top: 0.75rem;
  padding: 0.75rem;
}

.webcal-link {
  display: block;
  word-break: break-all;
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 0.35rem;
}

.confetti-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 9999;
}

.confetti {
  position: absolute;
  top: -10%;
  font-size: 1.5rem;
  animation: confetti-fall 3s ease-in forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

@keyframes pulse-live {
  50% { opacity: 0.75; }
}

.celebration-active .doki-hero__img {
  animation: doki-bounce 0.5s ease infinite alternate;
}

@keyframes doki-bounce {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

@media (max-width: 860px) {
  .bracket-tree {
    flex-direction: column;
  }

  .bracket-col {
    flex: 1 1 auto;
  }
}

@media (hover: none) and (pointer: coarse) {
  .btn-primary:hover,
  .icon-btn:hover,
  .segmented__btn:hover,
  .export-mode__btn:hover {
    filter: none;
  }

  .calendar__day--has-match:active {
    background: var(--fill);
    transform: scale(0.97);
  }

  .match-card:active {
    transform: scale(0.98);
  }
}
