@font-face {
  font-family: "Un Dotum";
  src: url("../assets/font/UnDotum-latin.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400 900;
  unicode-range: U+0020-007E, U+00A0-00FF, U+2018-2019, U+201C-201D, U+2022, U+2026, U+2190-21FF, U+2212, U+25A0-25FF, U+2600-26FF;
}

:root {
  color-scheme: dark;
  --bg: #121212;
  --surface: #181818;
  --surface-2: #222222;
  --surface-3: #2a2a2a;
  --line: #3a3a3a;
  --line-soft: #2e2e2e;
  --text: #f4f4f4;
  --muted: #a8a8a8;
  --accent: #dcdcdc;
  --accent-strong: #ffffff;
  --gold: var(--accent);
  --gold-strong: var(--accent-strong);
  --green: #dcdcdc;
  --red: #e06a6a;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
  --cooldown-overlay: rgba(0, 0, 0, 0.76);
  --haste-icon-filter: none;
  font-family: "Un Dotum", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f2f2;
  --surface: #ffffff;
  --surface-2: #e9e9e9;
  --surface-3: #dedede;
  --line: #bdbdbd;
  --line-soft: #d4d4d4;
  --text: #121212;
  --muted: #565656;
  --accent: #222222;
  --accent-strong: #000000;
  --gold: var(--accent);
  --gold-strong: var(--accent-strong);
  --green: #222222;
  --red: #a64040;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
  --cooldown-overlay: rgba(0, 0, 0, 0.58);
  --haste-icon-filter: invert(1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
a {
  font: inherit;
}

button,
a {
  color: inherit;
}

a {
  text-decoration: none;
}

.app-shell,
.tracker-shell {
  width: 100%;
  height: 100dvh;
  min-height: 0;
}

.loading-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 24px;
  color: var(--muted);
}

.loading-mark,
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  background: var(--surface-2);
  color: var(--gold-strong);
  font-weight: 900;
  letter-spacing: 0;
  overflow: hidden;
}

.loading-mark img,
.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.tracker-shell {
  --ad-height: clamp(26px, 4.2vh, 42px);
  --footer-height: 18px;
  --shell-pad-y: 10px;
  --shell-pad-x: 10px;
  --content-gap: 7px;
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: var(--content-gap);
  padding: calc(var(--shell-pad-y) + env(safe-area-inset-top)) calc(var(--shell-pad-x) + env(safe-area-inset-right)) calc(var(--shell-pad-y) + env(safe-area-inset-bottom)) calc(var(--shell-pad-x) + env(safe-area-inset-left));
  background: var(--bg);
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(21px, 3vw, 31px);
  line-height: 1;
  letter-spacing: 0;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.control-button,
.icon-button,
.champion-button,
.spell-button,
.context-toggle,
.spell-reset,
.timer-buttons button,
.champion-option,
.modifier-button,
.spell-option,
.ad-close {
  border: 1px solid var(--line);
  background: var(--surface-2);
  min-height: 36px;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, opacity 120ms ease, transform 120ms ease;
}

.control-button:hover,
.icon-button:hover,
.champion-button:hover,
.spell-button:hover,
.context-toggle:hover,
.spell-reset:hover,
.timer-buttons button:hover,
.champion-option:hover,
.modifier-button:hover,
.spell-option:hover,
.ad-close:hover {
  border-color: var(--gold);
}

.control-button:active,
.champion-button:active,
.spell-button:active,
.context-toggle:active,
.spell-reset:active,
.timer-buttons button:active,
.champion-option:active,
.modifier-button:active,
.spell-option:active,
.ad-close:active {
  transform: translateY(1px);
}

.control-button {
  min-width: 74px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.pause-button {
  width: 74px;
  min-width: 74px;
}

.reset-button,
.mode-button,
.theme-button,
.donate-button {
  width: 74px;
  min-width: 74px;
}

.flash-button {
  width: 96px;
  min-width: 96px;
}

.control-button.is-on,
.mode-button.is-aram {
  border-color: var(--green);
  color: var(--green);
}

.ad-banner {
  position: relative;
  z-index: 12;
  min-width: 0;
  height: var(--ad-height);
  margin-inline: calc(-1 * var(--shell-pad-x));
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  opacity: 1;
  transform: scaleY(1);
  transform-origin: center;
  transition: opacity 180ms ease, transform 180ms ease;
  overflow: hidden;
}

.ad-banner-top {
  margin-top: calc(-1 * var(--shell-pad-y));
}

.ad-banner-bottom {
  margin-bottom: calc(-1 * var(--shell-pad-y));
}

.ad-banner.is-dismissed {
  opacity: 0;
  transform: scaleY(0.8);
  pointer-events: none;
}

.ad-creative {
  width: auto;
  height: 100%;
  max-width: calc(100% - 42px);
  aspect-ratio: 728 / 90;
  display: grid;
  place-items: center;
  padding: 0 30px 0 12px;
  border-inline: 1px solid var(--line-soft);
  background: var(--surface-2);
  color: var(--muted);
  font-size: clamp(7.5px, 0.85vw, 12px);
  font-weight: 800;
  text-align: center;
  line-height: 1.1;
  white-space: normal;
  overflow: hidden;
}

.ad-creative img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.ad-close {
  position: absolute;
  right: 5px;
  top: 50%;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  transform: translateY(-50%);
  border-radius: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.ad-close:active {
  transform: translateY(calc(-50% + 1px));
}

.team-board {
  --spell-size: clamp(46px, min(5.1vw, 8.5vh), 68px);
  --icon-gap: 4px;
  --spell-action-size: clamp(18px, calc(var(--spell-size) * 0.28), 22px);
  --champ-size: calc((var(--spell-size) * 2) + var(--icon-gap));
  --timer-button-height: clamp(18px, 2.6vh, 24px);
  --timer-chip-size: clamp(22px, calc(var(--timer-button-height) * 1.25), 30px);
  --modifier-height: clamp(26px, 3.1vh, 32px);
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  overflow: hidden;
}

.player-card {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: center;
  gap: clamp(5px, 1vh, 8px);
  padding: 8px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), #111111);
  box-shadow: var(--shadow);
  overflow: hidden;
}

:root[data-theme="light"] .player-card {
  background: linear-gradient(180deg, #ffffff, #eeeeee);
}

.scoreboard-loadout {
  min-width: 0;
  display: grid;
  grid-template-columns: var(--champ-size) calc(var(--spell-size) + var(--spell-action-size) + 2px);
  grid-template-rows: var(--champ-size);
  gap: var(--icon-gap);
  align-items: center;
  justify-content: center;
}

.champion-button {
  position: relative;
  width: var(--champ-size);
  height: var(--champ-size);
  min-height: var(--champ-size);
  padding: 0;
  overflow: hidden;
  border-radius: 7px;
  background: #111111;
}

.champion-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.champion-button b {
  position: absolute;
  left: 4px;
  top: 4px;
  width: clamp(22px, 2.3vw, 28px);
  height: clamp(22px, 2.3vw, 28px);
  display: grid;
  place-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  background: rgba(18, 18, 18, 0.86);
  color: var(--gold-strong);
  border-radius: 5px;
}

.role-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.95;
}

.summoner-pair {
  display: grid;
  width: calc(var(--spell-size) + var(--spell-action-size) + 2px);
  grid-template-rows: repeat(2, var(--spell-size));
  gap: var(--icon-gap);
}

.spell-panel {
  --cooldown-fill: 0%;
  min-width: 0;
  display: grid;
  grid-template-columns: var(--spell-size) var(--spell-action-size);
  gap: 2px;
  align-items: stretch;
}

.spell-frame {
  position: relative;
  width: var(--spell-size);
  height: var(--spell-size);
}

.spell-button {
  position: relative;
  width: var(--spell-size);
  height: var(--spell-size);
  min-height: var(--spell-size);
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border-radius: 7px;
  background: #111111;
  isolation: isolate;
}

.spell-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: conic-gradient(var(--cooldown-overlay) var(--cooldown-fill), transparent 0);
  opacity: 0;
  z-index: 1;
}

.spell-panel.is-cooling .spell-button::after {
  opacity: 1;
}

.spell-art,
.spell-art img,
.spell-art > span {
  width: 100%;
  height: 100%;
}

.spell-art img {
  display: block;
  object-fit: cover;
}

.spell-art > span {
  display: grid;
  place-items: center;
  color: var(--gold-strong);
  font-weight: 900;
  font-size: 14px;
}

.spell-timer {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 50%;
  width: calc(100% - 6px);
  min-height: clamp(18px, 2.3vh, 24px);
  display: grid;
  place-items: center;
  padding: 1px 4px;
  background: rgba(0, 0, 0, 0.78);
  color: white;
  font-weight: 900;
  font-size: clamp(11px, 1.25vw, 17px);
  line-height: 1;
  border-radius: 4px;
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.spell-timer:empty {
  display: none;
}

.charge-count {
  position: absolute;
  z-index: 3;
  top: 4px;
  left: 4px;
  min-width: 25px;
  min-height: 18px;
  display: grid;
  place-items: center;
  padding: 1px 3px;
  background: rgba(18, 18, 18, 0.86);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  border-radius: 4px;
}

.charge-count:empty {
  display: none;
}

.spell-actions {
  min-width: 0;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 2px;
}

.context-toggle,
.spell-reset {
  position: static;
  z-index: auto;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 4px;
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
  opacity: 0.76;
  font-size: clamp(10px, 0.9vw, 13px);
  font-weight: 900;
  line-height: 1;
}

.context-toggle.is-open {
  border-color: var(--green);
  color: var(--green);
  opacity: 1;
}

:root[data-theme="light"] .context-toggle,
:root[data-theme="light"] .spell-reset {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

:root[data-theme="light"] .context-toggle.is-open {
  border-color: #111111;
  background: rgba(17, 17, 17, 0.9);
  color: #ffffff;
}

.site-disclaimer {
  min-width: 0;
  min-height: var(--footer-height);
  display: grid;
  place-items: center;
  padding: 0 6px;
  color: var(--muted);
  font-size: clamp(8px, 0.72vw, 10px);
  line-height: 1.05;
  text-align: center;
  overflow: hidden;
}

.timers-section {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto;
  gap: 4px;
}

.section-label {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(10px, 0.92vw, 12px);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time-controls {
  min-width: 0;
  display: grid;
  grid-template-rows: repeat(2, auto);
  gap: 4px;
}

.time-control-row {
  min-width: 0;
  display: grid;
  grid-template-columns: var(--timer-chip-size) minmax(0, 1fr);
  align-items: center;
  gap: 4px;
}

.timer-spell-chip {
  width: var(--timer-chip-size);
  height: var(--timer-chip-size);
  min-width: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #111111;
  align-self: center;
}

.timer-spell-chip img,
.timer-spell-chip > span {
  width: 100%;
  height: 100%;
}

.timer-spell-chip img {
  display: block;
  object-fit: cover;
}

.timer-spell-chip > span {
  display: grid;
  place-items: center;
  color: var(--gold-strong);
  font-size: 9px;
  font-weight: 900;
}

.timer-buttons {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, var(--timer-button-height));
  gap: 3px;
}

.timer-buttons button {
  min-width: 0;
  min-height: 0;
  height: var(--timer-button-height);
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: clamp(10px, 0.92vw, 12px);
  font-weight: 900;
  line-height: 1;
}

.player-name-section {
  min-width: 0;
  min-height: 18px;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 0 2px;
  overflow: hidden;
}

.player-name-section strong {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: clamp(12px, 1.25vw, 16px);
  line-height: 1;
  letter-spacing: 0;
}

.modifier-strip {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.haste-total,
.modifier-button {
  min-width: 0;
  min-height: 0;
  height: var(--modifier-height);
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 5px;
}

.haste-total {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--green);
  font-size: clamp(11px, 1.08vw, 13px);
  font-weight: 900;
}

.modifier-button {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px;
  padding: 3px 4px;
  color: var(--muted);
  opacity: 0.66;
}

.modifier-button.is-selected {
  border-color: var(--green);
  background: var(--surface-3);
  color: var(--text);
  opacity: 1;
}

.modifier-icon {
  width: 16px;
  height: 16px;
  object-fit: cover;
  border-radius: 3px;
}

.modifier-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(10px, 0.9vw, 12px);
  line-height: 1.1;
  text-align: left;
}

.modifier-haste,
.haste-total {
  white-space: nowrap;
}

.haste-icon {
  width: 13px;
  height: 13px;
  object-fit: contain;
  vertical-align: -2px;
  filter: var(--haste-icon-filter);
}

.modifier-haste {
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: var(--green);
  font-size: clamp(9px, 0.84vw, 11px);
  font-weight: 900;
}

.modal-backdrop,
.context-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  padding: calc(12px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.74);
}

.modal-backdrop {
  place-items: end center;
}

.context-backdrop {
  place-items: center;
}

.champion-modal,
.spell-context {
  width: min(980px, 100%);
  max-height: min(780px, 88dvh);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.spell-context {
  width: min(680px, 100%);
  grid-template-rows: auto auto;
}

.modal-head,
.context-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-head h2,
.context-title h2 {
  margin: 0;
  font-size: 18px;
}

.context-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.context-title img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
}

.context-title span {
  color: var(--muted);
  font-size: 12px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 6px;
}

.champion-search {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 6px;
  padding: 0 12px;
  font-size: 16px;
}

.champion-grid,
.spell-option-grid {
  min-height: 0;
  display: grid;
  gap: 8px;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.champion-grid {
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  overflow: auto;
}

.champion-option {
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px;
  border-radius: 7px;
  text-align: left;
}

.champion-option img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 5px;
}

.champion-option.is-active {
  border-color: var(--green);
  background: var(--surface-3);
}

.champion-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.none-option {
  grid-template-columns: 1fr;
  justify-items: center;
  color: var(--gold-strong);
  font-weight: 800;
}

.context-section {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.spell-option-grid {
  grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  padding-right: 0;
  overflow: visible;
}

.spell-option {
  min-width: 0;
  display: grid;
  place-items: center;
  align-items: center;
  gap: 0;
  min-height: 52px;
  aspect-ratio: 1;
  padding: 5px;
  border-radius: 7px;
  color: var(--text);
  text-align: center;
}

.spell-option.is-selected {
  border-color: var(--green);
  background: var(--surface-3);
}

:root[data-theme="light"] .spell-option {
  background: #ffffff;
  border-color: #bdbdbd;
  color: #121212;
}

:root[data-theme="light"] .spell-option.is-selected {
  background: #dedede;
  border-color: #121212;
}

.spell-option-art,
.spell-option-art img,
.spell-option-art > span {
  width: 100%;
  height: 100%;
}

.spell-option-art img {
  object-fit: cover;
  border-radius: 5px;
}

.spell-option-art > span {
  display: grid;
  place-items: center;
  color: var(--gold-strong);
  font-weight: 900;
}

@media (max-width: 1120px) and (orientation: landscape) {
  .team-board {
    --spell-size: clamp(30px, 5.5vh, 40px);
  }

  .modifier-name {
    font-size: 8px;
  }
}

@media (max-width: 760px), (max-width: 1020px) and (min-height: 640px) {
  .tracker-shell {
    --ad-height: clamp(20px, 3vh, 28px);
    --shell-pad-y: 8px;
    --shell-pad-x: 8px;
    --content-gap: 6px;
    gap: 6px;
    padding: calc(var(--shell-pad-y) + env(safe-area-inset-top)) calc(var(--shell-pad-x) + env(safe-area-inset-right)) calc(var(--shell-pad-y) + env(safe-area-inset-bottom)) calc(var(--shell-pad-x) + env(safe-area-inset-left));
  }

  .topbar {
    min-height: 54px;
    padding: 6px 8px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand h1 {
    font-size: 22px;
  }

  .brand p {
    font-size: 10px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    gap: 5px;
  }

  .control-button {
    min-width: 56px;
    height: 38px;
    min-height: 38px;
    padding: 0 7px;
    font-size: 12px;
  }

  .pause-button,
  .reset-button,
  .mode-button,
  .theme-button,
  .donate-button {
    width: 62px;
    min-width: 62px;
  }

  .flash-button {
    width: 88px;
    min-width: 88px;
  }

  .team-board {
    --spell-size: clamp(30px, min(8vw, 5.8vh), 34px);
    --icon-gap: 3px;
    --timer-button-height: clamp(13px, 2.05vh, 18px);
    --timer-chip-size: clamp(18px, 5vw, 22px);
    --modifier-height: clamp(22px, 2.8vh, 25px);
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
  }

  .player-card {
    grid-template-rows: auto auto auto auto;
    align-content: center;
    gap: 1px;
    padding: 4px 5px;
  }

  .scoreboard-loadout {
    grid-template-columns: var(--champ-size) calc(var(--spell-size) + var(--spell-action-size) + 2px);
    grid-template-rows: var(--champ-size);
    align-items: center;
    justify-content: center;
  }

  .player-name-section {
    padding: 0 6px;
    min-height: 15px;
  }

  .player-name-section strong {
    max-width: 100%;
    font-size: clamp(11px, 3vw, 14px);
    line-height: 1;
  }

  .timers-section {
    gap: 2px;
  }

  .section-label {
    font-size: 10px;
  }

  .time-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 1fr;
    gap: 3px;
  }

  .time-control-row {
    grid-template-columns: var(--timer-chip-size) minmax(0, 1fr);
    gap: 3px;
  }

  .timer-buttons {
    grid-template-rows: repeat(2, var(--timer-button-height));
    gap: 2px;
  }

  .modifier-strip {
    grid-template-columns: 36px repeat(3, minmax(0, 1fr));
    gap: 3px;
  }

  .haste-total {
    grid-row: auto;
  }

  .haste-total,
  .modifier-button {
    height: var(--modifier-height);
  }

  .modifier-button {
    grid-template-columns: 13px minmax(0, 1fr) auto;
    gap: 2px;
    padding: 2px;
  }

  .modifier-icon {
    width: 13px;
    height: 13px;
  }

  .modifier-name {
    white-space: nowrap;
    font-size: clamp(7.8px, 2vw, 9px);
    line-height: 1;
  }

  .modifier-haste {
    font-size: clamp(8px, 2vw, 9px);
  }

  .haste-icon {
    width: 11px;
    height: 11px;
  }

  .context-toggle,
  .spell-reset {
    font-size: 10px;
  }

  .timer-buttons button {
    height: var(--timer-button-height);
    font-size: clamp(8.5px, 2.15vw, 10.5px);
  }

  .context-backdrop {
    place-items: end center;
  }

  .spell-context {
    max-height: 86dvh;
  }
}

@media (max-width: 420px) {
  .tracker-shell {
    --ad-height: 18px;
    --footer-height: 24px;
  }

  .topbar {
    gap: 6px;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }

  .ad-creative {
    padding-inline: 5px 26px;
    font-size: 6px;
    line-height: 1;
  }

  .ad-close {
    width: 18px;
    min-width: 18px;
    height: 16px;
    min-height: 16px;
    right: 3px;
    font-size: 9px;
  }

  .brand {
    gap: 7px;
  }

  .brand-mark {
    display: none;
  }

  .brand h1 {
    font-size: 18px;
  }

  .brand p {
    display: none;
  }

  .control-button {
    min-width: 48px;
    height: 32px;
    min-height: 32px;
    padding: 0 5px;
    font-size: 10px;
  }

  .pause-button,
  .reset-button,
  .mode-button,
  .theme-button,
  .donate-button {
    width: 48px;
    min-width: 48px;
  }

  .flash-button {
    width: 76px;
    min-width: 76px;
  }

  .team-board {
    --spell-size: clamp(25px, 7vw, 30px);
    --timer-button-height: clamp(12px, 1.9vh, 15px);
    --timer-chip-size: clamp(16px, 4.8vw, 20px);
    --modifier-height: 21px;
  }

  .player-name-section {
    min-height: 13px;
  }

  .player-name-section strong {
    font-size: 10px;
  }

  .timers-section {
    gap: 0;
  }

  .section-label {
    display: none;
  }

  .timer-buttons {
    grid-template-rows: repeat(2, var(--timer-button-height));
  }

  .timer-buttons button {
    height: var(--timer-button-height);
    font-size: 8.2px;
  }

  .spell-option-grid {
    grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .tracker-shell {
    --ad-height: 24px;
    --shell-pad-y: 6px;
    --content-gap: 6px;
    gap: 6px;
    padding-top: max(var(--shell-pad-y), env(safe-area-inset-top));
    padding-bottom: max(var(--shell-pad-y), env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 44px;
    padding: 5px 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .brand p {
    display: none;
  }

  .team-board {
    --spell-size: clamp(32px, 9.8vh, 38px);
    --timer-button-height: clamp(15px, 4.4vh, 20px);
    --timer-chip-size: clamp(18px, 5.2vh, 24px);
    --modifier-height: clamp(22px, 6vh, 27px);
  }

  .scoreboard-loadout {
    grid-template-columns: var(--champ-size) calc(var(--spell-size) + var(--spell-action-size) + 2px);
  }

  .player-card {
    padding: 4px 5px;
    gap: 3px;
  }

  .modifier-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
  }

  .haste-total,
  .modifier-button {
    height: var(--modifier-height);
  }

  .modifier-name {
    font-size: 7.4px;
  }

  .timer-buttons {
    grid-template-rows: repeat(2, var(--timer-button-height));
  }

  .timer-buttons button {
    height: var(--timer-button-height);
    font-size: 8.8px;
  }
}
