:root {
  --bg: #f3efe7;
  --surface: #eee9e0;
  --surface-active: #e7e1d7;
  --fg: #1c1c1c;
  --muted: #6c6862;
  --dim: #9b958d;
  --border: #d3cdc3;
  --ink: #1c1c1c;
  --paper: #f3efe7;
  --green: #4e805a;
  --header-h: 70px;
  --rail-w: clamp(320px, 25vw, 382px);
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { color: var(--fg); background: var(--bg); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
button, a { color: inherit; font: inherit; -webkit-tap-highlight-color: transparent; }
button { border: 0; }
*::selection { color: var(--paper); background: var(--ink); }
*:focus-visible { outline: 2px solid var(--ink); outline-offset: -3px; }

.app-header {
  height: var(--header-h);
  padding: 0 clamp(18px, 2.2vw, 30px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--fg); text-decoration: none; font-family: var(--font-mono); font-size: 16px; font-weight: 700; }
.brand img { display: block; width: 32px; height: 32px; padding: 3px; background: var(--ink); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-button { height: 40px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; color: var(--paper); background: var(--ink); border: 1px solid var(--ink); text-decoration: none; font-size: 12px; font-weight: 600; }
.header-button i:last-child { margin-left: 4px; }

.download-shell { height: calc(100dvh - var(--header-h)); min-height: 0; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.platform-rail { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--bg); }
.rail-head { min-height: 112px; padding: 20px 27px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.eyebrow { margin: 0 0 7px; color: var(--dim); font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
.rail-head h1 { margin: 0; font-size: 22px; line-height: 1.15; letter-spacing: -.035em; }
.device-count { width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid var(--border); color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.platform-list { min-height: 0; flex: 1; display: grid; grid-template-rows: repeat(6, minmax(0, 1fr)); }
.platform-row {
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 12px 18px 12px 27px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  position: relative;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease;
}
.platform-row::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--ink); transform: scaleY(0); transition: transform 150ms ease; }
.platform-row:hover { background: var(--surface); }
.platform-row.is-selected { background: var(--surface-active); }
.platform-row.is-selected::before { transform: scaleY(1); }
.row-icon { width: 42px; height: 42px; display: grid; place-items: center; color: var(--paper); background: var(--ink); font-size: 20px; }
.row-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.row-copy strong { overflow: hidden; font-size: 14px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.row-copy small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.row-state { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; color: var(--dim); font-family: var(--font-mono); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.row-state i { font-size: 14px; }
.row-state.is-live { color: var(--green); }

.platform-detail { min-width: 0; min-height: 0; display: flex; position: relative; background: var(--surface); }
.detail-body { width: min(520px, calc(100% - 48px)); min-height: 0; margin: auto; padding: 24px 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.detail-app-icon { width: clamp(68px, 6vw, 88px); height: clamp(68px, 6vw, 88px); display: grid; place-items: center; color: var(--paper); background: var(--ink); font-size: clamp(30px, 3vw, 40px); }
.detail-body h2 { margin: 22px 0 0; font-size: clamp(29px, 3.2vw, 48px); line-height: 1.02; letter-spacing: -.055em; }
.detail-version { margin: 10px 0 0; color: var(--muted); font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; }
.detail-action { min-width: 220px; min-height: 45px; margin-top: 20px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--paper); background: var(--ink); border: 1px solid var(--ink); text-decoration: none; font-size: 12px; font-weight: 700; }
.detail-action.is-pending { color: var(--muted); background: transparent; border-color: var(--border); cursor: default; }

@media (max-width: 760px) {
  :root { --header-h: 58px; }
  .app-header { padding: 0 14px; }
  .brand { font-size: 13px; }
  .brand img { width: 28px; height: 28px; }
  .header-button span, .header-button i:last-child { display: none; }
  .header-button { width: 38px; height: 38px; padding: 0; justify-content: center; font-size: 17px; }
  .download-shell { display: flex; flex-direction: column; }
  .platform-rail { flex: 1 1 62%; border-right: 0; border-bottom: 1px solid var(--border); }
  .rail-head { min-height: 68px; padding: 11px 16px; }
  .rail-head h1 { font-size: 17px; }
  .eyebrow { margin-bottom: 4px; font-size: 7px; }
  .device-count { width: 30px; height: 30px; }
  .platform-list { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
  .platform-row { padding: 8px 10px; grid-template-columns: 34px minmax(0, 1fr); gap: 9px; border-right: 1px solid var(--border); }
  .platform-row:nth-child(even) { border-right: 0; }
  .row-icon { width: 34px; height: 34px; font-size: 17px; }
  .row-copy { gap: 3px; }
  .row-copy strong { font-size: 12px; }
  .row-copy small { font-size: 8px; }
  .row-state { position: absolute; right: 8px; bottom: 7px; flex-direction: row; gap: 3px; font-size: 6px; }
  .row-state i { font-size: 10px; }
  .platform-detail { flex: 1 1 38%; }
  .detail-body { width: calc(100% - 28px); padding: 10px 0; }
  .detail-app-icon { width: 52px; height: 52px; font-size: 25px; }
  .detail-body h2 { font-size: clamp(23px, 7vw, 30px); }
  .detail-version { margin-top: 6px; font-size: 8px; }
  .detail-action { min-width: min(250px, 84%); min-height: 39px; margin-top: 14px; font-size: 10px; }
}

@media (max-height: 680px) and (max-width: 760px) {
  .rail-head { min-height: 55px; padding-block: 7px; }
  .platform-rail { flex-basis: 66%; }
  .platform-detail { flex-basis: 34%; }
  .detail-body h2 { font-size: 20px; }
  .detail-action { min-height: 34px; margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
