
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --ocean-deep: #0a1628;
      --ocean-mid: #0d2240;
      --kelp: #2dd4bf;
      --sunset: #f97316;
      --coral: #fb7185;
      --salt: #ffffff;
      --text-dim: rgba(255,255,255,0.55);
      --text-mid: rgba(255,255,255,0.8);
      --border: rgba(45,212,191,0.2);
    }

    html, body {
      background: #060c18;
      color: var(--salt);
      font-family: 'DM Sans', sans-serif;
      min-height: 100vh;
    }

    body {
      padding: 0;
      overflow-x: hidden;
    }

    @media (max-width: 640px) {
      body { padding: 0; }
    }

    /* ── THE APP RECTANGLE ── */
    .app {
      max-width: 100%;
      width: 100%;
      margin: 0;
      background: var(--ocean-deep);
      border-radius: 0;
      overflow: visible;
      box-shadow: none;
      border: none;
      border-top: 1px solid rgba(255,255,255,0.05);
    }

    /* ── USER BAR ── */
    #user-bar {
      display: none;
      flex-direction: column;
      gap: 10px;
      padding: 12px 20px;
      background: rgba(9,20,40,0.95);
      border-bottom: 1px solid rgba(45,212,191,0.15);
      font-size: 14px;
    }
    .ub-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .ub-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
    .ub-idtext { min-width: 0; }
    .ub-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
    .ub-pills > * { margin-top: 0 !important; }
    .ub-pills:empty { display: none; }

    /* ── HEADER / PIER IMAGE ── */
    header {
      width: 100%;
      text-align: center;
      padding: 30px 20px 26px;
      position: relative;
      overflow: hidden;
      background: #000810;
      isolation: isolate;
    }

    header::before {
      content: '';
      position: absolute;
      inset: 0;
      background:
        linear-gradient(180deg, rgba(0,8,16,0.55) 0%, rgba(0,8,16,0.55) 100%),
        url('/wave-bg.jpg') center 65% / cover no-repeat;
      opacity: 0.35;
      z-index: 1;
    }

    .logo-img {
      display: block;
      width: 100%;
      max-width: 520px;
      height: auto;
      margin: 0 auto;
      position: relative;
      z-index: 2;
      mix-blend-mode: screen;
      filter: brightness(2.2) contrast(1.1);
    }

    .logo {
      font-family: 'Unbounded', sans-serif;
      font-size: 52px;
      font-weight: 900;
      letter-spacing: -2px;
      background: linear-gradient(135deg, var(--kelp) 0%, #67e8f9 50%, var(--salt) 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      line-height: 1;
      margin-bottom: 8px;
      position: relative;
      z-index: 2;
      /* Reserve height so Unbounded font swap doesn't cause CLS */
      min-height: 52px;
    }

    .tagline {
      font-size: 14px;
      color: rgba(255,255,255,0.7);
      letter-spacing: 3px;
      text-transform: uppercase;
      font-weight: 300;
      position: relative;
      z-index: 2;
      /* Reserve height to prevent CLS on font swap */
      min-height: 18px;
    }

    /* ── NAV TABS ── */
    .nav-tabs {
      display: flex;
      background: var(--ocean-mid);
      border-bottom: 1px solid var(--border);
      padding: 4px 32px;
      gap: 4px;
      justify-content: center;
      position: sticky;
      top: 0;
      z-index: 100;
      box-shadow: 0 4px 20px rgba(0,0,0,0.3);
      min-height: 60px;
      overflow-x: auto;
      scrollbar-width: none;
    }

    .nav-tab {
      padding: 12px 20px;
      border: none;
      border-radius: 10px;
      background: transparent;
      color: var(--text-dim);
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
      white-space: nowrap;
    }

    .nav-tab.active {
      background: var(--kelp);
      color: var(--ocean-deep);
      font-weight: 600;
    }

    .nav-tab.nav-has-unread {
      color: white !important;
      background: #fb7185 !important;
      font-weight: 600;
      transition: none !important;
      animation: msg-pulse 1.4s ease-in-out infinite;
    }

    @keyframes msg-pulse {
      0%, 100% { background: #fb7185; opacity: 1; }
      50%       { background: #f43f5e; opacity: 0.85; }
    }

    .nav-tab.locked {
      opacity: 0.5;
      cursor: pointer;
      position: relative;
    }

    .nav-tab.locked::after {
      content: '🔒';
      font-size: 10px;
      margin-left: 4px;
      vertical-align: middle;
    }

    .nav-tab:hover:not(.active) {
      color: var(--salt);
      background: rgba(255,255,255,0.08);
    }

    /* ── Bottom tab bar (primary nav) ── */
    #bottomnav{position:fixed;left:0;right:0;bottom:0;z-index:300;display:flex;background:rgba(10,22,40,0.97);backdrop-filter:blur(12px);border-top:1px solid var(--border);padding-bottom:env(safe-area-inset-bottom,0px)}
    #bottomnav .bnav-item{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;padding:8px 2px 7px;text-decoration:none;color:var(--text-dim);font-family:'DM Sans',sans-serif;font-size:11px;font-weight:600;line-height:1;transition:color .15s;min-width:0}
    #bottomnav .bnav-ico{font-size:20px;line-height:1}
    #bottomnav .bnav-item.active{color:var(--kelp)}
    #bottomnav .bnav-item:hover{color:var(--kelp)}
    #bottomnav .bnav-item.nav-has-unread{color:#fb7185}
    body{padding-bottom:64px}

    /* ── CONTENT ── */
    .content-wrap {
      padding: 28px 40px 80px;
      max-width: 1400px;
      margin: 0 auto;
    }

    /* ── PANELS ── */
    .panel { display: none; }
    .panel.active { display: block; animation: fadeIn 0.3s ease; }
    .modal-wave-bg {
      position: relative;
      overflow: hidden;
    }
    .modal-wave-bg-overlay {
      position: absolute;
      inset: 0;
      background-size: cover;
      background-position: center 65%;
      background-repeat: no-repeat;
      opacity: 0.07;
      border-radius: inherit;
      pointer-events: none;
      z-index: 0;
    }
    .modal-wave-bg > * {
      position: relative;
      z-index: 1;
    }

    /* ── FORM SECTIONS (cards) ── */
    .form-section {
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 16px;
      padding: 22px;
      margin-bottom: 14px;
    }

    .section-label {
      font-size: 11px;
      letter-spacing: 3px;
      text-transform: uppercase;
      color: var(--kelp);
      margin-bottom: 16px;
      font-weight: 600;
    }

    .form-grid { display: grid; gap: 12px; margin-bottom: 12px; }
    .form-grid.two { grid-template-columns: 1fr 1fr; }
    .form-grid.three { grid-template-columns: 1fr 1fr 1fr; }

    .field { margin-bottom: 12px; }
    .field label {
      display: block;
      font-size: 11px;
      letter-spacing: 2px;
      text-transform: uppercase;
      color: var(--text-dim);
      margin-bottom: 6px;
    }

    .field input, .field select, .field textarea {
      width: 100%;
      background: rgba(255,255,255,0.06);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 10px;
      padding: 12px 14px;
      color: var(--salt);
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      outline: none;
      transition: border-color 0.2s;
    }

    .field input:focus, .field select:focus, .field textarea:focus {
      border-color: rgba(45,212,191,0.5);
    }

    .field textarea { resize: vertical; min-height: 80px; }

    /* ── CHIPS ── */
    .chip-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

    .chip {
      padding: 8px 16px;
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 100px;
      background: transparent;
      color: rgba(255,255,255,0.55);
      font-family: 'DM Sans', sans-serif;
      font-size: 13px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .chip.active, .chip.multi.active {
      background: rgba(45,212,191,0.15);
      border-color: var(--kelp);
      color: var(--kelp);
    }

    .intent-chip {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      width: 100%;
      text-align: left;
      border-radius: 12px;
      padding: 11px 14px;
      line-height: 1.45;
      white-space: normal;
    }
    .intent-chip .intent-emoji { font-size: 16px; flex-shrink: 0; line-height: 1.4; }
    .intent-chip .intent-text { flex: 1; }
    .intent-chip strong { color: rgba(255,255,255,0.92); font-weight: 700; }
    .intent-chip.active strong { color: var(--kelp); }

    /* ── RATING SLIDERS ── */
    .rating-row {
      display: grid;
      grid-template-columns: 140px 1fr 32px;
      align-items: center;
      gap: 10px;
      margin-bottom: 80px;
    }
    .rating-row .slider-wrap {
      min-width: 0;
      width: 100%;
    }
    .rating-row .shred-slider {
      width: 100%;
      min-width: 0;
    }

    .rating-label {
      font-size: 15px;
      font-weight: 500;
      color: rgba(255,255,255,0.75);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .shred-slider {
      flex: 1;
      accent-color: var(--kelp);
      height: 4px;
    }

    .rating-value {
      font-size: 14px;
      font-weight: 700;
      color: var(--kelp);
      min-width: 20px;
      text-align: right;
    }

    /* ── PEER RATING ROWS ── */
    .rating-row-peer {
      display: grid;
      grid-template-columns: 140px 1fr 28px;
      align-items: center;
      gap: 10px;
      margin-bottom: 80px;
    }

    .rating-slider { width: 100%; min-width: 0; accent-color: var(--kelp); touch-action: pan-y; }
    .shred-slider { flex: 1; accent-color: var(--kelp); height: 4px; touch-action: pan-y; }

    /* ── MANEUVER CHIPS ── */
    .maneuver-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 7px 12px;
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 100px;
      font-size: 13px;
      color: rgba(255,255,255,0.6);
      cursor: pointer;
      transition: all 0.15s;
      user-select: none;
    }

    .maneuver-chip:has(input:checked) {
      background: rgba(45,212,191,0.12);
      border-color: var(--kelp);
      color: var(--kelp);
    }

    .maneuver-chip input { accent-color: var(--kelp); width: 14px; height: 14px; }

    /* ── VIDEO UPLOAD ── */
    .video-drop-zone {
      border: 2px dashed rgba(45,212,191,0.3);
      border-radius: 14px;
      padding: 32px 20px;
      text-align: center;
      cursor: pointer;
      transition: all 0.2s;
      margin-bottom: 16px;
    }

    .video-drop-zone:hover { border-color: var(--kelp); background: rgba(45,212,191,0.04); }
    .video-drop-icon { font-size: 36px; margin-bottom: 12px; }
    .video-drop-zone h4 { font-size: 16px; margin-bottom: 6px; }

    .btn-upload {
      background: rgba(45,212,191,0.1);
      border: 1px solid rgba(45,212,191,0.3);
      border-radius: 10px;
      padding: 10px 20px;
      color: var(--kelp);
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      cursor: pointer;
      margin-top: 8px;
    }

    .video-thumbs {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      margin-top: 12px;
    }

    .video-thumb {
      position: relative;
      border-radius: 10px;
      overflow: hidden;
      aspect-ratio: 16/9;
      background: rgba(0,0,0,0.4);
      border: 1px solid rgba(255,255,255,0.1);
      min-height: 120px;
    }

    .video-thumb video {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .video-remove {
      position: absolute;
      top: 4px;
      right: 4px;
      background: rgba(0,0,0,0.7);
      border: none;
      border-radius: 50%;
      width: 22px;
      height: 22px;
      color: white;
      font-size: 12px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .video-name {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      background: rgba(0,0,0,0.7);
      font-size: 10px;
      padding: 3px 6px;
      color: rgba(255,255,255,0.7);
      text-align: center;
    }

    /* ── ANALYZE BUTTON ── */
    .btn-analyze {
      width: 100%;
      padding: 16px;
      background: linear-gradient(135deg, var(--kelp) 0%, #0891b2 100%);
      border: none;
      border-radius: 14px;
      color: var(--ocean-deep);
      font-family: 'Unbounded', sans-serif;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      margin: 8px 0 16px;
      letter-spacing: 1px;
      transition: opacity 0.2s;
    }

    .btn-analyze:hover { opacity: 0.9; }
    .btn-analyze:disabled { opacity: 0.5; cursor: not-allowed; }

    /* ── RESULT CARD ── */
    .result-card {
      background: linear-gradient(135deg, rgba(13,34,64,0.9) 0%, rgba(15,52,96,0.5) 100%);
      border: 1px solid var(--kelp);
      border-radius: 24px;
      padding: 36px;
      margin-top: 20px;
    }

    .board-name {
      font-family: 'Unbounded', sans-serif;
      font-size: 22px;
      font-weight: 900;
      color: var(--salt);
      margin-bottom: 4px;
    }

    .board-subtitle {
      font-size: 11px;
      letter-spacing: 3px;
      text-transform: uppercase;
      color: var(--kelp);
      margin-bottom: 24px;
    }

    .dim-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 10px;
      margin-bottom: 20px;
    }

    .dim-card {
      background: rgba(255,255,255,0.05);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 12px;
      padding: 14px;
      text-align: center;
    }

    .dim-value {
      font-size: 22px;
      font-weight: 700;
      color: var(--kelp);
    }

    .dim-label {
      font-size: 10px;
      letter-spacing: 2px;
      text-transform: uppercase;
      color: var(--text-dim);
      margin-top: 4px;
    }

    /* ── RESULT ACTION BUTTONS ── */
    .result-action-btn {
      padding: 10px 18px;
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 10px;
      background: transparent;
      color: rgba(255,255,255,0.6);
      font-family: 'DM Sans', sans-serif;
      font-size: 13px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .result-action-btn.teal {
      background: rgba(45,212,191,0.12);
      border-color: rgba(45,212,191,0.35);
      color: var(--kelp);
    }

    .result-action-btn.danger {
      background: rgba(251,113,133,0.08);
      border-color: rgba(251,113,133,0.25);
      color: var(--coral);
    }
    .result-action-btn.subtle {
      background: rgba(255,255,255,0.06);
      border-color: rgba(255,255,255,0.15);
      color: rgba(255,255,255,0.7);
    }
    .result-action-btn.subtle:hover {
      background: rgba(45,212,191,0.1);
      border-color: rgba(45,212,191,0.3);
      color: var(--kelp);
    }

    /* ── SHRED METER ── */
    .shred-meter {
      background: rgba(45,212,191,0.06);
      border: 1px solid rgba(45,212,191,0.2);
      border-radius: 20px;
      padding: 24px;
      margin-top: 20px;
      text-align: center;
    }

    .shred-meter-label {
      font-size: 11px;
      letter-spacing: 3px;
      text-transform: uppercase;
      color: var(--text-dim);
      margin-bottom: 8px;
    }

    .shred-meter-score {
      font-family: 'Unbounded', sans-serif;
      font-size: 64px;
      font-weight: 900;
      color: var(--sunset);
      line-height: 1;
    }

    .shred-bar-wrap {
      height: 6px;
      background: rgba(255,255,255,0.08);
      border-radius: 100px;
      margin: 12px 0;
      overflow: hidden;
    }

    .shred-bar-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--sunset), #fbbf24);
      border-radius: 100px;
      transition: width 0.8s ease;
    }

    .shred-breakdown {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin-top: 16px;
    }

    .shred-item {
      background: rgba(255,255,255,0.04);
      border-radius: 10px;
      padding: 10px 6px;
      text-align: center;
    }

    .shred-item-val {
      font-size: 20px;
      font-weight: 700;
      color: var(--sunset);
    }

    .shred-item-label {
      font-size: 9px;
      letter-spacing: 1px;
      text-transform: uppercase;
      color: rgba(255,255,255,0.35);
      margin-top: 2px;
    }

    /* ── PROGRESSION / HISTORY ── */
    .progression-tabs {
      display: flex;
      gap: 4px;
      background: rgba(255,255,255,0.04);
      border-radius: 10px;
      padding: 4px;
      margin-bottom: 20px;
    }

    #ptab-timeline, #ptab-consensus, #ptab-archive {
      flex: 1;
      padding: 10px;
      border: none;
      border-radius: 8px;
      background: transparent;
      color: var(--text-dim);
      font-family: 'DM Sans', sans-serif;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
    }

    #ptab-timeline.ptab-active, #ptab-consensus.ptab-active, #ptab-archive.ptab-active {
      background: var(--kelp);
      color: var(--ocean-deep);
      font-weight: 600;
    }

    /* ── BOARDSLIST WAVE ANALYSIS ── */
    .wave-analysis-box, .rationale-box, .consensus-key-box {
      border-left: 2px solid var(--kelp);
      padding: 12px 16px;
      margin: 12px 0;
      font-size: 14px;
      color: var(--text-mid);
      line-height: 1.7;
      background: rgba(45,212,191,0.05);
      border-radius: 0 10px 10px 0;
    }

    .wave-analysis-label, .rationale-label, .consensus-key-label {
      font-size: 10px;
      letter-spacing: 2px;
      text-transform: uppercase;
      color: var(--kelp);
      margin-bottom: 6px;
    }

    /* ── INSIGHT BOXES ── */
    .insight-box {
      border-left: 2px solid var(--sunset);
      padding: 12px 16px;
      margin: 12px 0;
      font-size: 14px;
      color: var(--text-mid);
      line-height: 1.7;
      background: rgba(249,115,22,0.05);
      border-radius: 0 10px 10px 0;
    }

    .insight-label {
      font-size: 10px;
      letter-spacing: 2px;
      text-transform: uppercase;
      color: var(--sunset);
      margin-bottom: 6px;
    }

    /* ── PEER REVIEW CARD ── */
    .peer-review-card {
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 14px;
      padding: 18px;
      margin-bottom: 12px;
    }

    /* ── CONSENSUS ── */
    #consensus-board-name {
      font-family: 'Unbounded', sans-serif;
      font-size: 22px;
      font-weight: 900;
    }

    .dims-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      margin: 16px 0;
    }

    /* ── SPOT DROPDOWN ── */
    #spot-dropdown {
      display: none;
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      background: #0d2240;
      border: 1px solid rgba(45,212,191,0.3);
      border-radius: 12px;
      margin-top: 4px;
      max-height: 220px;
      overflow-y: auto;
      z-index: 200;
      box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    }

    /* ── PILL BADGES ── */
    .pill {
      display: inline-block;
      padding: 3px 10px;
      border-radius: 100px;
      font-size: 11px;
      font-weight: 600;
      border: 1px solid;
    }

    .pill-green { background: rgba(45,212,191,0.1); color: var(--kelp); border-color: rgba(45,212,191,0.3); }
    .pill-orange { background: rgba(249,115,22,0.1); color: var(--sunset); border-color: rgba(249,115,22,0.3); }

    /* ── MOBILE ── */
    @media (max-width: 768px) {
      body { padding: 0; }
      .app { border-radius: 0 !important; box-shadow: none !important; border: none !important; }

      /* Nav — horizontal row on mobile, full width tabs */
      /* ── NAV TABS: 2×2 grid on mobile ── */
      .nav-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px;
        padding: 6px;
        position: static;
        overflow: visible;
        min-height: auto;
      }
      .nav-tabs::-webkit-scrollbar { display: none; }
      #nav-magic { grid-column: 1 / -1; }
      .nav-tab {
        font-size: 12px;
        padding: 11px 8px;
        border-radius: 10px;
        text-align: center;
        white-space: normal;
        word-break: break-word;
        flex: unset;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
      }
      .nav-tab.active { border-radius: 10px; }

      /* Content */
      .content-wrap { padding: 12px 12px 80px; overflow-x: hidden; box-sizing: border-box; width: 100%; }
      .form-section { padding: 14px 12px; overflow-x: hidden; box-sizing: border-box; width: 100%; }
      .result-card { padding: 16px 14px; overflow-x: hidden; box-sizing: border-box; width: 100%; }

      /* ALL panels prevent overflow */
      .panel { overflow-x: hidden; box-sizing: border-box; width: 100%; }

      /* Profile summary stat grid — 2 cols on mobile */
      .profile-stat-grid { grid-template-columns: repeat(2, 1fr) !important; }

      /* Dim grid — 2 cols on mobile */
      .dim-grid { grid-template-columns: repeat(2, 1fr); }
      .shred-breakdown { grid-template-columns: repeat(2, 1fr); }

      /* Form grids — single col */
      .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }

      /* Rating rows */
      .rating-row { flex-wrap: wrap; gap: 6px; }
      .rating-label { min-width: 0; width: 100%; font-size: 12px; }
      .shred-slider { width: 100%; }

      /* All flex rows wrap safely */
      div[style*="display:flex"]][style*="gap:8px"],
      div[style*="display:flex"][style*="gap:10px"] { flex-wrap: wrap !important; }

      /* Result action buttons — equal width, wrap on mobile */
      .result-action-btn {
        flex: 1 1 calc(50% - 6px);
        text-align: center;
        min-width: 0;
        font-size: 12px;
        padding: 9px 8px;
        word-break: break-word;
        box-sizing: border-box;
      }

      /* Peer review card — stack vertically */
      .peer-review-card > div[style*="display:flex"] { flex-wrap: wrap !important; }

      /* Delete button in peer card — don't overflow */
      button[onclick*="deleteReview"] { flex-shrink: 0; }

      /* Timeline history buttons — stack on mobile */
      div[style*="loadAssessmentFromHistory"] { flex-wrap: wrap !important; }

      /* Chips — wrap and shrink properly */
      .chip-group { gap: 6px; flex-wrap: wrap; }
      .chip { font-size: 12px; padding: 7px 12px; }
      .maneuver-chip { font-size: 12px; }

      /* Logo */
      .logo { font-size: 28px; letter-spacing: -1px; min-height: 34px; }
      .logo-img { max-width: 380px; }
      header { padding: 22px 16px 20px; }

      /* ── VIDEO & PHOTO UPLOAD CARDS ── */
      /* 2-col grid for media cards — each cell gets equal width */
      .video-thumbs {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
      }
      /* The inline media grids (renderSelfResult, peer view) — target via class */
      .media-grid-2col {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }

      /* Upload add-buttons: fill their grid cell, consistent min-height */
      .upload-add-btn {
        width: 100% !important;
        min-height: 110px !important;
        padding: 10px 6px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }
      .upload-add-btn span:last-child {
        font-size: 9px !important;
        line-height: 1.3 !important;
      }

      /* Constrain all 2-col inline-style grids inside result cards */
      .result-card div[style*="grid-template-columns:repeat(2"] {
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }
      .result-card div[style*="grid-template-columns:repeat(2"] > * {
        min-width: 0 !important;
        overflow: hidden !important;
      }

      /* Media info/instruction box — tighten padding on mobile */
      .media-info-box {
        padding: 12px 14px !important;
        font-size: 12px !important;
        line-height: 1.6 !important;
      }

      /* Board name — smaller on mobile */
      .board-name { font-size: 18px; }

      /* Dim value — slightly smaller */
      .dim-value { font-size: 18px; }

      /* Three-option vol cards — stack on very narrow */
      /* (they use inline flex; force wrap) */
      div[style*="display:flex"][style*="gap:8px"] > div[style*="flex:1"] {
        min-width: 80px;
      }

      /* Modal inner cards — don't exceed viewport */
      .modal {
        max-height: 92vh;
        margin: 0;
        border-radius: 16px;
        padding: 20px 16px;
      }

      /* Auth screen card — full width with padding */
      #auth-screen > div {
        padding: 24px 20px !important;
        border-radius: 16px !important;
      }

      /* User bar — wrap on narrow */
      #user-bar { gap: 8px; padding: 10px 14px; font-size: 12px; }

      /* Section label text — no overflow */
      .section-label { word-break: break-word; }

      /* Board spec boxes inside result card — no overflow */
      .result-card div[style*="word-break"] { max-width: 100%; overflow-wrap: break-word; }

      /* Ensure any inline-style grid with 2 cols stays contained */
      div[style*="grid-template-columns:repeat(2"] {
        max-width: 100%;
        box-sizing: border-box;
      }
      div[style*="grid-template-columns:repeat(3"] {
        max-width: 100%;
        box-sizing: border-box;
      }
      div[style*="grid-template-columns:repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 100%;
        box-sizing: border-box;
      }

      /* Prevent any wide inline flex from punching out */
      div[style*="display:inline-flex"] {
        max-width: 100%;
        flex-wrap: wrap;
        box-sizing: border-box;
      }

      /* Profile stat mini-boxes — ensure equal sizing */
      div[style*="profile-stat-grid"] > div {
        min-width: 0;
        overflow: hidden;
      }

      /* Rating badges — no overflow */
      div[style*="display:inline-flex"][style*="border-radius:100px"] {
        max-width: 100%;
        flex-wrap: wrap;
        word-break: break-word;
      }

      /* Textarea / input fields — full width */
      textarea, input[type="text"], input[type="email"], input[type="password"], select {
        width: 100%;
        box-sizing: border-box;
        max-width: 100%;
      }

      /* Peer board select dropdowns — stack on mobile */
      div[style*="display:flex"][style*="flex-wrap:wrap"] select {
        min-width: 0;
        flex: 1 1 100%;
      }
    }

    /* ── EXTRA SMALL (360px phones) ── */
    @media (max-width: 400px) {
      .content-wrap { padding: 10px 10px 80px; }
      .form-section { padding: 12px 10px; }
      .result-card { padding: 14px 12px; }
      .logo { font-size: 24px; }
      .logo-img { max-width: 280px; }
      .nav-tab { font-size: 11px; padding: 9px 6px; }
      .chip { font-size: 11px; padding: 6px 10px; }
      .board-name { font-size: 16px; }
      .dim-value { font-size: 16px; }
      .result-action-btn { font-size: 11px; padding: 8px 6px; }

      /* Video/photo cards — keep 2 cols but reduce gap */
      .video-thumbs { gap: 6px; }
      div[style*="grid-template-columns:repeat(2"] { gap: 6px !important; }

      /* Upload buttons even more compact */
      .upload-add-btn { min-height: 90px !important; }
    }
  
    /* ── MODALS ── */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.85);
      z-index: 400;
      align-items: center;
      justify-content: center;
      padding: 16px;
      backdrop-filter: blur(10px);
    }
    .modal-overlay.open { display: flex; }
    .modal {
      background: #0d2240;
      border: 1px solid rgba(45,212,191,0.25);
      border-radius: 22px;
      width: 100%;
      max-width: 520px;
      max-height: 90vh;
      overflow-y: auto;
      padding: 28px;
      position: relative;
    }
    .modal h3 { font-family: 'Unbounded', sans-serif; font-size: 17px; color: var(--kelp); margin-bottom: 8px; }
    .modal-close {
      position: absolute; top: 14px; right: 16px;
      background: transparent; border: none;
      color: rgba(255,255,255,0.4); font-size: 22px; cursor: pointer;
    }
    /* Auth overlay */
    #auth-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: var(--ocean-deep);
      z-index: 300;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }
    /* Profile modal */
    #profile-modal {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.8);
      z-index: 400;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(8px);
    }

    /* Share modal email tags */
    .email-tags { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; min-height:0; }
    .email-tag { display:flex; align-items:center; gap:6px; background:rgba(45,212,191,0.15); border:1px solid rgba(45,212,191,0.3); border-radius:100px; padding:4px 10px; font-size:12px; color:var(--kelp); }
    .email-tag button { background:none; border:none; color:var(--kelp); cursor:pointer; font-size:14px; line-height:1; padding:0; }
    .modal-btn { width:100%; padding:13px; border:none; border-radius:10px; font-family:'DM Sans',sans-serif; font-size:14px; font-weight:600; cursor:pointer; margin-bottom:8px; }
    .modal-btn.primary { background:linear-gradient(135deg,var(--kelp),#0891b2); color:#0a1628; }
    .modal-btn.secondary { background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); color:rgba(255,255,255,0.6); }

    /* ── PEER PAGE: bubble shows BELOW slider to avoid pin conflict ── */
    #panel-peer .slider-bubble {
      bottom: auto !important;
      top: calc(100% + 8px) !important;
    }
    #panel-peer .slider-bubble::after {
      top: auto !important;
      bottom: 100% !important;
      border-top-color: transparent !important;
      border-bottom-color: rgba(45,212,191,0.3) !important;
    }
    #panel-peer .slider-bubble::before {
      top: auto !important;
      bottom: calc(100% - 1px) !important;
      border-top-color: transparent !important;
      border-bottom-color: #0d2240 !important;
    }

    /* ── SELF RATING PIN ON PEER SLIDERS ── */
    .slider-wrap {
      position: relative;
    }
    .self-rating-pin {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      pointer-events: none;
      z-index: 5;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
    }
    .self-rating-pin-avatar {
      width: auto;
      min-width: 22px;
      height: 22px;
      border-radius: 11px;
      border: 2px solid rgba(45,212,191,0.8);
      background: #0d2240;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 8px;
      font-weight: 800;
      color: #2dd4bf;
      overflow: hidden;
      box-shadow: 0 2px 8px rgba(0,0,0,0.4);
      padding: 0 4px;
      white-space: nowrap;
    }
    .self-rating-pin-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .self-rating-pin-line {
      width: 2px;
      height: 8px;
      background: rgba(45,212,191,0.6);
    }
    .self-rating-pin-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: #2dd4bf;
    }

    /* ── SLIDER BUBBLE TOOLTIP ── */
    .slider-wrap {
      position: relative;
      flex: 1;
    }
    .slider-wrap {
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 0;
      min-width: 0;
      width: 100%;
    }
    .slider-bubble {
      position: absolute;
      bottom: calc(100% + 8px);
      left: 50%;
      transform: translateX(-50%);
      background: #0d2240;
      border: 1px solid rgba(45,212,191,0.3);
      border-radius: 10px;
      padding: 8px 14px;
      font-size: 12px;
      color: rgba(255,255,255,0.85);
      line-height: 1.5;
      white-space: normal;
      width: 420px;
      max-width: 88vw;
      pointer-events: none;
      z-index: 100;
      box-shadow: 0 4px 20px rgba(0,0,0,0.4);
      opacity: 0;
      transition: opacity 0.15s ease;
      overflow: visible;
    }
    .slider-bubble.visible {
      opacity: 1;
    }
    .slider-bubble::after {
      content: '';
      position: absolute;
      top: 100%;
      left: var(--arrow-left, 50%);
      transform: translateX(-50%);
      border: 6px solid transparent;
      border-top-color: rgba(45,212,191,0.3);
    }
    .slider-bubble::before {
      content: '';
      position: absolute;
      top: calc(100% - 1px);
      left: var(--arrow-left, 50%);
      transform: translateX(-50%);
      border: 6px solid transparent;
      border-top-color: #0d2240;
      z-index: 1;
    }

    @media (max-width: 600px) {
      /* Pin stays visible on mobile */
      .self-rating-pin {
        display: flex !important;
      }

      /* Bubble: switch from absolute floating to static inline below slider */
      .slider-bubble {
        position: static !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        left: auto !important;
        bottom: auto !important;
        margin-top: 8px;
        border-radius: 10px;
        opacity: 0;
        height: 0;
        overflow: hidden;
        padding: 0;
        border: none;
        transition: opacity 0.15s ease, height 0.15s ease, padding 0.15s ease;
        box-shadow: none;
        pointer-events: none;
      }
      .slider-bubble.visible {
        opacity: 1 !important;
        height: auto;
        padding: 10px 12px;
        border: 1px solid rgba(45,212,191,0.25) !important;
      }
      .slider-bubble::after,
      .slider-bubble::before {
        display: none !important;
      }

      /* Rating rows: stack vertically, compact card */
      .rating-row, .rating-row-peer {
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin-bottom: 18px !important;
        background: rgba(255,255,255,0.03);
        border: 1px solid rgba(255,255,255,0.06);
        border-radius: 12px;
        padding: 12px 14px;
      }
      .rating-label {
        font-size: 13px;
        font-weight: 600;
        color: rgba(255,255,255,0.8);
        white-space: normal;
        width: auto;
        flex: 1;
      }
      .slider-wrap {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0;
      }
      .rating-slider, .shred-slider {
        width: 100%;
        height: 6px;
      }
      .rating-val, .rating-value {
        font-size: 18px;
        font-weight: 900;
        color: var(--kelp);
        min-width: 28px;
        text-align: right;
        font-family: 'Unbounded', sans-serif;
      }
      .mobile-rating-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 8px;
      }
    }

    /* ── FORM LOCK AFTER ANALYSIS ── */
    .form-locked .field input,
    .form-locked .field select,
    .form-locked .field textarea {
      background: rgba(255,255,255,0.03) !important;
      border-color: rgba(255,255,255,0.06) !important;
      color: rgba(255,255,255,0.4) !important;
      cursor: not-allowed !important;
      pointer-events: none;
    }
    .form-locked .chip {
      opacity: 0.4;
      pointer-events: none;
      cursor: not-allowed;
    }
    .form-locked .shred-slider {
      opacity: 0.4;
      pointer-events: none;
      cursor: not-allowed;
    }
    .form-locked .maneuver-chip {
      opacity: 0.4;
      pointer-events: none;
    }
    .form-locked .video-drop-zone {
      opacity: 0.4;
      pointer-events: none;
    }
    .form-locked #analyze-btn {
      opacity: 0.4;
      pointer-events: none;
      cursor: not-allowed;
    }
    /* Summary = read-only: hide media add/remove controls but keep thumbnails viewable */
    .form-locked .upload-add-btn,
    .form-locked .media-remove-btn {
      display: none !important;
    }
    .form-lock-banner {
      display: flex;
      align-items: center;
      gap: 10px;
      background: rgba(45,212,191,0.06);
      border: 1px solid rgba(45,212,191,0.18);
      border-radius: 10px;
      padding: 10px 16px;
      margin-bottom: 14px;
      font-size: 12px;
      color: rgba(255,255,255,0.5);
    }
    .form-lock-banner span { color: var(--kelp); font-weight: 600; }

    /* Dimension grid in result card — always 2x2 on mobile */
    @media (max-width: 600px) {
      div[style*="minmax(70px"] {
        grid-template-columns: repeat(2, 1fr) !important;
      }
    }
    /* Rating rows on mobile — label above, slider + number side by side */
    @media (max-width: 500px) {
      .rating-row, .rating-row-peer {
        grid-template-columns: 1fr 28px;
        grid-template-rows: auto auto;
        row-gap: 4px;
      }
      .rating-row .rating-label,
      .rating-row-peer .rating-label {
        grid-column: 1 / -1;
        font-size: 12px;
        font-weight: 500;
        color: rgba(255,255,255,0.6);
      }
      .rating-row .rating-slider,
      .rating-row-peer .rating-slider {
        grid-column: 1;
      }
      .rating-row .rating-val,
      .rating-row .rating-value,
      .rating-row-peer .rating-val {
        grid-column: 2;
        text-align: center;
      }
    }
    /* ── NEW REVIEW NOTIFICATION ── */
    .notif-dot {
      position: absolute;
      top: -3px;
      right: -3px;
      width: 12px;
      height: 12px;
      background: #fb7185;
      border-radius: 50%;
      border: 2px solid #060c18;
      animation: pulse-dot 2s ease-in-out infinite;
      z-index: 10;
    }
    /* ── FAQ FOOTER ── */
    .faq-item { border-bottom: 1px solid rgba(255,255,255,0.07); }
    .faq-q { display:flex; align-items:center; justify-content:space-between; padding:14px 0; cursor:pointer; gap:12px; }
    .faq-q-text { font-size:14px; font-weight:600; color:rgba(255,255,255,0.8); line-height:1.4; flex:1; transition:color .15s; }
    .faq-chev { font-size:11px; color:rgba(255,255,255,0.3); transition:transform .2s; flex-shrink:0; }
    .faq-a { display:none; padding:0 0 14px; font-size:13px; color:rgba(255,255,255,0.5); line-height:1.75; }
    .faq-item.open .faq-a { display:block; }
    .faq-item.open .faq-chev { transform:rotate(180deg); }
    .faq-item.open .faq-q-text { color:#2dd4bf; }

    @keyframes pulse-dot {
      0%, 100% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.3); opacity: 0.7; }
    }
    .nav-tab-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: #fb7185;
      color: white;
      font-size: 10px;
      font-weight: 700;
      border-radius: 100px;
      padding: 1px 6px;
      margin-left: 6px;
      min-width: 18px;
      line-height: 1.4;
      animation: pulse-dot 2s ease-in-out infinite;
    }
    #user-avatar { position: relative; }
    @keyframes bob {
      0%, 100% { transform: translateY(0) rotate(-5deg); }
      50% { transform: translateY(-12px) rotate(5deg); }
    }
    @keyframes dot-bounce {
      0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
      40% { transform: translateY(-8px); opacity: 1; }
    }
    /* Windows fix: native select dropdowns need explicit option colors */
    select { background-color: #0d2240; color: #ffffff; }
    select option { background-color: #0d2240 !important; color: #ffffff !important; }
    select option:checked { background-color: #1e3a5f !important; color: #2dd4bf !important; }
