:root {
  color-scheme: dark;
  --ink: #05090e;
  --glass: rgba(7, 12, 19, 0.84);
  --glass-strong: rgba(5, 9, 14, 0.94);
  --line: rgba(255, 233, 177, 0.3);
  --gold: #ffcf63;
  --gold-hot: #ffac27;
  --ice: #e8f5ff;
  --usa: #5aa8ff;
  --usa-red: #e95862;
  --canada: #ff4b4b;
  --muted: rgba(232, 245, 255, 0.58);
}

* { box-sizing: border-box; }

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

button,
a { -webkit-tap-highlight-color: transparent; }

.arena {
  position: relative;
  isolation: isolate;
  width: 100vw;
  height: 100svh;
  min-height: 680px;
  overflow: hidden;
  background: #080b10;
}

.arena__visual {
  position: absolute;
  z-index: -3;
  inset: 0;
  display: block;
  overflow: hidden;
  background: #070b11;
}

.arena__art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 50%;
  filter: saturate(1) brightness(0.96) contrast(1.03);
  transform: none;
  transition: filter 400ms ease, transform 650ms cubic-bezier(.2,.8,.2,1);
}

.arena__shade {
  position: absolute;
  z-index: -2;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 5, 9, 0.7) 0%, rgba(3, 7, 11, 0.12) 22%, transparent 48%, rgba(2, 5, 9, 0.08) 65%, rgba(2, 5, 9, 0.82) 100%),
    linear-gradient(90deg, rgba(2, 7, 13, 0.38), transparent 24%, transparent 76%, rgba(13, 3, 4, 0.35));
}

.arena::after {
  content: "";
  position: absolute;
  z-index: 20;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255, 226, 151, 0.18);
  box-shadow: inset 0 0 110px rgba(0, 0, 0, 0.66);
}

.masthead {
  position: absolute;
  z-index: 4;
  top: clamp(18px, 3.3vh, 43px);
  left: 50%;
  width: min(900px, 78vw);
  transform: translateX(-50%);
  text-align: center;
  text-shadow: 0 5px 22px #000;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--gold);
  font-size: clamp(8px, 0.72vw, 11px);
  font-weight: 900;
  letter-spacing: 0.42em;
}

.masthead h1 {
  margin: 0;
  color: var(--ice);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 5.2vw, 86px);
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 0.88;
  -webkit-text-stroke: 1px rgba(6, 10, 15, 0.9);
  filter: drop-shadow(0 3px 0 #5f461e) drop-shadow(0 9px 20px rgba(0,0,0,.9));
}

.masthead__line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.17em;
}

.ticker {
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.ticker i { font-style: normal; opacity: 0.7; }

.data-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.data-status b { font: inherit; }

.data-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8d959b;
  box-shadow: 0 0 0 3px rgba(141,149,155,.12);
}

[data-arena-state="live"] .data-status { color: #d9ffcf; }
[data-arena-state="live"] .data-status i { background: #70e76e; box-shadow: 0 0 11px #70e76e; }
[data-arena-state="loading"] .data-status i { background: var(--gold); box-shadow: 0 0 11px var(--gold); animation: pulse 900ms ease-in-out infinite alternate; }
[data-arena-state="offline"] .data-status { color: #ffaca8; }
[data-arena-state="offline"] .data-status i { background: #ff5d55; box-shadow: 0 0 11px rgba(255,93,85,.75); }

.battle-board {
  position: absolute;
  z-index: 5;
  top: clamp(152px, 19vh, 205px);
  left: 3vw;
  right: 3vw;
  display: grid;
  grid-template-columns: minmax(200px, 0.9fr) minmax(320px, 1.35fr) minmax(200px, 0.9fr);
  align-items: end;
  gap: clamp(15px, 2vw, 32px);
}

.contender {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(217, 239, 255, 0.28);
  background: linear-gradient(180deg, rgba(13, 25, 37, 0.86), rgba(5, 11, 17, 0.92));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), inset 0 1px rgba(255,255,255,.07);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  backdrop-filter: blur(12px);
  transition: border-color 250ms ease, box-shadow 250ms ease, transform 250ms ease;
}

.contender--canada {
  flex-direction: row-reverse;
  text-align: right;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

[data-leader="usa"] .contender--usa {
  border-color: rgba(102, 181, 255, 0.9);
  box-shadow: 0 0 28px rgba(64, 139, 255, 0.34), 0 14px 34px rgba(0,0,0,.55);
  transform: translateY(-3px);
}

[data-leader="canada"] .contender--canada {
  border-color: rgba(255, 75, 75, 0.92);
  box-shadow: 0 0 28px rgba(255, 59, 59, 0.34), 0 14px 34px rgba(0,0,0,.55);
  transform: translateY(-3px);
}

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

.contender--canada .contender__identity { flex-direction: row-reverse; }

.contender__identity img {
  flex: 0 0 auto;
  width: 72px;
  height: 42px;
  object-fit: contain;
  border: 1px solid rgba(255,255,255,.45);
  background: transparent;
  box-shadow: 0 4px 9px rgba(0,0,0,.48);
}

.contender__identity span,
.contender__identity small,
.contender__identity strong { display: block; }

.contender__identity small {
  overflow: hidden;
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contender__identity strong {
  margin-top: 3px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(20px, 2vw, 34px);
  line-height: .9;
}

.contender__score strong,
.contender__score span { display: block; }

.contender__score strong {
  font-size: clamp(28px, 3vw, 48px);
  font-style: italic;
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: .8;
  text-shadow: 0 4px 13px #000;
}

.contender--usa .contender__score strong { color: #9bd0ff; }
.contender--canada .contender__score strong { color: #ff8b86; }

.contender__score span {
  margin-top: 8px;
  color: var(--gold);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .23em;
}

.clash { min-width: 0; }

.clash__labels {
  display: grid;
  grid-template-columns: 45px 1fr 45px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--ice);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  text-shadow: 0 3px 9px #000;
}

.clash__labels b {
  overflow: hidden;
  color: var(--gold);
  font-size: 9px;
  letter-spacing: .16em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clash__labels span:last-child { text-align: right; }

.clash__track {
  position: relative;
  display: flex;
  height: 22px;
  overflow: visible;
  border: 2px solid rgba(255, 239, 199, .7);
  background: rgba(2, 6, 10, .88);
  box-shadow: 0 0 0 4px rgba(2, 7, 11, .72), 0 9px 26px rgba(0,0,0,.72);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
}

.clash__track i {
  display: block;
  height: 100%;
  transition: width 700ms cubic-bezier(.2,.8,.2,1);
}

.clash__usa { background: linear-gradient(90deg, #123766 0 42%, #f7f8fa 42% 56%, #bd2644 56%); }
.clash__canada { background: linear-gradient(90deg, #d71920 0 43%, #fff 43% 57%, #d71920 57%); }

.clash__track em {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  transform: translate(-50%, -50%) rotate(-5deg);
  border: 2px solid #fff0c3;
  border-radius: 50%;
  background: #14100b;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 0 20px rgba(255,191,66,.55);
}

.market-strip {
  position: absolute;
  z-index: 5;
  right: 3vw;
  bottom: 114px;
  left: 3vw;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid rgba(255, 228, 163, 0.22);
  background: linear-gradient(180deg, rgba(9,15,22,.78), rgba(4,8,12,.9));
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
  backdrop-filter: blur(12px);
}

.metric {
  min-width: 0;
  padding: 11px 16px;
  border-right: 1px solid rgba(255, 232, 178, .15);
}

.metric:last-child { border-right: 0; }
.metric span,
.metric strong { display: block; }

.metric span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .21em;
}

.metric strong {
  overflow: hidden;
  color: var(--ice);
  font-size: clamp(13px, 1.2vw, 18px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-direction="up"] { color: #78ee83 !important; }
[data-direction="down"] { color: #ff7370 !important; }

.control-deck {
  position: absolute;
  z-index: 6;
  right: 3vw;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 3vw;
  display: flex;
  min-height: 68px;
  border: 1px solid rgba(255, 229, 164, .36);
  background: var(--glass-strong);
  box-shadow: 0 15px 40px rgba(0,0,0,.62), inset 0 1px rgba(255,255,255,.06);
  clip-path: polygon(11px 0, calc(100% - 11px) 0, 100% 11px, 100% calc(100% - 11px), calc(100% - 11px) 100%, 11px 100%, 0 calc(100% - 11px), 0 11px);
  backdrop-filter: blur(14px);
}

.contract {
  display: grid;
  flex: 1 1 360px;
  min-width: 0;
  align-content: center;
  padding: 10px 20px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.contract__label {
  margin-bottom: 5px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .24em;
}

.contract__value {
  overflow: hidden;
  color: var(--ice);
  font: 700 14px/1.15 "Courier New", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions { display: flex; flex: 0 0 auto; }

.action {
  position: relative;
  display: grid;
  min-width: 105px;
  place-items: center;
  padding: 0 18px;
  border-left: 1px solid rgba(255,232,178,.14);
  color: var(--ice);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.action--gold { color: var(--gold); }
.action--social { min-width: 58px; }

.action:hover,
.action:focus-visible,
.contract:hover,
.contract:focus-visible {
  outline: none;
  background: rgba(255, 198, 79, .09);
}

.action:active,
.contract:active { transform: translateY(1px); }

.action[aria-disabled="true"] { opacity: .3; pointer-events: none; }

.impact-flash {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.impact--usa .impact-flash { animation: impact-usa 700ms ease-out; }
.impact--canada .impact-flash { animation: impact-canada 700ms ease-out; }
.impact--usa .arena__art,
.impact--canada .arena__art { transform: scale(1.012); }

@keyframes pulse { to { opacity: .35; } }
@keyframes impact-usa { 0% { opacity: .7; background: linear-gradient(90deg, rgba(60,137,255,.6), transparent 56%); } 100% { opacity: 0; } }
@keyframes impact-canada { 0% { opacity: .7; background: linear-gradient(270deg, rgba(255,49,49,.62), transparent 56%); } 100% { opacity: 0; } }

@media (max-width: 900px) {
  html, body { overflow-y: auto; }
  .arena { height: max(100svh, 700px); min-height: 700px; overflow: hidden; }
  .arena__visual { top: 118px; bottom: 118px; }
  .arena__art { object-fit: contain; object-position: center center; filter: saturate(1) brightness(.94) contrast(1.03); }
  .masthead { top: 21px; width: calc(100vw - 24px); }
  .masthead h1 { font-size: clamp(38px, 11vw, 66px); }
  .masthead__line { gap: 10px; margin-top: 10px; font-size: 7px; }
  .battle-board {
    top: 142px;
    left: 12px;
    right: 12px;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 8px;
  }
  .clash { grid-column: 1 / -1; grid-row: 2; margin: 2px 10px 0; }
  .contender { padding: 10px; gap: 8px; }
  .contender__identity { gap: 7px; }
  .contender__identity img { width: 48px; height: 29px; }
  .contender__identity small { font-size: 5px; letter-spacing: .12em; }
  .contender__identity strong { font-size: 18px; }
  .contender__score strong { font-size: 28px; }
  .contender__score span { margin-top: 5px; font-size: 6px; }
  .clash__track { height: 15px; }
  .clash__track em { width: 34px; height: 34px; font-size: 12px; }
  .clash__labels { grid-template-columns: 38px 1fr 38px; font-size: 7px; }
  .clash__labels b { font-size: 7px; letter-spacing: .1em; }
  .market-strip {
    right: 12px;
    bottom: 132px;
    left: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .metric { padding: 8px 10px; }
  .metric:nth-child(3) { border-right: 0; }
  .metric:nth-child(n+4) { border-top: 1px solid rgba(255,232,178,.15); }
  .metric span { font-size: 5px; }
  .metric strong { font-size: 12px; }
  .control-deck {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    display: block;
  }
  .contract {
    width: 100%;
    min-height: 44px;
    padding: 8px 13px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .contract__label { font-size: 7px; }
  .contract__value { font-size: 11px; }
  .actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); min-height: 43px; }
  .action { min-width: 0; padding: 0 6px; font-size: 8px; }
}

@media (max-height: 720px) and (min-width: 901px) {
  .arena { min-height: 590px; }
  .masthead { top: 15px; }
  .battle-board { top: 138px; }
  .market-strip { bottom: 99px; }
  .control-deck { bottom: 15px; min-height: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
