/* Mobile-first shell. Desktop composition is enabled only from 900px. */
:root {
  --mobile-gutter: 12px;
  --card-radius: 16px;
  --sector-shadow: 0 10px 30px rgba(18, 55, 96, .12);
}

html, body { width: 100%; min-width: 320px; overflow-x: hidden; }
.start-screen {
  display: block;
  min-height: 100svh;
  padding: 56px var(--mobile-gutter) 30px;
}
.start-card { width: 100%; max-width: none; padding: 0; }
.start-rules { display: none; }
.eyebrow { padding-right: 88px; font-size: 12px; }
.hero-language {
  position: absolute;
  z-index: 8;
  top: 12px;
  right: var(--mobile-gutter);
  width: 82px;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(16,24,39,.94);
  box-shadow: 0 5px 16px rgba(0,0,0,.24);
}
.hero-language button { min-height: 30px; padding: 3px; border-radius: 6px; font-size: 12px; }
.logo-lockup { gap: 10px; margin: 12px 0 8px; }
.logo-mark { width: 46px; height: 46px; flex: 0 0 46px; }
.logo-lockup h1 { min-width: 0; font-size: clamp(32px, 10.2vw, 44px); letter-spacing: -.075em; }
.hero-slogan { font-size: 22px; }
.start-copy { max-width: 100%; font-size: 16px; }
.hero-market-art { display: none; }
.feature-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
.feature-grid article { min-height: 86px; padding: 11px; }
.feature-grid b { font-size: 15px; }
.feature-grid small { font-size: 13px; }
.start-form {
  width: 100%;
  max-width: none;
  grid-template-columns: minmax(0,1fr);
  gap: 12px;
  padding: 15px;
  overflow: hidden;
}
.profile-picker { grid-template-columns: repeat(5,minmax(0,1fr)); }
.game-mode-buttons { grid-template-columns: 1fr; gap: 9px; }
.game-mode-buttons button { min-height: 68px; }
.game-mode-buttons small { font-size: 13px; }
.join-form { grid-template-columns: minmax(0,1fr) auto; }
.active-survivals,.developer-board-button,.developer-email,.start-meta,.service-disclaimer { width: 100%; max-width: none; }

/* Game shell defaults to one mobile column. */
.app-shell { width: 100%; padding-bottom: 78px; }
.topbar { height: 76px; grid-template-columns: 54px minmax(0,1fr) auto; }
.brand { width: 54px; padding: 0 8px; }
.brand > span:last-child { display: none; }
.brand-mark { width: 38px; height: 38px; }
.round-status { min-width: 0; gap: 8px; padding: 0 5px; }
.timer-wrap { width: min(43vw,170px); }
.turn-badge span,.turn-badge small { display: none; }
.top-actions { gap: 4px; padding-right: 5px; }
.top-actions .connection,.top-actions .icon-button { display: none; }
.game-room-code { min-width: 72px; min-height: 44px; padding: 5px; }
.game-room-code small { font-size: 11px; }
.game-room-code b { font-size: 13px; }
.survival-status {
  top: 76px;
  min-height: 250px;
  grid-template-columns: repeat(2,minmax(0,1fr));
  padding: 8px;
}
.survival-status > div { padding: 8px; }
.survival-status small { font-size: 13px; }
.survival-status strong { font-size: 16px; }
.end-turn-button { grid-column: 1 / -1; grid-row: 4; min-height: 58px; }
.blind-banner { top: 326px; }
.game-layout { display: block; min-height: 0; }
.market-panel {
  position: static;
  width: auto;
  height: auto;
  max-height: none;
  margin: 10px var(--mobile-gutter);
  overflow: visible;
}
.market-tools { min-height: 58px; padding: 9px 12px; }
.search-box { width: 100%; }
.stock-table-head { display: none; }
.stock-list {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 12px;
  max-height: none;
  padding: 12px;
  overflow: visible;
}
.stock-row.sector-card {
  position: relative;
  min-height: 650px;
  display: grid;
  grid-template-columns: 58px minmax(0,1fr) 72px;
  grid-template-rows: auto 290px auto 108px;
  grid-template-areas:
    "heading heading quote"
    "stats ceo position"
    "company company company"
    "chart chart chart";
  gap: 12px 8px;
  padding: 14px;
  border: 1px solid color-mix(in srgb,var(--sector-accent,#6aa8e8) 45%,var(--line-soft));
  border-radius: var(--card-radius);
  background: linear-gradient(160deg,var(--bg-panel-2),color-mix(in srgb,var(--sector-accent,#6aa8e8) 10%,var(--bg-panel)) 100%);
  box-shadow: var(--sector-shadow);
  color: var(--text-main);
  overflow: hidden;
}
.stock-row.sector-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: .28;
  background: radial-gradient(circle at 15% 25%,var(--sector-accent,#6aa8e8) 0 8%,transparent 9%),linear-gradient(135deg,transparent 55%,var(--sector-accent,#6aa8e8) 56% 58%,transparent 59%);
  pointer-events: none;
}
.stock-row.sector-card > * { position: relative; z-index: 1; }
.sector-card.is-active { border: 2px solid #dc2638; box-shadow: 0 0 0 3px rgba(220,38,56,.12),var(--sector-shadow); }
.sector-technology { --sector-accent:#4e8ee8; --sector-art:url("assets/sector-ceo-technology-v2.webp"); }
.sector-financials { --sector-accent:#49a473; --sector-art:url("assets/sector-ceo-financials-v2.webp"); }
.sector-health-care { --sector-accent:#57b99b; --sector-art:url("assets/sector-ceo-health-care-v2.webp"); }
.sector-consumer-discretionary { --sector-accent:#ed9a45; --sector-art:url("assets/sector-ceo-consumer-discretionary-v2.webp"); }
.sector-consumer-staples { --sector-accent:#6fa263; --sector-art:url("assets/sector-ceo-consumer-staples-v2.webp"); }
.sector-industrials { --sector-accent:#6e83b6; --sector-art:url("assets/sector-ceo-industrials-v2.webp"); }
.sector-communication-services { --sector-accent:#8b72d8; --sector-art:url("assets/sector-ceo-communication-services-v2.webp"); }
.sector-materials { --sector-accent:#b38a5a; --sector-art:url("assets/sector-ceo-materials-v2.webp"); }
.sector-energy { --sector-accent:#dc7047; --sector-art:url("assets/sector-ceo-energy-v2.webp"); }
.sector-utilities { --sector-accent:#4eafa8; --sector-art:url("assets/sector-ceo-utilities-v2.webp"); }
.sector-real-estate { --sector-accent:#b36b79; --sector-art:url("assets/sector-ceo-real-estate-v2.webp"); }
.sector-card-heading { grid-area: heading; min-width: 0; display: flex; align-items: center; gap: 7px; text-align: left; }
.sector-card-heading em { color: var(--text-main); font-style: normal; font-size: clamp(16px,5vw,21px); font-weight: 950; line-height: 1.15; }
.sector-card-heading .owned-badge { margin: 0; font-size: 12px; }
.sector-ceo {
  grid-area: ceo;
  width: 100%;
  height: 290px;
  display: block;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background-repeat: no-repeat;
  background-size: 300% 100%;
  background-color: #0b1220;
  transition: transform .25s ease,filter .25s ease,box-shadow .25s ease;
}
.sector-ceo.ceo-technology { background-image: url("assets/sector-ceo-technology-v2.webp"); background-size: 300% auto; }
.sector-ceo.ceo-financials { background-image: url("assets/sector-ceo-financials-v2.webp"); }
.sector-ceo.ceo-health-care { background-image: url("assets/sector-ceo-health-care-v2.webp"); }
.sector-ceo.ceo-consumer-discretionary { background-image: url("assets/sector-ceo-consumer-discretionary-v2.webp"); }
.sector-ceo.ceo-consumer-staples { background-image: url("assets/sector-ceo-consumer-staples-v2.webp"); }
.sector-ceo.ceo-industrials { background-image: url("assets/sector-ceo-industrials-v2.webp"); }
.sector-ceo.ceo-communication-services { background-image: url("assets/sector-ceo-communication-services-v2.webp"); }
.sector-ceo.ceo-materials { background-image: url("assets/sector-ceo-materials-v2.webp"); }
.sector-ceo.ceo-energy { background-image: url("assets/sector-ceo-energy-v2.webp"); }
.sector-ceo.ceo-utilities { background-image: url("assets/sector-ceo-utilities-v2.webp"); }
.sector-ceo.ceo-real-estate { background-image: url("assets/sector-ceo-real-estate-v2.webp"); }
.mood-up .sector-ceo { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(220,38,56,.28); }
.mood-down .sector-ceo { filter: saturate(.72); box-shadow: 0 8px 22px rgba(23,104,212,.24); }
.sector-company { grid-area: company; min-width: 0; text-align: left; }
.sector-company b,.sector-company small { display: block; }
.sector-company b { font-size: 21px; line-height: 1.3; }
.sector-company small { margin-top: 4px; color: var(--text-sub); font-size: 14px; line-height: 1.45; white-space: normal; }
.sector-stats { grid-area: stats; display: flex; flex-direction: column; justify-content: space-around; gap: 7px; }
.sector-stats small { width: 54px; min-height: 54px; display: grid; place-content: center; padding: 5px 3px; border: 2px solid color-mix(in srgb,var(--sector-accent,#6aa8e8) 55%,var(--line-soft)); border-radius: 50%; background: rgba(7,11,20,.84); color: var(--text-sub); font-size: 9px; line-height: 1.15; text-align: center; }
.sector-stats b { display: block; margin-top: 3px; color: var(--text-main); font-size: 13px; }
.sector-position { grid-area: position; display: flex; flex-direction: column; justify-content: space-around; gap: 7px; }
.sector-position small { min-height: 58px; display: flex; flex-direction: column; justify-content: center; padding: 6px 3px; border: 1px solid var(--line-soft); border-radius: 7px; background: rgba(7,11,20,.84); color: var(--text-sub); font-size: 8px; line-height: 1.15; text-align: center; }
.sector-position b { display: block; margin-top: 5px; color: var(--text-main); font-size: 12px; overflow-wrap: anywhere; }
.sector-position b.profit { color: #d51f37; }
.sector-position b.loss { color: #1768d4; }
.sector-quote { grid-area: quote; min-width: 76px; text-align: right; }
.sector-quote strong,.sector-quote b,.sector-quote small { display: block; }
.sector-quote strong { font-size: 18px; }
.sector-quote b { margin-top: 2px; font-size: 15px; }
.sector-quote small { margin-top: 3px; color: var(--text-sub); font-size: 11px; }
.mood-up .sector-quote b { color: #dc2638; }
.mood-down .sector-quote b { color: #1768d4; }
.mood-neutral .sector-quote b { color: #66778c; }
.sector-chart-shell { grid-area: chart; min-width: 0; display: block; padding: 8px 10px 6px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(7,11,20,.84); text-align: left; }
.sector-chart-shell > small { display: block; color: var(--text-sub); font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.sector-mini-chart { width: 100%; height: 74px; display: block; overflow: visible; }
.sector-mini-chart line { stroke: #d9e3ed; stroke-width: 1; }
.sector-mini-chart polyline { fill: none; stroke: #7a8999; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sector-mini-chart.up polyline { stroke: #dc2638; }
.sector-mini-chart.down polyline { stroke: #1768d4; }
.workspace { padding: 10px var(--mobile-gutter); }
.right-rail { position: static; width: auto; height: auto; padding: 0 var(--mobile-gutter) 12px; }
.selected-position-grid { grid-template-columns: 1fr 1fr; }
.intel-cards { grid-template-columns: 1fr; }
.portfolio-card { grid-template-columns: 40px minmax(0,1fr) auto; }
.portfolio-card > span:nth-of-type(n+3) { display: none; }
.portfolio-pnl { display: block !important; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; height: auto; }
.tab { min-height: 54px; padding: 0 8px; font-size: 15px; }
.game-bottom-nav { height: 70px; grid-template-columns: repeat(7,minmax(44px,1fr)); }
.game-bottom-nav small { display: none; }

/* Web layout is opt-in. */
@media (min-width: 900px) {
  :root { --mobile-gutter: 22px; }
  .start-screen {
    display: grid;
    grid-template-columns: minmax(0,1fr) 330px;
    gap: clamp(28px,4vw,70px);
    padding: 48px clamp(28px,5vw,86px) 0;
  }
  .start-card { max-width: 820px; padding: 0 20px 54px 0; }
  .start-rules { display: grid; }
  .hero-language { top: 18px; right: clamp(28px,5vw,86px); }
  .eyebrow { padding-right: 0; font-size: 14px; }
  .logo-lockup h1 { font-size: clamp(60px,7vw,104px); }
  .hero-slogan { font-size: clamp(24px,2.2vw,34px); }
  .feature-grid { grid-template-columns: repeat(4,1fr); }
  .start-form { max-width: 680px; grid-template-columns: 1fr 1fr; padding: 22px; }
  .start-form > label[for="nickname"],.start-form > #nickname,.profile-setup,#game-mode-label,.game-mode-buttons { grid-column: 1 / -1; }
  .game-mode-buttons { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .game-mode-buttons button { min-height: 82px; }
  .topbar { grid-template-columns: 290px 1fr 320px; }
  .brand { width: auto; padding: 0 22px; }
  .brand > span:last-child { display: inline; }
  .turn-badge span,.turn-badge small { display: block; }
  .top-actions .connection,.top-actions .icon-button { display: block; }
  .survival-status { min-height: 96px; grid-template-columns: repeat(6,minmax(115px,1fr)) 155px; }
  .survival-status small { font-size: 14px; }
  .survival-status strong { font-size: 18px; }
  .end-turn-button { grid-column: auto; grid-row: auto; min-height: 66px; }
  .blind-banner { top: 172px; }
  .game-layout {
    display: grid;
    grid-template-columns: minmax(0,1fr) 370px;
    align-items: start;
    min-height: calc(100vh - 172px);
  }
  .market-panel { grid-column: 1 / -1; margin: 16px var(--mobile-gutter) 0; }
  .stock-list { grid-template-columns: repeat(auto-fit,minmax(350px,1fr)); gap: 16px; }
  .stock-row.sector-card { min-height: 650px; grid-template-columns: 68px minmax(0,1fr) 86px; grid-template-rows: auto 310px auto 112px; padding: 16px; }
  .sector-ceo { height: 310px; }
  .sector-stats small { width: 64px; min-height: 64px; font-size: 10px; }
  .sector-position small { min-height: 64px; font-size: 9px; }
  .workspace { grid-column: 1; padding: 16px 10px 16px var(--mobile-gutter); }
  .right-rail { grid-column: 2; position: sticky; top: 188px; height: calc(100vh - 204px); padding: 16px var(--mobile-gutter) 16px 6px; }
  .selected-position-grid { grid-template-columns: repeat(4,1fr); }
  .intel-cards { grid-template-columns: repeat(3,1fr); }
  .portfolio-card { grid-template-columns: 44px minmax(155px,1.4fr) repeat(4,minmax(84px,1fr)) minmax(100px,1fr); }
  .portfolio-card > span:nth-of-type(n+3) { display: block; }
  .tabs { display: flex; }
  .tab { min-height: 60px; padding: 0 16px; font-size: 16px; }
  .game-bottom-nav small { display: block; }
}

@media (min-width: 1440px) {
  .stock-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

/* Canonical dark mobile layout */
/* Dark max-480 mobile SLG shell */
:root {
  --mobile-gutter:12px;
  --card-radius:16px;
  --nav-height:64px;
  --action-height:72px;
  --refine-navy:#070b14;
  --sector-shadow:0 16px 34px rgba(0,0,0,.3);
}

html,body { width:100%; min-width:320px; max-width:100%; overflow-x:hidden; }
.start-screen { display:block; grid-template-columns:none; min-height:100dvh; padding:calc(20px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom)); }
.start-card { width:100%; max-width:none; padding:0; }
.start-rules { display:none; }
.hero-language { border-color:var(--line-soft); background:rgba(16,24,39,.94); box-shadow:0 8px 20px rgba(0,0,0,.24); }
.start-form,.active-survivals,.start-rules { border-color:var(--line-soft); background:rgba(16,24,39,.94); box-shadow:0 16px 36px rgba(0,0,0,.28); }
.start-form input,.start-form select,.join-form input { border-color:var(--line-soft); background:#0b1220; color:var(--text-main); }
.mobile-app-shell {
  position:relative;
  width:min(100%,480px);
  min-height:100dvh;
  margin-inline:auto;
  padding:0 0 calc(var(--nav-height) + var(--action-height) + 28px + env(safe-area-inset-bottom));
  overflow:clip;
  background:var(--bg-main);
  color:var(--text-main);
  box-shadow:0 0 80px rgba(0,0,0,.55);
}
.mobile-app-shell * { min-width:0; }
.mobile-app-shell button { -webkit-tap-highlight-color:transparent; }

.battle-hud {
  position:sticky;
  top:0;
  z-index:50;
  width:100%;
  border-bottom:1px solid var(--line-soft);
  background:rgba(7,11,20,.96);
  box-shadow:0 10px 26px rgba(0,0,0,.32);
  backdrop-filter:blur(18px);
}
.topbar {
  position:relative;
  top:auto;
  z-index:auto;
  width:100%;
  height:60px;
  grid-template-columns:48px minmax(0,1fr) 74px;
  border:0;
  background:transparent;
  box-shadow:none;
}
.brand { width:48px; padding:0 7px; }
.brand > span:last-child { display:none; }
.brand-mark { width:34px; height:34px; border-radius:9px; }
.round-status { min-width:0; gap:8px; padding:0 4px; }
.turn-badge { min-width:40px; }
.turn-badge b { color:var(--gold-main); font-size:24px; }
.turn-badge span,.turn-badge small { display:none; }
.timer-wrap { width:auto; min-width:0; }
.timer-line { color:var(--text-sub); font-size:11px; }
.timer-line strong { color:var(--text-main); font-size:17px; }
.timer-wrap #turn-progress { background:linear-gradient(90deg,var(--blue-main),var(--red-main)); }
.progress-track { height:4px; background:var(--bg-panel-2); }
.top-actions { gap:4px; padding-right:7px; }
.top-actions .connection,.top-actions .icon-button { display:none; }
.game-room-code { min-width:66px; min-height:42px; border:1px solid rgba(45,212,191,.24); border-radius:10px; background:rgba(45,212,191,.08); color:var(--green-main); }
.game-room-code small { font-size:10px; }
.game-room-code b { font-size:12px; }
.final-countdown { inset:4px 74px 4px 48px; background:var(--bg-panel); }

.survival-status {
  position:relative;
  top:auto;
  z-index:auto;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  min-height:102px;
  gap:1px;
  padding:1px 8px 8px;
  border:0;
  background:transparent;
  box-shadow:none;
}
.survival-status > div {
  min-width:0;
  min-height:44px;
  padding:6px 8px;
  border:1px solid var(--line-soft);
  border-radius:9px;
  background:var(--bg-panel);
}
.survival-status small { color:var(--text-muted); font-size:10px; }
.survival-status strong { margin-top:3px; color:var(--text-main); font-size:13px; }
.survival-status .risk strong.safe { color:var(--safe); }
.survival-status .risk strong.warning { color:var(--warning); }
.survival-status .risk strong.danger { color:var(--danger); }
.blind-banner { top:162px; z-index:47; border-color:rgba(242,184,75,.25); background:#211b10; }
.blind-banner strong { color:var(--gold-main); }
.blind-banner small { color:#c9aa71; }

.game-layout { display:block; min-height:0; padding:0; background:var(--bg-main); }
.battle-tab-panel { width:100%; min-width:0; padding:12px; }
.battle-tab-panel[hidden] { display:none !important; }
.workspace,.right-rail { display:grid; width:100%; min-width:0; gap:12px; padding:0; }
.panel,.identity-card {
  min-width:0;
  border:1px solid var(--line-soft);
  border-radius:var(--card-radius);
  background:var(--bg-panel);
  color:var(--text-main);
  box-shadow:0 12px 30px rgba(0,0,0,.22);
}
.panel-header { min-height:58px; padding:12px 14px; border-color:var(--line-soft); }
.panel-header h2 { margin-top:4px; color:var(--text-main); font-size:18px; line-height:1.2; }
.panel-header.compact h2 { font-size:16px; }

.chart-panel { overflow:hidden; }
.chart-header { padding:14px; }
.selected-stock-icon,.stock-title .flag { background:var(--bg-panel-2); }
.stock-title h2 { color:var(--text-main); font-size:18px; }
.stock-title span { color:var(--text-sub); }
.quote strong { color:var(--text-main); font-size:26px; }
.selected-position-grid { grid-template-columns:repeat(2,minmax(0,1fr)); margin:0 12px 8px; border:1px solid var(--line-soft); border-radius:12px; }
.selected-position-grid div { min-width:0; padding:10px; border-color:var(--line-soft); background:#0b1220; }
.selected-position-grid small { color:var(--text-muted); font-size:11px; }
.selected-position-grid strong { color:var(--text-main); font-size:13px; }
.profit,.up { color:#ff7185 !important; }
.loss,.down { color:#65a8ff !important; }
.chart-meta { min-height:44px; padding:0 12px; color:var(--text-sub); }
.chart-type-toggle { background:#0b1220; }
.chart-type-toggle button { min-height:36px; color:var(--text-sub); }
.chart-type-toggle button.is-active { background:var(--blue-main); color:#fff; }
.chart-wrap { height:240px; min-height:240px; background:linear-gradient(180deg,rgba(47,128,237,.05),transparent); }
.chart-stats { gap:16px; overflow-x:auto; color:var(--text-sub); scrollbar-width:none; }
.chart-stats b { color:var(--text-main); }

.market-panel { position:static; width:100%; height:auto; max-height:none; margin:0; overflow:visible; }
.market-tools { min-height:60px; padding:8px 12px; border-color:var(--line-soft); }
.search-box,.rank-search { width:100%; min-height:48px; border-color:var(--line-soft); background:#0b1220; color:var(--text-main); }
.search-box input,.rank-search input { color:var(--text-main); }
.stock-table-head { display:none; }
.stock-list {
  display:grid;
  grid-auto-flow:column;
  grid-auto-columns:minmax(314px,88%);
  grid-template-columns:none;
  gap:12px;
  max-height:none;
  padding:12px;
  overflow-x:auto;
  overflow-y:hidden;
  scroll-snap-type:x mandatory;
  scrollbar-width:none;
}
.stock-row.sector-card {
  width:100%;
  height:440px;
  min-height:440px;
  grid-template-columns:56px minmax(0,1fr) 74px;
  grid-template-rows:auto 228px auto 78px;
  gap:10px 8px;
  padding:14px;
  border:1px solid color-mix(in srgb,var(--sector-accent,#6488b8) 45%,var(--line-soft));
  border-radius:18px;
  background:
    linear-gradient(180deg,rgba(7,11,20,.08),rgba(7,11,20,.9)),
    radial-gradient(circle at 50% 20%,color-mix(in srgb,var(--sector-accent,#6488b8) 20%,transparent),transparent 56%),
    var(--bg-panel-2);
  color:var(--text-main);
  box-shadow:var(--sector-shadow);
  scroll-snap-align:center;
}
.stock-row.sector-card::before { opacity:.96; }
.sector-card.is-active { border-color:var(--red-main); box-shadow:0 0 0 2px rgba(239,35,60,.18),var(--sector-shadow); }
.sector-card-heading em,.sector-company b { color:#fff; }
.sector-card-heading em { font-size:18px; }
.sector-company b { font-size:23px; }
.sector-company span,.sector-company small { color:var(--text-sub); }
.sector-quote strong { color:#fff; font-size:24px; }
.sector-position { border-color:var(--line-soft); background:rgba(7,11,20,.72); }
.sector-position small { color:var(--text-sub); font-size:10px; }
.sector-position b { color:var(--text-main); }
.sector-ceo { filter:saturate(.9) contrast(1.04); }
.mood-up .sector-ceo { filter:saturate(1.1) contrast(1.06); }
.mood-down .sector-ceo { filter:saturate(.72) brightness(.78); }
.sector-art-fallback {
  display:grid;
  place-items:center;
  min-height:180px;
  border:1px dashed var(--line-soft);
  border-radius:14px;
  background:linear-gradient(145deg,var(--bg-panel-2),#0b1220);
  color:var(--text-muted);
}
.sector-stats small,.sector-position small,.sector-chart-shell,.sector-mini-chart {
  border-color:var(--line-soft);
  background:rgba(7,11,20,.78);
  color:var(--text-sub);
}
.sector-stats b,.sector-position b { color:var(--text-main); }
.sector-chart-shell > small { color:var(--text-sub); }
.sector-mini-chart { border-color:var(--line-soft); background:rgba(7,11,20,.74); }

.intel-panel { margin:0 12px 4px; border-color:rgba(47,128,237,.2); background:linear-gradient(145deg,rgba(47,128,237,.08),var(--bg-panel)); }
.intel-panel .panel-header button { min-height:36px; color:#7fb6ff; }
.intel-cards { display:grid; grid-template-rows:repeat(3,minmax(58px,auto)); padding:8px; }
.intel-feed-row { border-color:var(--line-soft); background:#0b1220; }
.intel-ticker-item:hover,.intel-feed-row:hover { background:var(--bg-panel-2); }
.intel-feed-card { border-color:var(--line-soft); background:var(--bg-panel); color:var(--text-sub); }
.intel-feed-card.age-0 { background:var(--bg-panel-2); }
.intel-feed-card.age-1 { background:var(--bg-panel); opacity:.82; }
.intel-feed-card.age-2 { background:#0b1220; opacity:.68; }
.intel-feed-card > small,.intel-feed-card > span,.intel-feed-card > em { color:var(--text-sub); }
.intel-report-tag { background:rgba(242,184,75,.14); color:var(--gold-main); }
.intel-change-value.up { color:#d5233b; }
.intel-change-value.down { color:#1768d4; }
.intel-trade-link,.intel-sector-link { color:#7fb6ff; }

.tabs { min-height:54px; padding:0 6px; border-color:var(--line-soft); overflow-x:auto; }
.tab,.app-tab { min-height:48px; color:var(--text-sub); }
.tab.is-active,.app-tab.is-active { border-color:var(--red-main); color:var(--text-main); }
.tab-content { padding:14px; }
.trade-grid { grid-template-columns:minmax(0,1fr); gap:10px; }
.side-toggle { grid-column:auto; min-height:52px; border:1px solid var(--line-soft); border-radius:12px; background:#0b1220; }
.side-toggle button { min-height:48px; color:var(--text-sub); }
.side-toggle button.is-active[data-side="buy"] { background:var(--red-main); color:#fff; }
.side-toggle button.is-active[data-side="sell"] { background:var(--blue-main); color:#fff; }
.input-suffix,.order-summary,.holdings-mini { border-color:var(--line-soft); background:#0b1220; color:var(--text-main); }
.input-suffix input { color:var(--text-main); }
.quick-amounts button { min-height:44px; border:1px solid var(--line-soft); background:var(--bg-panel-2); color:var(--text-sub); }
.trade-submit { min-height:56px; font-size:16px; }
.trade-submit.buy { background:var(--red-main); color:#fff; }
.trade-submit.sell { background:var(--blue-main); color:#fff; }
.finance-grid,.item-grid,.order-form { grid-template-columns:minmax(0,1fr); }
.finance-card,.item-card { border-color:var(--line-soft); background:#0b1220; color:var(--text-main); }

.portfolio-list,.log-list,.ranking-list { display:grid; gap:8px; padding:12px; }
.portfolio-card,.rank-row,.log-row,.holding-row {
  min-width:0;
  border:1px solid var(--line-soft);
  border-radius:12px;
  background:#0b1220;
  color:var(--text-main);
}
.portfolio-card { grid-template-columns:40px minmax(0,1fr) auto; min-height:72px; }
.portfolio-card > span:nth-of-type(n+3) { display:none; }
.portfolio-icon,.holding-flag { background:var(--bg-panel-2); color:#8cc0ff; }
.holding-flag { border-color:var(--line-soft); }
.holding-actions button { min-height:44px; background:var(--bg-panel-2); color:#fff; }
.holding-actions .quick-buy { background:var(--red-main); color:#fff; }
.holding-actions .quick-sell { background:var(--blue-main); color:#fff; }
.holding-actions .quick-buy:hover { background:var(--red-dark); }
.holding-actions .quick-sell:hover { background:#246bbf; }
.rank-row.is-me { border-color:rgba(242,184,75,.45); background:rgba(242,184,75,.08); }
.rank-number,.my-rank b { color:var(--gold-main); }
.asset-panel,.identity-card { background:var(--bg-panel); }
.identity-card { border-color:var(--line-soft); }
.identity-actions button { background:var(--bg-panel-2); color:var(--text-main); }
.asset-breakdown,.salary-row { color:var(--text-main); }
.market-pulse,.sector-rail-controls button,.current-stock-label,.portfolio-list > p,.net-assets,.rank-stock-jump {
  border-color:var(--line-soft);
  background:var(--bg-panel-2);
  color:var(--text-main);
}
.sector-rail-controls button:hover { border-color:var(--red-main); background:rgba(239,35,60,.1); color:#ff8292; }

.turn-action-bar {
  position:fixed;
  left:50%;
  bottom:calc(var(--nav-height) + env(safe-area-inset-bottom));
  z-index:76;
  display:grid;
  grid-template-columns:minmax(0,.82fr) minmax(0,1.18fr);
  gap:8px;
  width:min(100%,480px);
  min-height:var(--action-height);
  padding:8px 12px;
  transform:translateX(-50%);
  border-top:1px solid var(--line-soft);
  background:rgba(7,11,20,.97);
  backdrop-filter:blur(18px);
}
.turn-action-bar button {
  min-width:0;
  min-height:56px;
  display:grid;
  grid-template-columns:24px minmax(0,1fr);
  grid-template-rows:auto auto;
  align-items:center;
  padding:7px 10px;
  border:1px solid var(--line-soft);
  border-radius:12px;
  cursor:pointer;
}
.turn-action-bar button span { grid-row:1 / 3; font-size:20px; }
.turn-action-bar button b,.turn-action-bar button small { overflow:hidden; text-align:left; text-overflow:ellipsis; white-space:nowrap; }
.turn-action-bar button b { font-size:14px; }
.turn-action-bar button small { color:rgba(255,255,255,.72); font-size:10px; }
.open-trade-button { background:linear-gradient(135deg,#296fbf,var(--blue-main)); color:#fff; }
.end-turn-button { grid-column:auto; grid-row:auto; background:linear-gradient(135deg,var(--red-main),var(--red-dark)); color:#fff; box-shadow:0 8px 20px rgba(239,35,60,.2); }
.end-turn-button:disabled { background:var(--bg-panel-2); color:var(--text-muted); box-shadow:none; }

.game-bottom-nav {
  position:fixed;
  left:50%;
  right:auto;
  bottom:0;
  z-index:75;
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  width:min(100%,480px);
  height:calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding:0 4px env(safe-area-inset-bottom);
  transform:translateX(-50%);
  border-top:1px solid var(--line-soft);
  background:rgba(10,16,28,.98);
  box-shadow:0 -10px 30px rgba(0,0,0,.3);
  backdrop-filter:blur(18px);
}
.game-bottom-nav button {
  min-width:0;
  min-height:48px;
  border:0;
  border-radius:10px;
  background:transparent;
  color:var(--text-muted);
}
.game-bottom-nav button:hover,.game-bottom-nav button[aria-current="page"] { background:rgba(47,128,237,.1); color:var(--text-main); }
.game-bottom-nav span { font-size:20px; }
.game-bottom-nav small { display:block; font-size:11px; }

.chat-fab {
  position:fixed;
  left:calc(50% + min(240px,50vw) - 58px);
  right:auto;
  bottom:calc(var(--nav-height) + var(--action-height) + 18px + env(safe-area-inset-bottom));
  z-index:78;
  width:44px;
  height:44px;
  border:1px solid rgba(242,184,75,.35);
  border-radius:50%;
  background:linear-gradient(145deg,#8a5d12,var(--gold-main));
  color:#171006;
  box-shadow:0 10px 24px rgba(0,0,0,.35);
}
.global-chat-sheet { position:fixed; inset:0; z-index:109; background:rgba(0,0,0,.68); }
.global-chat { position:fixed; left:50%; bottom:0; z-index:110; width:min(100%,480px); max-height:min(72dvh,620px); transform:translateX(-50%); border:1px solid var(--line-soft); border-radius:20px 20px 0 0; background:var(--bg-panel); color:var(--text-main); }
.global-chat-header { border-color:var(--line-soft); background:var(--bg-panel-2); }
.global-chat-messages,.global-chat-compose { background:#0b1220; }
.global-chat-message,.global-chat-message.mine,.global-chat-message.ai { background:var(--bg-panel-2); color:var(--text-main); }
.global-chat-message.mine { background:rgba(47,128,237,.18); }
.global-chat-message b { color:#8cc0ff; }
.global-chat-message time { color:var(--text-muted); }
.global-chat-compose { padding-bottom:calc(10px + env(safe-area-inset-bottom)); }
.global-chat-compose input { background:var(--bg-panel); color:var(--text-main); }
.global-chat-compose button { min-height:48px; background:var(--blue-main); color:#fff; }

.modal-backdrop { z-index:110; }
.modal { border-color:var(--line-soft); background:var(--bg-panel); color:var(--text-main); }
.stock-detail-modal-card > .modal-close { border-color:var(--line-soft); background:var(--bg-panel-2); color:var(--text-main); box-shadow:0 8px 20px rgba(0,0,0,.28); }
.stock-detail-modal-card { width:min(100%,480px); }
.stock-detail-character { min-height:108px; border-color:var(--line-soft); background:linear-gradient(145deg,var(--bg-panel-2),#0b1220); }
.stock-detail-character-copy h2 { color:var(--text-main); }
.stock-detail-character-copy p { color:var(--text-sub); }
.stock-detail-sector-switcher { border-color:var(--line-soft); background:#0b1220; }
.stock-detail-sector-list button { border-color:var(--line-soft); background:var(--bg-panel-2); color:var(--text-main); }
.stock-detail-body { grid-template-columns:minmax(0,1fr); }
.stock-detail-body .chart-wrap { height:210px; min-height:210px; }
.detail-buy { background:var(--red-main); color:#fff; }
.detail-sell { background:var(--blue-main); color:#fff; }
.level-high { border-color:#f13b4f; }
.level-mid { border-color:#29c987; }
.level-low { border-color:#3c8ff0; }

@media (min-width: 390px) {
  :root { --mobile-gutter:14px; }
  .battle-tab-panel { padding-inline:14px; }
  .stock-list { grid-auto-columns:minmax(330px,90%); }
}
@media (min-width: 412px) {
  .survival-status { grid-template-columns:repeat(6,minmax(0,1fr)); min-height:58px; }
  .survival-status > div { min-height:48px; padding-inline:5px; }
  .survival-status small { font-size:9px; }
  .survival-status strong { font-size:11px; }
  .blind-banner { top:118px; }
  .stock-row.sector-card { height:456px; min-height:456px; }
}
@media (min-width: 430px) {
  :root { --mobile-gutter:16px; }
  .battle-tab-panel { padding-inline:16px; }
  .stock-list { grid-auto-columns:minmax(356px,92%); }
  .selected-position-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
}
@media (min-width: 481px) {
  body::before {
    content:"MARKET SURVIVAL";
    position:fixed;
    top:28px;
    left:28px;
    color:rgba(148,163,184,.16);
    font:800 13px/1 var(--mono);
    letter-spacing:.22em;
  }
  #stock-survival-root,.start-screen,.matchmaking-screen,.lobby-screen,.mobile-app-shell { border-inline:1px solid rgba(255,255,255,.05); }
}

.stock-detail-character-copy p,
.stock-detail-body .trade-grid label,
.stock-detail-body .input-suffix input,
.stock-detail-body .quick-amounts button,
.stock-detail-body .order-summary span,
.stock-detail-body .order-summary strong,
.stock-detail-body .trade-submit { font-size:14px; }
.stock-detail-sector-list button small,
.stock-detail-body .selected-position-grid small,
.stock-detail-body .chart-meta,
.stock-detail-body .chart-stats { font-size:12px; }

/* Final intelligence dark cascade */
.market-panel > .intel-panel {
  border:1px solid var(--line-soft);
  background:linear-gradient(145deg,rgba(47,128,237,.1),var(--bg-panel));
  color:var(--text-main);
  box-shadow:0 12px 28px rgba(0,0,0,.22);
}
.market-panel > .intel-panel .panel-header { border-color:var(--line-soft); background:transparent; }
.market-panel > .intel-panel .panel-header h2 { color:var(--text-main); }
.market-panel > .intel-panel .panel-header .section-kicker,
.market-panel > .intel-panel .intel-title-block #open-intel-messages { color:#7fb6ff; }
.market-panel > .intel-panel .intel-cards {
  border:1px solid var(--line-soft);
  background:#0b1220;
  grid-template-columns:1fr;
  grid-template-rows:repeat(3,44px);
}
.market-panel > .intel-panel .intel-feed-row {
  border-color:var(--line-soft);
  background:var(--bg-panel);
  color:var(--text-sub);
}
.market-panel > .intel-panel .intel-feed-row:hover { background:var(--bg-panel-2); }
.market-panel > .intel-panel .intel-feed-items { background:#0b1220; }
.market-panel > .intel-panel .intel-feed-card {
  border-color:var(--line-soft);
  background:var(--bg-panel-2);
  color:var(--text-sub);
}
.market-panel > .intel-panel .intel-feed-card.age-0 { background:var(--bg-panel-2); opacity:1; }
.market-panel > .intel-panel .intel-feed-card.age-1 { background:var(--bg-panel); opacity:.82; }
.market-panel > .intel-panel .intel-feed-card.age-2 { background:#0b1220; opacity:.68; }
.market-panel > .intel-panel .intel-feed-card > small,
.market-panel > .intel-panel .intel-feed-card > span,
.market-panel > .intel-panel .intel-feed-card > em { color:var(--text-sub); }
.market-panel > .intel-panel .intel-feed-row > .intel-category { color:var(--text-main); }

/* Restored mobile controls and contrast */
.topbar { grid-template-columns:40px minmax(0,1fr) auto; }
.brand { width:40px; padding-inline:4px; }
.brand-mark { width:32px; height:32px; }
.round-status { gap:4px; padding-inline:3px; }
.turn-badge { min-width:34px; }
.top-actions { display:flex; align-items:center; gap:4px; padding-right:4px; }
.top-actions .connection { display:none; }
.top-actions .icon-button {
  display:grid;
  place-items:center;
  width:48px;
  height:48px;
  min-width:48px;
  min-height:48px;
  border:1px solid var(--line-soft);
  border-radius:11px;
  background:var(--bg-panel-2);
  color:var(--text-main);
}
.game-room-code { min-width:54px; min-height:48px; padding-inline:4px; }
.connection-status {
  display:block;
  min-width:48px;
  max-width:58px;
  padding:4px;
  color:var(--text-muted);
  font:700 9px/1.15 var(--sans);
  text-align:center;
  line-height:1.1;
}
.connection-status[data-connection-state="connected"] { color:var(--green-main); }
.connection-status[data-connection-state="reconnecting"] { color:var(--warning); }
.connection-status[data-connection-state="disconnected"] { color:var(--danger); }
.active-survival-empty p,.portfolio-empty p { margin:0; color:var(--text-muted); }
.portfolio-empty { display:grid; justify-items:center; gap:8px; padding:24px; border:1px dashed var(--line-soft); border-radius:9px; background:var(--bg-panel); text-align:center; }
.portfolio-empty strong { color:var(--text-main); }
.empty-state-action { min-height:48px; margin-top:8px; }
@media (min-width: 390px) {
  .topbar { grid-template-columns:40px minmax(0,1fr) auto; }
  .round-status { gap:6px; padding-inline:4px; }
}

.stock-detail-sector-switcher > div:first-child strong { color:var(--text-main); }
.stock-detail-sector-switcher > div:first-child small { color:var(--text-sub); }
.sector-ceo {
  background-color:#0b1220;
  background-image:linear-gradient(145deg,var(--bg-panel-2),#0b1220);
}

.stock-detail-actions button { min-height:48px; }
.chart-type-toggle button { min-height:48px; }
.stock-detail-body .chart-type-toggle button { min-height:48px; }
.stock-detail-body .side-toggle { min-height:48px; }
.stock-detail-body .side-toggle button { min-height:48px; }
.stock-detail-body .quick-amounts button { min-height:48px; }
.language-choice button { min-height:48px; }
.sector-rail-controls button { width:48px; height:48px; min-height:48px; }
.stock-detail-sector-list button { min-height:56px; }

/* First-game guide and resilient sector portraits */
.onboarding-sheet { align-items:end; padding:0; }
.onboarding-sheet-card {
  width:min(100%,480px);
  max-height:min(82dvh,620px);
  margin-top:auto;
  padding:28px 22px calc(24px + env(safe-area-inset-bottom));
  border-radius:22px 22px 0 0;
  background:var(--bg-panel);
  color:var(--text-main);
}
.onboarding-sheet-card h2 { margin:6px 0 18px; font-size:24px; }
.onboarding-steps { display:grid; gap:10px; margin:0 0 22px; padding:0; list-style:none; }
.onboarding-steps li { display:grid; grid-template-columns:38px minmax(0,1fr); gap:12px; align-items:center; min-height:58px; padding:10px 12px; border:1px solid var(--line-soft); border-radius:12px; background:var(--bg-panel-2); }
.onboarding-steps b { display:grid; place-items:center; width:36px; height:36px; border-radius:50%; background:var(--blue-main); color:#fff; font:900 15px/1 var(--mono); }
.onboarding-steps span { color:var(--text-main); font-size:15px; font-weight:800; }
#onboarding-confirm { width:100%; min-height:52px; }

.sector-art-probe {
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  opacity:0;
  pointer-events:none;
  clip-path:inset(50%);
}
.sector-ceo.sector-art-fallback,
.sector-ceo.has-image-error {
  position:relative;
  background-color:#111b2d;
  background-image:radial-gradient(circle at 50% 28%,rgba(47,128,237,.24),transparent 42%),linear-gradient(145deg,#162033,#090f1b);
  background-position:center;
  background-size:cover;
}
.sector-ceo.sector-art-fallback::after {
  content:attr(data-sector-fallback);
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding:18px;
  color:#cbd5e1;
  font-size:clamp(15px,4vw,20px);
  font-weight:900;
  text-align:center;
  text-shadow:0 2px 12px rgba(0,0,0,.7);
}

/* Checkpoint HUD and final touch targets */
.final-countdown {
  position:fixed;
  inset:auto;
  left:50%;
  top:0;
  z-index:90;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto auto;
  align-items:center;
  gap:8px;
  width:min(100%,480px);
  min-width:0;
  min-height:60px;
  height:calc(60px + env(safe-area-inset-top));
  padding:env(safe-area-inset-top) 14px 0;
  transform:translateX(-50%);
  border-radius:0;
}
.final-countdown.tick { animation:mobile-countdown-hit .75s ease-out both; }
@keyframes mobile-countdown-hit {
  0% { transform:translateX(-50%) scale(1.02); background:rgba(155,20,27,.98); }
  100% { transform:translateX(-50%) scale(1); background:rgba(72,13,17,.98); }
}
.trade-submit { min-height:56px; }
.stock-detail-body .trade-submit { min-height:56px; }
.trade-grid input { min-height:48px; height:48px; }
.stock-detail-body .trade-grid input { min-height:48px; }
.order-form input { min-height:48px; height:48px; }
.order-form select { min-height:48px; height:48px; }
.inline-form input { min-height:48px; height:48px; }
.intel-trade-link { min-height:48px; }
.holding-actions button { min-height:48px; }
.stock-detail-body .tabs { height:auto; min-height:48px; overflow:visible; }
.stock-detail-body .tab { min-height:48px; }
.market-panel > .intel-panel .intel-title-block #open-intel-messages { min-height:48px; }

/* Canonical dark card and compact intelligence layout */
.profile-open-button {
  border:1px solid var(--line-soft);
  background:var(--bg-panel-2);
  color:var(--text-main);
}
.profile-open-button small { color:var(--text-sub); font-size:12px; }
.my-goal-panel {
  border:1px solid var(--line-soft);
  background:#0b1220;
  color:var(--text-main);
}
.my-goal-progress { background:var(--bg-panel-2); }

.stock-row.sector-card {
  position:relative;
  padding-top:58px;
  cursor:pointer;
}
.stock-row.sector-card::before {
  inset:0 0 auto;
  width:auto;
  height:92px;
  opacity:1;
  background:linear-gradient(180deg,rgba(0,0,0,.78),transparent);
}
.sector-card-heading {
  position:absolute;
  top:12px;
  left:12px;
  z-index:4;
  display:flex;
  align-items:center;
  gap:7px;
  max-width:calc(100% - 24px);
  padding:7px 10px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:9px;
  background:rgba(7,11,20,.88);
  color:var(--text-main);
  text-align:left;
}
.sector-card-heading em { overflow:hidden; font-size:15px; font-weight:950; text-overflow:ellipsis; white-space:nowrap; }

.market-panel > .intel-panel { display:block; margin:0 12px 4px; overflow:hidden; }
.market-panel > .intel-panel .panel-header { min-height:52px; padding:8px 10px; background:var(--bg-panel-2); }
.market-panel > .intel-panel .intel-title-block { display:flex; width:100%; align-items:center; justify-content:space-between; gap:8px; }
.market-panel > .intel-panel .intel-title-block h2 { margin:2px 0 0; font-size:15px; }
.market-panel > .intel-panel .intel-title-block #open-intel-messages { min-height:36px; padding:0 8px; white-space:nowrap; }
.market-panel > .intel-panel .intel-cards,
.intel-cards {
  display:grid;
  grid-template-columns:1fr;
  grid-template-rows:repeat(3,44px);
  gap:1px;
  padding:0;
  border:0;
  background:var(--line-soft);
}
.market-panel > .intel-panel #intel-cards .intel-feed-row,
#intel-cards .intel-feed-row,
.intel-feed-row {
  min-width:0;
  min-height:44px;
  width:100%;
  display:grid;
  grid-template-columns:72px minmax(0,1fr);
  border:0;
  background:var(--bg-panel);
}
.intel-feed-row > .intel-category {
  display:grid;
  place-items:center;
  min-height:44px;
  padding:0 7px;
  background:#0b1220;
  color:var(--text-main);
  font-size:11px;
}
.intel-latest-card {
  min-width:0;
  min-height:44px;
  display:flex;
  align-items:center;
  gap:8px;
  padding:0 10px;
  border:0;
  background:var(--bg-panel-2);
  color:var(--text-main);
  text-align:left;
  cursor:pointer;
}
.intel-latest-card:disabled { cursor:default; opacity:.72; }
.intel-latest-card > span,.intel-latest-card > strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.intel-latest-card > strong { margin-left:auto; font-size:12px; }
.intel-report-tag { max-width:58%; padding:4px 7px; border:1px solid rgba(242,184,75,.34); border-radius:6px; background:rgba(242,184,75,.14); color:var(--gold-main); font-size:11px; font-weight:900; }
.intel-change-value.up { color:#d5233b; }
.intel-change-value.down { color:#1768d4; }
.intel-change-value.flat { color:var(--text-sub); }

/* Balanced readability system */
:root {
  --ui-body:15px;
  --ui-label:12px;
  --ui-title:18px;
  --ui-metric:24px;
  --ui-gap:12px;
}

.mobile-app-shell {
  font-size:var(--ui-body);
  line-height:1.45;
}
.mobile-app-shell button,
.mobile-app-shell input,
.mobile-app-shell select { font:inherit; }
.section-kicker { font-size:11px; line-height:1.2; }
.panel-header { min-height:64px; padding:12px 14px; }
.panel-header h2 { font-size:var(--ui-title); line-height:1.25; }

@media (max-width:899px) {
  .start-screen { padding:68px 16px 32px; }
  .hero-language { top:14px; right:16px; }
  .logo-lockup { min-height:50px; align-items:center; margin:8px 0 10px; }
  .logo-mark { width:44px; height:44px; flex-basis:44px; }
  .logo-lockup h1 { max-width:calc(100vw - 86px); font-size:clamp(34px,10.5vw,48px); line-height:1.08; letter-spacing:-.065em; }
  .hero-slogan { margin:12px 0 6px; font-size:clamp(20px,5.7vw,25px); line-height:1.25; }
  .start-copy { margin-bottom:20px; font-size:14px; line-height:1.65; }
  .feature-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .feature-grid article { min-height:96px; display:flex; flex-direction:column; justify-content:center; padding:14px; }
  .feature-grid b { display:block; font-size:15px; line-height:1.35; }
  .feature-grid small { display:block; margin-top:5px; font-size:12px; line-height:1.45; }
  .start-form { gap:14px; padding:18px 16px; }
  .start-form label { font-size:13px; }
  .start-form input,.join-form input { min-height:48px; font-size:15px; }
  .game-mode-buttons { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
  .game-mode-buttons button { min-height:78px; padding:10px 6px; }
  .game-mode-buttons b { font-size:14px; }
  .game-mode-buttons small { font-size:11px; line-height:1.35; }
}

.topbar { height:64px; grid-template-columns:40px minmax(0,1fr) auto; }
.brand { width:40px; }
.round-status { gap:6px; }
.turn-badge { min-width:34px; }
.timer-line { gap:6px; margin-bottom:5px; }
.timer-line span { overflow:hidden; font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.timer-line strong { flex:0 0 auto; font-size:18px; white-space:nowrap; }
.top-actions { gap:5px; }
.connection-status,#rules-button { display:none; }
.game-room-code { min-width:58px; min-height:44px; }
.top-actions .icon-button { width:44px; height:44px; min-width:44px; min-height:44px; }

.survival-status {
  grid-template-columns:repeat(3,minmax(0,1fr));
  min-height:116px;
  gap:6px;
  padding:0 8px 8px;
}
.survival-status > div { min-height:48px; padding:7px 8px; overflow:hidden; }
.survival-status small { display:block; overflow:hidden; font-size:var(--ui-label); line-height:1.2; text-overflow:ellipsis; white-space:nowrap; }
.survival-status strong { display:block; overflow:hidden; margin-top:5px; font-size:15px; line-height:1.2; text-overflow:ellipsis; white-space:nowrap; }
.blind-banner { top:180px; }

.battle-tab-panel { padding:var(--ui-gap); }
.workspace,.right-rail { gap:var(--ui-gap); }
.identity-card {
  min-height:0;
  grid-template-columns:52px minmax(0,1fr) auto;
  grid-template-rows:auto auto auto;
  gap:8px 12px;
  padding:14px;
  align-items:center;
}
.identity-card > .avatar { grid-column:1; grid-row:1 / span 2; width:48px; height:48px; }
.identity-card > div:nth-child(2) { grid-column:2; grid-row:1 / span 2; }
.identity-card > div:nth-child(2) span,
.identity-card > div:nth-child(2) small { font-size:11px; line-height:1.4; }
.identity-card > div:nth-child(2) strong { margin:2px 0; font-size:16px; line-height:1.3; overflow-wrap:anywhere; }
.my-rank { grid-column:3; grid-row:1; }
.my-rank span { font-size:11px; white-space:nowrap; }
.my-rank b { font-size:24px; white-space:nowrap; }
.identity-actions { grid-column:3; grid-row:2; align-self:start; margin:0; }
.identity-actions button { width:36px; height:34px; font-size:15px; }
.my-goal-panel { grid-column:1 / -1; grid-row:3; width:100%; min-height:88px; display:grid; gap:3px; padding:12px 14px; border-radius:12px; }
.my-goal-panel > span { font-size:11px; line-height:1.3; }
.my-goal-panel > strong { font-size:16px; line-height:1.3; }
.my-goal-panel > small { font-size:13px; line-height:1.45; overflow-wrap:break-word; }
.my-goal-progress { width:100%; height:5px; margin-top:5px; }

.asset-panel .panel-header,
.portfolio-panel .panel-header { min-height:64px; }
.asset-title-button h2 { display:block; margin-top:4px; font-size:var(--ui-title); }
.asset-title-button small { display:none; }
.net-assets { padding:16px 16px 13px; font-size:var(--ui-metric); white-space:nowrap; }
.asset-breakdown { gap:12px 18px; padding:0 16px; }
.asset-breakdown div,.asset-breakdown button,.asset-breakdown b { font-size:14px; line-height:1.35; }
.asset-breakdown button small { font-size:11px; }
.salary-row { margin-top:14px; padding-top:12px; font-size:13px; }
.portfolio-panel .panel-header strong { font-size:14px; white-space:nowrap; }
.portfolio-empty { min-height:180px; padding:24px 18px; }
.portfolio-empty strong { font-size:16px; }
.portfolio-empty p { font-size:13px; line-height:1.5; }

.market-tools { min-height:64px; padding:8px 12px; }
.search-box { min-height:48px; }
.search-box input { font-size:14px; }
.market-panel > .intel-panel .intel-title-block { display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-rows:auto auto; align-items:center; column-gap:8px; }
.market-panel > .intel-panel .intel-title-block .section-kicker { grid-column:1; grid-row:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.market-panel > .intel-panel .intel-title-block h2 { grid-column:1; grid-row:2; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#open-intel-messages { grid-column:2; grid-row:1 / span 2; min-width:114px; padding-inline:8px; font-size:12px; white-space:nowrap; }
.stock-list { grid-auto-columns:92%; gap:14px; }
.stock-row.sector-card {
  height:auto;
  min-height:520px;
  grid-template-columns:62px minmax(0,1fr) 78px;
  grid-template-rows:auto 250px auto minmax(92px,auto);
  gap:12px 9px;
  padding:64px 14px 14px;
  overflow:hidden;
}
.sector-card-heading { top:14px; left:14px; max-width:calc(100% - 28px); min-height:38px; padding:8px 11px; }
.sector-card-heading em { font-size:17px; line-height:1.25; }
.sector-ceo { height:250px; }
.sector-company b { font-size:21px; line-height:1.25; }
.sector-company small { font-size:13px; line-height:1.45; }
.sector-stats small { width:60px; min-height:60px; font-size:11px; line-height:1.2; }
.sector-stats b { font-size:14px; }
.sector-position small { min-height:64px; padding:7px 4px; font-size:11px; line-height:1.25; }
.sector-position b { font-size:13px; line-height:1.25; overflow-wrap:normal; }
.sector-quote { min-width:78px; }
.sector-quote strong { font-size:24px; white-space:nowrap; }
.sector-quote b { font-size:15px; white-space:nowrap; }
.sector-quote small { font-size:11px; }
.sector-chart-shell { min-height:92px; padding:9px 10px 7px; }
.sector-chart-shell > small { font-size:11px; }
.sector-mini-chart { height:64px; }

.chart-header { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:start; padding:16px 14px 12px; }
.stock-title { min-width:0; }
.stock-title > div { min-width:0; }
.stock-title span:not(.flag) { display:block; overflow:hidden; font-size:11px; line-height:1.3; text-overflow:ellipsis; white-space:nowrap; }
.stock-title h2 { overflow:hidden; margin-top:5px; font-size:20px; line-height:1.25; text-overflow:ellipsis; white-space:nowrap; }
.quote { min-width:max-content; }
.quote strong { font-size:var(--ui-metric); white-space:nowrap; }
.quote span { font-size:12px; white-space:nowrap; }
.selected-position-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1px; }
.selected-position-grid div { min-height:64px; padding:10px 12px; }
.selected-position-grid small { font-size:12px; line-height:1.25; }
.selected-position-grid strong { display:block; margin-top:5px; font-size:15px; line-height:1.25; overflow-wrap:break-word; }
.chart-meta { min-height:52px; gap:10px; }
.chart-stats { min-height:48px; padding:12px 14px; font-size:12px; }
.trade-panel .tabs { display:flex; min-height:56px; padding:0 8px; overflow-x:auto; overflow-y:hidden; scrollbar-width:none; }
.trade-panel .tab { flex:0 0 auto; min-width:max-content; min-height:52px; padding:0 12px; font-size:14px; white-space:nowrap; }
.tab-content { padding:14px; }
.trade-grid { grid-template-columns:minmax(0,1fr); gap:12px; align-items:stretch; }
.trade-grid label,.order-form label { font-size:13px; line-height:1.35; }
.side-toggle { display:grid; grid-template-columns:1fr 1fr; }
.quick-amounts { grid-template-columns:repeat(4,minmax(0,1fr)); }
.quick-amounts button { min-width:0; font-size:13px; }
.order-summary { min-height:48px; padding:12px; }
.order-summary span { font-size:13px; }
.trade-submit { width:100%; min-height:56px; font-size:16px; }
.holdings-mini { gap:10px; font-size:12px; line-height:1.45; flex-wrap:wrap; }

.turn-action-bar button,
.game-bottom-nav button { min-height:48px; }
.turn-action-bar button b { font-size:15px; }
.turn-action-bar button small { font-size:11px; }
.game-bottom-nav small { font-size:11px; line-height:1.2; }

@media (max-width:359px) {
  :root { --ui-body:14px; --ui-gap:10px; }
  .start-screen { padding-inline:12px; }
  .logo-lockup h1 { font-size:32px; }
  .hero-slogan { font-size:19px; }
  .feature-grid { grid-template-columns:1fr 1fr; gap:8px; }
  .feature-grid article { min-height:88px; padding:11px; }
  .game-mode-buttons { grid-template-columns:1fr; }
  .top-actions .icon-button { display:none; }
  .stock-list { grid-auto-columns:94%; padding-inline:8px; }
  .stock-row.sector-card { grid-template-columns:58px minmax(0,1fr) 72px; padding-inline:11px; }
  .sector-stats small { width:56px; min-height:56px; }
}

/* PDF milestone: C-type mobile battle arena */
.battle-arena-panel { position:fixed; z-index:34; right:max(12px,calc((100vw - 480px)/2 + 12px)); bottom:126px; left:max(12px,calc((100vw - 480px)/2 + 12px)); padding:14px; border:1px solid #304662; border-radius:18px; background:linear-gradient(145deg,rgba(17,31,52,.98),rgba(7,15,28,.99)); box-shadow:0 20px 50px #000b; color:#fff; }
.battle-arena-panel > header { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.battle-arena-panel header span { color:#59a8ff; font-size:10px; font-weight:900; letter-spacing:.12em; }
.battle-arena-panel h2 { margin:2px 0 0; font-size:18px; }
#battle-phase-badge { padding:6px 9px; border-radius:8px; background:#e51e42; font-size:11px; letter-spacing:.08em; }
.battle-stepper { display:grid; grid-template-columns:repeat(3,1fr); gap:5px; margin-bottom:10px; }
.battle-stepper i { padding:5px 7px; border-radius:7px; background:#0a1322; color:#61738c; font-size:10px; font-style:normal; }
.battle-stepper i.is-active { background:#193554; color:#7fc4ff; }
.battle-actions { display:grid; grid-template-columns:repeat(5,1fr); gap:6px; }
.battle-actions button { min-width:0; min-height:54px; padding:6px 2px; border:1px solid #314761; border-radius:10px; background:#13223a; color:#fff; }
.battle-actions button span,.battle-actions button b { display:block; }
.battle-actions button span { margin-bottom:3px; color:#ff3156; font-size:17px; }
.battle-actions button b { font-size:11px; }
.battle-actions button:disabled { opacity:.4; }
.battle-result { display:flex; align-items:center; justify-content:space-between; min-height:42px; margin-top:9px; padding:7px 10px; border-radius:10px; background:#091322; color:#b8c6da; font-size:12px; }
.battle-result strong { display:grid; width:30px; height:30px; place-items:center; border-radius:8px; background:#f5f7fb; color:#0a1627; font-size:18px; }
.event-reveal { display:grid; grid-template-columns:1fr auto; gap:2px 10px; margin-top:8px; padding:10px 12px; border:1px solid #f0bd37; border-radius:12px; background:linear-gradient(135deg,#fff9df,#fff); box-shadow:0 0 24px #f2c84b55; animation:event-flip .46s cubic-bezier(.2,.8,.2,1); }
.event-reveal small { color:#967000; font-weight:900; letter-spacing:.1em; }
.event-reveal strong { grid-column:1; color:var(--arena-ink); font-size:14px; }
.event-reveal span { grid-column:2; grid-row:1 / span 2; align-self:center; color:var(--arena-red); font-size:19px; font-weight:900; }
.event-reveal.grade-rare { border-color:#4c8cff; box-shadow:0 0 30px #1870ff66; }
.event-reveal.grade-epic { border-color:#9d4cff; box-shadow:0 0 34px #812fff88; }
.event-reveal.grade-disaster { border-color:#ff193d; background:linear-gradient(135deg,#2a0010,#0b1020); box-shadow:0 0 42px #ff002caa; animation:event-flip .46s cubic-bezier(.2,.8,.2,1),danger-shake .32s 2; }
.event-reveal.grade-disaster strong { color:#fff; }
.result-card::before,.result-card::after { position:absolute; top:12px; color:#ff3156; content:"✦  ◆  ✦"; font-size:18px; letter-spacing:8px; animation:surge-pop .8s infinite alternate; }
.result-card::before { left:18px; }.result-card::after { right:10px; color:#1167d8; }
.battle-actions:has([data-mvp-action="all-in"]:not(.is-hidden)) { grid-template-columns:repeat(3,1fr); }
@keyframes event-flip { from { opacity:0; transform:perspective(500px) rotateX(-65deg) scale(.85); } to { opacity:1; transform:none; } }
@keyframes danger-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
@media (min-width:900px) { .battle-arena-panel { right:24px; bottom:84px; left:auto; width:430px; } }

/* 2026 reference theme: clean infographic arena */
:root {
  --arena-navy:#061a3a;
  --arena-blue:#1167d8;
  --arena-red:#e30019;
  --arena-coral:#ff3b48;
  --arena-ink:#07152c;
  --arena-paper:#f7fbff;
  --arena-line:#c8d9ee;
}
.start-screen { background:linear-gradient(180deg,rgba(247,251,255,.88),rgba(238,246,255,.96)),url("./assets/stock-survival-theme-reference.png") center top/cover no-repeat; color:var(--arena-ink); }
.start-grid { background-image:radial-gradient(#1268d51c 1px,transparent 1px),linear-gradient(120deg,transparent 49.8%,#e300190b 50%); background-size:18px 18px,100% 100%; }
.start-card { border:1px solid #b8cde6; background:rgba(255,255,255,.88); box-shadow:0 24px 70px #082e641f; backdrop-filter:blur(14px); }
.logo-lockup h1,.start-card label,.start-card h2,.start-card b { color:var(--arena-ink); }
.logo-lockup h1 em,.hero-slogan { color:var(--arena-red); }
.logo-mark,.button-primary { background:linear-gradient(135deg,var(--arena-red),#ff3958); box-shadow:0 12px 28px #e3001930; }
.feature-grid article,.start-form,.active-survivals { border-color:#c8d9ee; background:rgba(247,251,255,.92); color:#465b75; }
.game-mode-buttons button,.profile-open-button,.join-form input { border-color:#b8cde6; background:#fff; color:var(--arena-ink); }
.game-mode-buttons button.is-active { border-color:var(--arena-red); background:linear-gradient(180deg,#fff4f5,#fff); box-shadow:inset 0 -3px var(--arena-red); }
.mobile-app-shell { background:linear-gradient(180deg,#eff7ff 0,#f9fbfe 44%,#e8f2ff 100%); color:var(--arena-ink); }
.battle-hud,.game-bottom-nav,.turn-action-bar { background:var(--arena-navy); color:#fff; }
.panel,.identity-card,.survival-status>div,.stock-row.sector-card { border-color:var(--arena-line); background:linear-gradient(150deg,#fff,#eef6ff); color:var(--arena-ink); box-shadow:0 12px 30px #0c376218; }
.panel h2,.identity-card strong,.asset-panel strong,.portfolio-panel strong { color:var(--arena-ink); }
.section-kicker { color:var(--arena-blue); }
.stock-row.sector-card.up { box-shadow:inset 0 0 0 2px #e3001955,0 12px 30px #e300191a; }
.stock-row.sector-card.down { box-shadow:inset 0 0 0 2px #1167d855,0 12px 30px #1167d81a; }
.stock-row.sector-card.move-surge { box-shadow:inset 0 0 0 3px #e30019,0 0 42px #ff193d66; }
.stock-row.sector-card.move-surge::after { content:"↗"; position:absolute; right:12px; top:64px; color:#ff1839; font-size:42px; font-weight:900; filter:drop-shadow(0 0 12px #ff1839); animation:surge-pop .7s infinite alternate; }
.stock-row.sector-card.move-crash { box-shadow:inset 0 0 0 3px #1167d8,0 0 42px #1167d866; animation:danger-shake .35s 2; }
.stock-row.sector-card.move-crash::after { content:"↘"; position:absolute; right:12px; top:64px; color:#1167d8; font-size:42px; font-weight:900; filter:drop-shadow(0 0 12px #1167d8); }
@keyframes surge-pop { from{transform:scale(.9) translateY(3px)} to{transform:scale(1.08) translateY(-3px)} }
.battle-arena-panel { border-color:#9dbbe0; background:linear-gradient(145deg,rgba(255,255,255,.99),rgba(230,242,255,.99)); box-shadow:0 22px 55px #06234d38; color:var(--arena-ink); }
.battle-actions button { border-color:#b6cae1; background:#fff; color:var(--arena-ink); }
.battle-result { background:var(--arena-navy); color:#dceaff; }
.game-bottom-nav button,.turn-action-bar button { color:#dceaff; }
.game-bottom-nav button[aria-current="page"],.game-bottom-nav button.is-active { color:#fff; background:#11396b; }
[data-tooltip] { position:relative; }
[data-tooltip]::after { position:absolute; z-index:100; right:50%; bottom:calc(100% + 8px); width:max-content; max-width:170px; padding:6px 9px; border-radius:7px; background:#061a3af2; color:#fff; content:attr(data-tooltip); font-size:11px; font-weight:800; line-height:1.2; opacity:0; pointer-events:none; transform:translate(50%,5px); transition:.16s ease; }
[data-tooltip]:hover::after,[data-tooltip]:focus-visible::after { opacity:1; transform:translate(50%,0); }
@media (max-width:480px) {
  .game-bottom-nav button small,.battle-actions button b { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
  .game-bottom-nav button span { font-size:23px; }
  .battle-actions button span { margin:0; font-size:22px; }
  .battle-actions button { min-height:50px; }
}
.expansion-panel { overflow:visible; }
.alternative-assets { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; padding:12px 14px; }
.alternative-assets>div { min-height:92px; padding:8px; border:1px solid #b9cee6; border-radius:12px; background:#fff; color:var(--arena-ink); text-align:center; }
.alternative-assets span,.alternative-assets b,.alternative-assets small { display:block; }
.alternative-assets span { color:var(--arena-red); font-size:20px; }
.alternative-assets b { margin:3px 0; font-size:13px; }
.alternative-assets small { color:#45617f; font-size:11px; }
.alternative-assets i { display:grid; grid-template-columns:1fr 1fr; gap:4px; margin-top:6px; }
.alternative-assets button { min-height:28px; border:0; border-radius:6px; background:#eaf3ff; color:var(--arena-blue); font-size:16px; font-style:normal; }
.alternative-assets button:last-child { background:#fff0f2; color:var(--arena-red); }
.coin-all-in { width:calc(100% - 28px); min-height:42px; margin:0 14px 12px; border:0; border-radius:10px; background:linear-gradient(135deg,#ff7b00,#e30019); color:#fff; font-size:20px; }
.skill-hand { display:flex; gap:8px; padding:0 14px 14px; overflow-x:auto; }
.skill-hand button { flex:0 0 92px; min-height:52px; border:1px solid #173f73; border-radius:11px; background:var(--arena-navy); color:#fff; }
.skill-hand button.is-selected { border-color:#ff3156; box-shadow:inset 0 0 0 2px #ff3156,0 0 18px #ff315644; }
.skill-hand .skill-confirm { flex-basis:52px; background:linear-gradient(135deg,#e30019,#ff3156); font-size:22px; }
.skill-hand span { color:#ffcf3b; }
.skill-hand b { display:block; margin-top:3px; overflow:hidden; font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.hidden-objective { margin:0 14px 14px; padding:10px 12px; border:1px dashed #7d5ccc; border-radius:12px; background:linear-gradient(135deg,#f8f2ff,#fff); }
.skill-intel { display:grid; gap:4px; margin:0 14px 10px; padding:9px 11px; border-radius:9px; background:#eaf4ff; color:#164b86; font-size:11px; font-weight:800; }
.hidden-objective span,.hidden-objective b,.hidden-objective small { display:block; }
.hidden-objective span { color:#7447b7; font-size:9px; font-weight:900; letter-spacing:.12em; }
.hidden-objective b { margin:3px 0; color:#2c1747; font-size:14px; }
.hidden-objective small { color:#69577f; font-size:11px; }
.major-badge { padding:4px 6px; border-radius:6px; background:#f5c63b; color:#311f00; font-size:9px; font-style:normal; font-weight:900; }
.emergency-sell-button { min-height:48px; border:1px solid #ffb02e; border-radius:11px; background:#fff7dc; color:#a64b00; font-size:20px; }
#bankruptcy-status.danger { color:var(--arena-red); animation:pulse 1s infinite alternate; }
.bounty-mark { display:inline-block; margin-right:5px; padding:2px 4px; border-radius:5px; background:#ffebac; color:#9b5100; font-size:9px; font-style:normal; }
