/* Phone Screens view (static/phone-screens.js). Phones only: at 600px and below it replaces
   the ASX futures board sub-tab. Columns are proportional so the list fits 360 to 440px
   phones with no sideways scroll; every column but the contract is centred. */
.ps { display: none; }
.ps-layer[hidden] { display: none; }

@media (max-width: 600px) {
  #sub-futuresboard > :not(.ps) { display: none !important; }
  #sub-futuresboard > .ps { display: block; }
  /* Screens is its own section on phones: no Trading sub-tabs or tape above it, and the
     help bubble gives way to the call card at the bottom. */
  #tab-asx:has(> #sub-futuresboard.active) > :is(.sub-tab-bar, #market-tape) { display: none !important; }
  body[data-mobile-sub="futuresboard"] .contact-desk-fab { display: none; }

  .ps { --ps-gutter: max(16px, env(safe-area-inset-left, 0px)); color: var(--text); }
  .ps-delay { display: flex; align-items: center; gap: 8px; margin: -12px 0 2px; padding: 8px 12px; border-radius: 10px;
    font-size: 12.5px; font-weight: 600; color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); }
  .ps-delay-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
  .ps-status { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; min-height: 44px; font-size: 12px; color: var(--text-muted); }
  .ps-live { display: flex; align-items: center; gap: 6px; min-width: 0; }
  .ps-live-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ps-live-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--positive); }
  .ps-live-dot--stale { background: var(--amber); }
  .ps-live-dot--closed { background: var(--text-dim); }
  .ps-count { margin-left: auto; white-space: nowrap; }
  .ps .ps-edit {
    min-width: 0;
    height: 44px;
    padding: 0 4px 0 8px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: 600 15px/1 var(--font-sans);
  }

  .ps-table { margin: 0 calc(-1 * var(--ps-gutter)); }
  .ps-row {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) repeat(3, minmax(0, 1fr)) minmax(0, 0.9fr) minmax(0, 0.7fr);
    align-items: center;
    column-gap: 4px;
    min-height: 54px;
    padding: 0 var(--ps-gutter);
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
  }
  .ps-head {
    position: sticky;
    top: calc(var(--top-bar-h) + env(safe-area-inset-top, 0px));
    z-index: 4;
    min-height: 34px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    font: 600 11px/1 var(--font-sans);
    letter-spacing: var(--track-normal);
    color: var(--text-muted);
  }
  .ps-head > :not(:first-child), .ps-num { text-align: center; }
  .ps-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-family: var(--font-sans); }
  .ps-tenor { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
  .ps-sub { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ps-dot { display: inline-block; flex: none; width: 6px; height: 6px; border-radius: 50%; }
  .ps-num { font-size: clamp(12.5px, 3.55vw, 14px); white-space: nowrap; border-radius: 6px; }
  .ps-strong { font-weight: 600; }
  /* No trade yet today: LAST shows the settle in grey. */
  .ps-last-settle { color: var(--text-dim); }
  /* One banner per state: a full-width band with the state colour. */
  .ps-banner {
    min-height: 34px;
    background: color-mix(in srgb, var(--surface-elevated) 70%, transparent);
    font-family: var(--font-sans);
  }
  .ps-banner-name { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: var(--track-wide); }
  .ps-banner-name .ps-dot { width: 8px; height: 8px; }
  .ps-banner-n { grid-column: 2 / -1; text-align: right; font-size: 11px; color: var(--text-dim); }
  .ps-chg { font-weight: 600; font-size: clamp(12px, 3.3vw, 13px); }
  .ps-up { color: var(--positive); }
  .ps-down { color: var(--negative); }
  .ps-flat { color: var(--text-muted); }
  .ps-vol { font-size: 12px; color: var(--text-muted); }
  .ps-flash { animation: ps-flash 1.2s ease-out; }
  @keyframes ps-flash { from { background: color-mix(in srgb, var(--accent) 30%, transparent); } to { background: transparent; } }
  .ps-gone .ps-tenor { color: var(--text-muted); }
  .ps-empty { margin: 20px var(--ps-gutter); font: 14px/1.45 var(--font-sans); color: var(--text-muted); }
  .ps-body .ps-primary { margin: 0 var(--ps-gutter) 16px; width: calc(100% - 2 * var(--ps-gutter)); }
  .ps-note { margin: 8px 0 0; font-size: 11px; line-height: 1.45; color: var(--text-dim); }

  .ps .ps-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    margin-top: 14px;
    border-radius: 12px;
    border: 1px dashed var(--border-strong);
    background: transparent;
    color: var(--accent);
    font: 600 15px/1 var(--font-sans);
  }
  .ps-add[hidden] { display: none !important; }

  .ps-section { margin-top: 24px; }
  .ps-eyebrow { margin: 0 0 4px; font: 600 12px/1.3 var(--font-sans); letter-spacing: var(--track-normal); color: var(--text-muted); }
  /* Desk interests: two cards side by side, an accent edge and a quiet Coming soon. */
  .ps-structs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
  .ps-struct {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 150px;
    padding: 16px 14px 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
  }
  a.ps-struct:active { background: var(--surface-elevated); }
  a.ps-struct:focus-visible { outline: none; box-shadow: var(--focus-ring); }
  .ps-struct-icon { width: 36px; height: 36px; margin-bottom: 6px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
  .ps-struct-icon svg { width: 18px; height: 18px; }
  .ps-struct-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
  .ps-struct-note { font-size: 14px; line-height: 1.35; color: var(--text-muted); }
  .ps-soon { margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--text-dim); }
  .ps-ask { font-size: 14px; font-weight: 600; color: var(--accent); }
  /* Contact: two slim buttons, no card. */
  .ps-contact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
  .ps-contact-btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border-radius: 23px; border: 1px solid var(--border-strong); color: var(--text); font: 600 15px/1 var(--font-sans); text-decoration: none; }
  .ps-contact-btn svg { width: 18px; height: 18px; color: var(--accent); }
  .ps-contact-wa svg { color: #25D366; }
  .ps-contact-btn:active { background: var(--surface-tint-2); }
  .ps-contact-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
  .ps-foot { margin: 16px 0 8px; font-size: 11px; line-height: 1.45; color: var(--text-dim); }
  .ps-primary {
    min-height: 50px;
    border-radius: 12px;
    border: 0;
    background: var(--cta);
    color: #04191B;
    font: 600 16px/1 var(--font-sans);
    cursor: pointer;
  }
  .ps-primary:disabled { background: var(--surface-elevated); color: var(--text-dim); cursor: default; }

  /* Edit, add and first-login screens: full-screen layers over the app. */
  body.ps-layer-open { overflow: hidden; }
  .ps-layer { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; background: var(--bg-primary); color: var(--text); font-family: var(--font-sans); }
  .ps-layer-panel { display: flex; flex-direction: column; width: 100%; height: 100%; padding-top: env(safe-area-inset-top, 0px); }
  .ps-layer-head { flex: none; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 6px 0 16px; border-bottom: 1px solid var(--border-subtle); }
  .ps-layer-head h2 { margin: 0; font: 600 17px/1.2 var(--font-sans); }
  .ps-layer-head .ps-text-btn:first-child { margin-left: -10px; }
  .ps-layer-head h2:not(:first-child) { margin: 0 auto; }
  .ps-head-spacer { width: 70px; }
  .ps-text-btn { min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--accent); font: 600 15px/1 var(--font-sans); cursor: pointer; }
  .ps-done { margin-left: auto; }
  .ps-layer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 16px; }
  .ps-layer-foot { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 12px 16px max(16px, calc(env(safe-area-inset-bottom, 0px) + 8px)); border-top: 1px solid var(--border-subtle); background: var(--bg-card); }
  .ps-hint { margin: 12px 0; font-size: 13px; line-height: 1.4; color: var(--text-muted); }
  .ps-edit-count { margin: 0; font-size: 14px; font-weight: 600; }
  .ps-reset { display: block; width: 100%; margin-top: 20px; color: var(--accent); font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
  .ps-saved-note { margin: 4px 0 0; font-size: 12px; text-align: center; color: var(--text-dim); }
  .ps-error { margin: 6px 0 0; font-size: 13px; color: var(--negative); }
  .ps-error[hidden] { display: none; }

  .ps-seg { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 12px 16px; padding: 4px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); }
  .ps-seg button { height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); font: 600 14px/1 var(--font-sans); cursor: pointer; }
  .ps-seg button[aria-checked="true"] { background: var(--surface-elevated); color: var(--text); }
  .ps-grid { display: grid; grid-template-columns: 84px repeat(4, minmax(0, 1fr)); gap: 6px; align-items: center; margin-bottom: 6px; }
  .ps-grid-head { position: sticky; top: 0; z-index: 1; padding: 4px 0 8px; background: var(--bg-primary); font-size: 12px; font-weight: 700; letter-spacing: var(--track-normal); }
  .ps-grid-head > span { display: flex; align-items: center; justify-content: center; gap: 5px; }
  .ps-grid-tenor { font-size: 14px; font-weight: 600; }
  .ps-cell { height: 44px; border-radius: 10px; border: 1px solid var(--border-light); background: transparent; color: var(--accent); font: 700 14px/1 var(--font-sans); cursor: pointer; }
  .ps-cell--none { border-style: dashed; border-color: var(--border-subtle); opacity: .5; cursor: default; }
  .ps-cell--on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }

  .ps-setup { padding-top: 28px; }
  .ps-setup-title { margin: 0 0 8px; font: 700 28px/1.15 var(--font-sans); letter-spacing: -0.02em; outline: none; }
  .ps-setup-lede { margin: 0 0 28px; font-size: 15px; line-height: 1.45; color: var(--text-muted); }
  .ps-setup h3 { margin: 0 0 10px; font: 600 13px/1.3 var(--font-sans); }
  .ps-choices { display: grid; gap: 8px; margin-bottom: 24px; }
  .ps-choices-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ps-choices-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ps-choices-1 { grid-template-columns: 1fr; }
  .ps-choice { min-height: 48px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border-light); background: transparent; color: var(--text); font: 600 15px/1.2 var(--font-sans); cursor: pointer; }
  /* "How far out?" is one choice of three: radio rings, as the design drew them, plus a note. */
  .ps-choices-1 .ps-choice { display: flex; align-items: center; gap: 12px; min-height: 56px; text-align: left; }
  .ps-choices-1 .ps-choice::before { content: ''; flex: none; width: 20px; height: 20px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--border-strong); }
  .ps-choices-1 .ps-choice--on::before { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--bg-primary); }
  .ps-choices-1 .ps-choice--on { color: var(--text); }
  .ps-choice-text { display: flex; flex-direction: column; gap: 2px; }
  .ps-choice-note { font-size: 12px; font-weight: 400; color: var(--text-muted); }
  .ps-setup-logo { display: block; height: 18px; width: auto; margin-bottom: 28px; }
  .ps-choice--on { border-color: var(--accent); background: var(--accent-muted); color: var(--accent); }
  .ps-skip { color: var(--text-muted); }
  .ps-layer button:focus-visible, .ps button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
}

@media (prefers-reduced-motion: reduce) {
  .ps-flash { animation: none; }
}
