:root {
      --bg-base: #080b11;
      --bg-card: rgba(18, 24, 38, 0.75);
      --bg-card-hover: rgba(26, 35, 56, 0.85);
      --bg-surface: #101624;
      --border: rgba(212, 175, 55, 0.25);
      --border-subtle: rgba(255, 255, 255, 0.08);
      --gold: #d4af37;
      --gold-light: #f3e5ab;
      --gold-dim: rgba(212, 175, 55, 0.15);
      --emerald: #10b981;
      --emerald-dim: rgba(16, 185, 129, 0.15);
      --amber: #f59e0b;
      --amber-dim: rgba(245, 158, 11, 0.15);
      --ruby: #f43f5e;
      --ruby-dim: rgba(244, 63, 94, 0.15);
      --text: #f1f5f9;
      --text-muted: #94a3b8;
      --text-faint: #64748b;
      --radius-sm: 8px;
      --radius-md: 14px;
      --radius-lg: 20px;
      --shadow-glow: 0 0 25px rgba(212, 175, 55, 0.15);
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      -webkit-tap-highlight-color: transparent;
      font-family: 'Outfit', sans-serif;
    }

    body {
      background-color: var(--bg-base);
      color: var(--text);
      min-height: 100vh;
      overflow-x: hidden;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding-bottom: 95px;
    }

    /* Ambient Gold Glow */
    .bg-glow {
      position: fixed;
      top: -150px;
      left: 50%;
      transform: translateX(-50%);
      width: 500px;
      height: 500px;
      background: radial-gradient(circle, rgba(212, 175, 55, 0.09) 0%, transparent 70%);
      filter: blur(60px);
      pointer-events: none;
      z-index: 0;
    }

    /* Main Container (Mobile First, Responsive Desktop) */
    .app-container {
      width: 100%;
      max-width: 480px;
      padding: env(safe-area-inset-top, 20px) 16px 20px;
      position: relative;
      z-index: 1;
      transition: max-width 0.3s ease;
    }

    /* Desktop Responsive Layout */
    @media (min-width: 880px) {
      .app-container {
        max-width: 1060px;
        padding: 30px 24px 60px;
      }
      .desktop-grid {
        display: grid;
        grid-template-columns: 1.15fr 0.85fr;
        gap: 20px;
        align-items: start;
      }
      .tab-bar {
        max-width: 540px;
        border-radius: 24px;
        bottom: 20px;
        border: 1px solid var(--border);
        box-shadow: 0 12px 36px rgba(0,0,0,0.6);
      }
    }

    /* Header Bar */
    .header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 18px;
      padding: 4px 0;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .brand-icon {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      background: linear-gradient(135deg, #d4af37, #996515);
      display: flex;
      align-items: center;
      justify-content: center;
      color: #080b11;
      font-weight: 700;
      font-size: 18px;
      box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    }

    .brand-title {
      font-family: 'Cinzel', serif;
      font-size: 20px;
      font-weight: 700;
      letter-spacing: 2px;
      color: var(--gold-light);
    }

    .header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .action-icon-btn {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      color: var(--text-muted);
      width: 38px;
      height: 38px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 15px;
      transition: all 0.2s;
    }
    .action-icon-btn:hover { color: var(--gold); border-color: var(--gold); }

    /* Glass Cards */
    .card {
      background: var(--bg-card);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-lg);
      padding: 18px;
      margin-bottom: 16px;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
      transition: transform 0.2s, border-color 0.2s;
    }

    .card.gold-trim {
      border: 1px solid var(--border);
      box-shadow: var(--shadow-glow);
    }

    /* Phase & Week Header */
    .phase-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 12px;
      background: var(--gold-dim);
      border: 1px solid var(--border);
      color: var(--gold-light);
      border-radius: 20px;
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.8px;
      text-transform: uppercase;
      margin-bottom: 10px;
    }

    .week-nav {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
    }

    .week-title {
      font-size: 22px;
      font-weight: 700;
      color: var(--text);
    }

    .week-controls {
      display: flex;
      gap: 8px;
    }

    .nav-btn {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      color: var(--text);
      width: 34px;
      height: 34px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 16px;
      font-weight: bold;
      transition: all 0.2s;
    }
    .nav-btn:hover { background: var(--gold-dim); border-color: var(--gold); color: var(--gold-light); }

    .progress-bar-container {
      width: 100%;
      height: 6px;
      background: rgba(255, 255, 255, 0.06);
      border-radius: 10px;
      overflow: hidden;
      margin-bottom: 8px;
    }

    .progress-fill {
      height: 100%;
      background: linear-gradient(90deg, #d4af37, #f59e0b);
      border-radius: 10px;
      transition: width 0.3s ease;
    }

    .progress-label {
      display: flex;
      justify-content: space-between;
      font-size: 11px;
      color: var(--text-faint);
    }

    /* Today's Focus Card */
    .section-title {
      font-size: 12px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 1.2px;
      color: var(--gold);
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .today-banner {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
    }

    .today-date {
      font-size: 12px;
      color: var(--text-muted);
    }

    .today-action-box {
      background: rgba(0, 0, 0, 0.3);
      border-radius: var(--radius-md);
      padding: 14px;
      border-left: 3px solid var(--gold);
      margin-bottom: 12px;
    }

    .today-action-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--gold-light);
      margin-bottom: 4px;
    }

    .today-action-desc {
      font-size: 13px;
      color: var(--text-muted);
      line-height: 1.45;
    }

    /* Daily Checklist */
    .checklist {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 10px;
    }

    .check-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 14px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      cursor: pointer;
      user-select: none;
      transition: all 0.2s;
    }

    .check-item.done {
      background: rgba(16, 185, 129, 0.08);
      border-color: rgba(16, 185, 129, 0.3);
    }

    .checkbox {
      width: 20px;
      height: 20px;
      border-radius: 6px;
      border: 1.5px solid var(--text-faint);
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
      flex-shrink: 0;
    }

    .check-item.done .checkbox {
      background: var(--emerald);
      border-color: var(--emerald);
      color: #080b11;
      font-weight: bold;
      font-size: 13px;
    }

    .check-text {
      font-size: 13px;
      color: var(--text);
      display: flex;
      flex-direction: column;
    }

    .check-time {
      font-size: 11px;
      color: var(--gold);
      font-weight: 600;
    }

    /* Sunday Audit Traffic Light Box */
    .audit-box {
      border: 1px solid rgba(245, 158, 11, 0.3);
      background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, rgba(18, 24, 38, 0.8) 100%);
    }

    .traffic-selector {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 8px;
      margin: 12px 0;
    }

    .traffic-btn {
      padding: 10px 8px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border-subtle);
      background: rgba(0, 0, 0, 0.25);
      color: var(--text-muted);
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      font-size: 11px;
      font-weight: 600;
      transition: all 0.2s;
    }

    .traffic-btn .dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
    }

    .traffic-btn.green .dot { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
    .traffic-btn.yellow .dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
    .traffic-btn.red .dot { background: var(--ruby); box-shadow: 0 0 8px var(--ruby); }

    .traffic-btn.selected.green { background: var(--emerald-dim); border-color: var(--emerald); color: var(--emerald); }
    .traffic-btn.selected.yellow { background: var(--amber-dim); border-color: var(--amber); color: var(--amber); }
    .traffic-btn.selected.red { background: var(--ruby-dim); border-color: var(--ruby); color: var(--ruby); }

    .audit-guidance {
      font-size: 12px;
      line-height: 1.4;
      color: var(--text-muted);
      background: rgba(0, 0, 0, 0.3);
      padding: 10px;
      border-radius: 8px;
      margin-bottom: 12px;
    }

    .btn-action {
      width: 100%;
      padding: 12px;
      border-radius: var(--radius-sm);
      border: none;
      background: linear-gradient(135deg, #d4af37, #b8860b);
      color: #080b11;
      font-weight: 700;
      font-size: 14px;
      letter-spacing: 0.5px;
      cursor: pointer;
      box-shadow: 0 4px 14px rgba(212, 175, 55, 0.25);
      transition: transform 0.1s, filter 0.2s;
    }
    .btn-action:active { transform: scale(0.98); }

    /* Notes Log */
    .notes-input {
      width: 100%;
      height: 70px;
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      color: var(--text);
      padding: 10px;
      font-size: 13px;
      resize: none;
      outline: none;
      margin-bottom: 8px;
    }
    .notes-input:focus { border-color: var(--gold); }

    .notes-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-height: 180px;
      overflow-y: auto;
      margin-top: 10px;
    }

    .note-card {
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid var(--border-subtle);
      border-radius: 8px;
      padding: 8px 10px;
      font-size: 12px;
    }

    .note-header {
      display: flex;
      justify-content: space-between;
      color: var(--gold);
      font-size: 10px;
      font-weight: 600;
      margin-bottom: 3px;
    }

    .note-body {
      color: var(--text-muted);
      line-height: 1.35;
    }

    /* Tabs Bar at Bottom */
    .tab-bar {
      position: fixed;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 100%;
      max-width: 480px;
      background: rgba(10, 13, 20, 0.95);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-top: 1px solid var(--border-subtle);
      display: flex;
      justify-content: space-around;
      padding: 8px 10px env(safe-area-inset-bottom, 12px);
      z-index: 10;
    }

    .tab-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      color: var(--text-faint);
      font-size: 10px;
      font-weight: 600;
      cursor: pointer;
      text-decoration: none;
      padding: 4px 8px;
      border-radius: 8px;
      transition: all 0.2s;
    }

    .tab-item.active {
      color: var(--gold);
      background: var(--gold-dim);
    }

    .tab-icon {
      font-size: 18px;
    }

    /* TACTICAL BRIEFING & GUIDANCE DRAWER */
    .guidance-box {
      margin-top: 14px;
      background: rgba(0, 0, 0, 0.4);
      border-radius: var(--radius-md);
      border: 1px solid var(--border);
      padding: 14px;
    }

    .guidance-pills {
      display: flex;
      gap: 6px;
      overflow-x: auto;
      padding-bottom: 8px;
      margin-bottom: 12px;
      scrollbar-width: none;
    }
    .guidance-pills::-webkit-scrollbar { display: none; }

    .pill-btn {
      padding: 6px 12px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      border-radius: 20px;
      color: var(--text-muted);
      font-size: 11px;
      font-weight: 600;
      white-space: nowrap;
      cursor: pointer;
      transition: all 0.2s;
    }
    .pill-btn.active {
      background: var(--gold-dim);
      border-color: var(--gold);
      color: var(--gold-light);
    }

    .guidance-content {
      font-size: 13px;
      line-height: 1.5;
      color: var(--text);
      min-height: 120px;
    }

    .guidance-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding-left: 4px;
    }

    .guidance-step {
      display: flex;
      gap: 10px;
      background: rgba(255, 255, 255, 0.02);
      padding: 8px 10px;
      border-radius: 8px;
      border-left: 2px solid var(--gold);
    }

    .step-num {
      color: var(--gold);
      font-weight: 700;
      font-size: 12px;
    }

    .script-item {
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid var(--border-subtle);
      border-radius: 8px;
      padding: 10px;
      margin-bottom: 8px;
    }
    .script-trigger {
      font-size: 11px;
      font-weight: 600;
      color: var(--gold);
      margin-bottom: 4px;
      text-transform: uppercase;
    }
    .script-text {
      font-style: italic;
      color: var(--gold-light);
      margin-bottom: 4px;
    }
    .script-note {
      font-size: 11px;
      color: var(--text-faint);
    }

    .biofeedback-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
    }
    .bio-card {
      padding: 10px;
      border-radius: 8px;
      font-size: 12px;
      line-height: 1.4;
    }
    .bio-card.green {
      background: rgba(16, 185, 129, 0.08);
      border: 1px solid rgba(16, 185, 129, 0.3);
    }
    .bio-card.red {
      background: rgba(244, 63, 94, 0.08);
      border: 1px solid rgba(244, 63, 94, 0.3);
    }

    /* HOUSEHOLD CHORES & REPEATING SCHEDULE STYLES */
    .chore-day-selector {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 6px;
      margin-bottom: 14px;
    }
    @media (max-width: 520px) {
      .chore-day-selector {
        display: flex;
        overflow-x: auto;
        padding-bottom: 6px;
        scrollbar-width: none;
      }
      .chore-day-selector::-webkit-scrollbar { display: none; }
      .day-pill {
        min-width: 56px;
        flex: 1;
      }
    }

    .day-pill {
      padding: 8px 4px;
      text-align: center;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      cursor: pointer;
      transition: all 0.2s ease;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
    }
    .day-pill:hover {
      background: rgba(255, 255, 255, 0.07);
      border-color: rgba(212, 175, 55, 0.3);
    }
    .day-pill.active {
      background: var(--gold-dim);
      border-color: var(--gold);
      box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
    }
    .day-pill.is-today {
      border-top: 2px solid var(--emerald);
    }
    .day-abbr {
      font-size: 11px;
      font-weight: 700;
      color: var(--gold-light);
      text-transform: uppercase;
    }
    .day-pill.is-today .day-abbr {
      color: var(--emerald);
    }
    .day-icon {
      font-size: 15px;
    }
    .day-badge-today {
      font-size: 8px;
      background: var(--emerald-dim);
      color: var(--emerald);
      padding: 1px 4px;
      border-radius: 4px;
      font-weight: 700;
      text-transform: uppercase;
    }

    .role-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      padding: 3px 8px;
      border-radius: 12px;
      letter-spacing: 0.5px;
    }
    .role-husband {
      background: rgba(212, 175, 55, 0.15);
      color: var(--gold);
      border: 1px solid rgba(212, 175, 55, 0.3);
    }
    .role-wife {
      background: rgba(244, 63, 94, 0.15);
      color: #fda4af;
      border: 1px solid rgba(244, 63, 94, 0.3);
    }
    .role-joint {
      background: rgba(16, 185, 129, 0.15);
      color: #6ee7b7;
      border: 1px solid rgba(16, 185, 129, 0.3);
    }

    .chore-task-item {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 12px;
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      margin-bottom: 8px;
      transition: all 0.2s ease;
      cursor: pointer;
      user-select: none;
    }
    .chore-task-item:hover {
      background: rgba(255, 255, 255, 0.05);
      border-color: rgba(212, 175, 55, 0.25);
    }
    .chore-task-item.completed {
      background: rgba(16, 185, 129, 0.05);
      border-color: rgba(16, 185, 129, 0.3);
    }
    .chore-task-item.completed .chore-title-text {
      text-decoration: line-through;
      color: var(--text-faint);
    }
    .chore-checkbox {
      width: 22px;
      height: 22px;
      min-width: 22px;
      border-radius: 6px;
      border: 1.5px solid var(--text-faint);
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 1px;
      font-size: 13px;
      color: transparent;
      transition: all 0.2s ease;
    }
    .chore-task-item.completed .chore-checkbox {
      background: var(--emerald);
      border-color: var(--emerald);
      color: #080b11;
      font-weight: 800;
    }
    .chore-info {
      flex: 1;
    }
    .chore-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      line-height: 1.35;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .chore-subtext {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 3px;
      line-height: 1.4;
    }
    .chore-lead-tag {
      font-size: 10px;
      color: var(--gold);
      font-weight: 600;
    }

    .invariant-pill-btn {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 12px;
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      margin-bottom: 8px;
      cursor: pointer;
      transition: all 0.2s ease;
      user-select: none;
    }
    .invariant-pill-btn:hover {
      background: rgba(255, 255, 255, 0.05);
      border-color: rgba(212, 175, 55, 0.25);
    }
    .invariant-pill-btn.completed {
      background: rgba(16, 185, 129, 0.06);
      border-color: rgba(16, 185, 129, 0.35);
    }
    .invariant-pill-btn.completed .inv-title {
      text-decoration: line-through;
      color: var(--text-faint);
    }
    .invariant-pill-btn.completed .chore-checkbox {
      background: var(--emerald);
      border-color: var(--emerald);
      color: #080b11;
      font-weight: 800;
    }

    /* SENSORY BATTERY RADAR */
    .radar-container {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin: 10px 0;
    }
    .radar-btn {
      padding: 10px 6px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border-subtle);
      background: rgba(255, 255, 255, 0.03);
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      transition: all 0.2s ease;
      user-select: none;
    }
    .radar-btn:hover {
      background: rgba(255, 255, 255, 0.07);
    }
    .radar-btn.active.green {
      background: rgba(16, 185, 129, 0.18);
      border-color: var(--emerald);
      box-shadow: 0 0 14px rgba(16, 185, 129, 0.25);
    }
    .radar-btn.active.yellow {
      background: rgba(245, 158, 11, 0.18);
      border-color: var(--amber);
      box-shadow: 0 0 14px rgba(245, 158, 11, 0.25);
    }
    .radar-btn.active.red {
      background: rgba(244, 63, 94, 0.2);
      border-color: var(--ruby);
      box-shadow: 0 0 16px rgba(244, 63, 94, 0.35);
      animation: pulseAlert 2s infinite ease-in-out;
    }
    @keyframes pulseAlert {
      0%, 100% { border-color: var(--ruby); }
      50% { border-color: rgba(244, 63, 94, 0.5); }
    }
    .radar-title {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .radar-desc {
      font-size: 9px;
      color: var(--text-muted);
      text-align: center;
      line-height: 1.2;
    }

    /* DECIDE & DECLARE BOX */
    .provisions-input {
      width: 100%;
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 10px 12px;
      color: var(--text);
      font-size: 13px;
      margin-bottom: 8px;
      outline: none;
      transition: border-color 0.2s;
    }
    .provisions-input:focus {
      border-color: var(--gold);
    }
    .greeting-preview-box {
      background: rgba(212, 175, 55, 0.05);
      border-left: 2px solid var(--gold);
      border-radius: 6px;
      padding: 10px 12px;
      font-size: 12px;
      color: var(--text-muted);
      line-height: 1.45;
      margin-bottom: 10px;
    }

    /* UPGRADED SUNDAY AUDIT SLIDERS */
    .audit-dimension {
      margin-bottom: 12px;
      padding: 8px 10px;
      background: rgba(255, 255, 255, 0.02);
      border-radius: var(--radius-sm);
      border: 1px solid var(--border-subtle);
    }
    .audit-dim-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 6px;
    }
    .rating-buttons {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 4px;
    }
    .rating-btn {
      padding: 6px 2px;
      font-size: 11px;
      font-weight: 700;
      text-align: center;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid var(--border-subtle);
      border-radius: 6px;
      color: var(--text-muted);
      cursor: pointer;
      transition: all 0.15s;
    }
    .rating-btn:hover {
      background: rgba(255, 255, 255, 0.08);
    }
    .rating-btn.active {
      background: var(--gold-dim);
      border-color: var(--gold);
      color: var(--gold-light);
      box-shadow: 0 0 8px rgba(212, 175, 55, 0.25);
    }

    /* RESTORATIVE ACCOUNTABILITY LEDGER */
    .accountability-item {
      padding: 10px 12px;
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      margin-bottom: 8px;
      font-size: 12px;
    }
    .accountability-item.active-item {
      border-left: 3px solid var(--amber);
    }
    .accountability-item.restored-item {
      border-left: 3px solid var(--emerald);
      opacity: 0.85;
    }
    .accountability-tag {
      font-size: 9px;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 4px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .tag-active {
      background: var(--amber-dim);
      color: var(--amber);
      border: 1px solid rgba(245, 158, 11, 0.3);
    }
    .tag-restored {
      background: var(--emerald-dim);
      color: var(--emerald);
      border: 1px solid rgba(16, 185, 129, 0.3);
    }

    /* POCKET SOUNDBOARD SCRIPT TILES */
    .soundboard-tile {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      padding: 12px;
      margin-bottom: 10px;
      transition: all 0.2s ease;
      cursor: pointer;
    }
    .soundboard-tile:hover {
      background: rgba(255, 255, 255, 0.06);
      border-color: rgba(212, 175, 55, 0.3);
    }
    .soundboard-category {
      font-size: 10px;
      font-weight: 700;
      color: var(--gold);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 4px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .soundboard-text {
      font-size: 13px;
      font-style: italic;
      color: var(--gold-light);
      line-height: 1.4;
      margin-bottom: 6px;
    }
    .soundboard-note {
      font-size: 11px;
      color: var(--text-faint);
      line-height: 1.35;
    }

    /* PIN & SOVEREIGN GATE OVERLAYS */
    .pin-overlay {
      position: fixed;
      inset: 0;
      background: #080b11;
      z-index: 9999;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }

    .pin-title {
      font-family: 'Cinzel', serif;
      font-size: 24px;
      color: var(--gold-light);
      margin-bottom: 6px;
      letter-spacing: 2px;
    }

    .pin-subtitle {
      font-size: 13px;
      color: var(--text-muted);
      margin-bottom: 24px;
      text-align: center;
    }

    .pin-dots {
      display: flex;
      gap: 16px;
      margin-bottom: 28px;
    }

    .pin-dot {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      border: 1.5px solid var(--gold);
      transition: all 0.2s;
    }

    .pin-dot.filled {
      background: var(--gold);
      box-shadow: 0 0 10px var(--gold);
    }

    .keypad {
      display: grid;
      grid-template-columns: repeat(3, 72px);
      gap: 16px;
    }

    .key-btn {
      width: 72px;
      height: 72px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      color: var(--text);
      font-size: 24px;
      font-weight: 600;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.15s;
    }
    .key-btn:active {
      background: var(--gold-dim);
      border-color: var(--gold);
      transform: scale(0.92);
    }

    /* Modal Sheet */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.78);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      z-index: 500;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    .modal-content {
      background: var(--bg-surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 24px;
      width: 100%;
      max-width: 520px;
      box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
      max-height: 85vh;
      overflow-y: auto;
    }

    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
    }

    .modal-title {
      font-family: 'Cinzel', serif;
      font-size: 18px;
      font-weight: 700;
      color: var(--gold-light);
    }

    .modal-close {
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 20px;
      cursor: pointer;
    }

    .sync-box {
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      padding: 14px;
      margin-bottom: 14px;
    }

    .sync-input {
      width: 100%;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      border-radius: 6px;
      padding: 8px 10px;
      color: var(--gold-light);
      font-size: 12px;
      font-family: monospace;
      outline: none;
      margin: 6px 0 10px;
    }

    .status-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 2px 8px;
      border-radius: 12px;
      font-size: 10px;
      font-weight: 600;
    }
    .status-badge.active { background: var(--emerald-dim); color: var(--emerald); border: 1px solid var(--emerald); }
    .status-badge.inactive { background: rgba(255,255,255,0.05); color: var(--text-faint); }

    .hidden { display: none !important; }

    @keyframes shake {
      0%, 100% { transform: translateX(0); }
      25% { transform: translateX(-6px); }
      75% { transform: translateX(6px); }
    }
    .shake {
      animation: shake 0.3s ease;
      border-color: var(--ruby) !important;
    }
