/**
 * JemcoTech Gamepad Tester - Layout & UI Styles
 */

html { height: 100%; }
    body { min-height: 100vh; display: flex; flex-direction: column; }
    .test-hero { padding: 85px 2rem 1.5rem; background: var(--deep); text-align: center; flex-shrink: 0; }
    .test-hero h1 { font-family: var(--font-display); font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 900; margin: 0; }
    .test-hero h1 span { color: var(--orange); }
    .test-hero p { color: var(--muted); margin: 0.3rem 0 0; font-size: 0.85rem; }
    .test-hero .back-link { display: inline-block; margin-bottom: 0.3rem; color: var(--orange); text-decoration: none; font-size: 0.8rem; }

    .test-section { flex: 1 0 auto; display: flex; background: var(--black); padding: 1.5rem 2rem 3rem; }
    .test-container { width: 100%; max-width: 1400px; margin: 0 auto; }
    .test-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1.5rem; align-items: start; }

    .instructions-panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; }
    .instructions-panel h3 { font-family: var(--font-display); font-size: 0.85rem; color: var(--steel); margin-bottom: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
    .instructions-panel ul { list-style: none; padding: 0; margin: 0; }
    .instructions-panel li { color: var(--muted); font-size: 0.82rem; padding: 0.35rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; align-items: center; gap: 0.5rem; }
    .instructions-panel li::before { content: "•"; color: var(--orange); }
    .instructions-panel li strong { color: var(--white); }
    .drift-link { color: var(--orange); cursor: pointer; text-decoration: underline; }

    .status-box { margin-top: 1rem; padding: 0.8rem; background: var(--deep); border-radius: 8px; text-align: center; border: 1px solid var(--border); }
    .status-box p { font-family: var(--font-display); font-size: 0.78rem; color: var(--steel); margin: 0; }

    .controller-toolbar { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 0.8rem; margin-bottom: 0.8rem; flex-wrap: wrap; z-index: 10; }
    .controller-selector-bar { display: flex; align-items: center; gap: 0.5rem; background: rgba(15, 23, 42, 0.85); border: 1px solid rgba(255, 140, 0, 0.4); border-radius: 8px; padding: 0.35rem 0.65rem; margin-right: auto; }
    .selector-label { font-family: var(--font-display); font-size: 0.72rem; color: #94a3b8; font-weight: 700; display: flex; align-items: center; gap: 0.35rem; text-transform: uppercase; letter-spacing: 0.5px; }
    .selector-buttons { display: flex; gap: 0.35rem; align-items: center; }
    .ctrl-tab-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; min-width: 30px; height: 28px; padding: 0 0.55rem; background: #1e293b; border: 1px solid #334155; color: #f1f5f9; border-radius: 6px; font-family: var(--font-display); font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: all 0.12s ease; }
    .ctrl-tab-btn:hover { background: #334155; border-color: #ff8c00; color: #ff8c00; }
    .ctrl-tab-btn.active { background: linear-gradient(135deg, #ea580c, #f97316); border-color: #fb923c; color: #ffffff; box-shadow: 0 0 10px rgba(234, 88, 12, 0.5); }
    .ctrl-tab-btn.input-pulse { border-color: #38bdf8 !important; color: #38bdf8 !important; background: rgba(56, 189, 248, 0.22) !important; box-shadow: 0 0 15px rgba(56, 189, 248, 0.85), inset 0 0 8px rgba(56, 189, 248, 0.4) !important; transform: scale(1.08); }
    .ctrl-tab-pulse-dot { display: none; width: 6px; height: 6px; border-radius: 50%; background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
    .ctrl-tab-btn.input-pulse .ctrl-tab-pulse-dot { display: inline-block; animation: pulseSparkle 0.4s infinite alternate; }
    @keyframes pulseSparkle { 0% { transform: scale(0.8); opacity: 0.6; } 100% { transform: scale(1.4); opacity: 1; } }

    .fs-brand-header {
      display: none;
      align-items: center;
      gap: 0.85rem;
      user-select: none;
    }
    :fullscreen .fs-brand-header,
    :-webkit-full-screen .fs-brand-header {
      display: flex;
      position: absolute;
      top: 1.2rem;
      left: 50%;
      transform: translateX(-50%);
      z-index: 25;
      background: rgba(13, 13, 18, 0.85);
      border: 1px solid rgba(255, 255, 255, 0.12);
      padding: 0.55rem 1.25rem;
      border-radius: 26px;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
    .fs-brand-logo {
      width: 34px;
      height: 34px;
      object-fit: contain;
      filter: drop-shadow(0 0 10px rgba(255, 140, 0, 0.6));
    }
    .fs-brand-title {
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 1.35rem;
      letter-spacing: 1.2px;
      color: #ffffff;
      text-transform: uppercase;
    }
    .fs-brand-title span {
      color: var(--orange);
    }

    .toolbar-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
    .toolbar-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; background: #1e293b; border: 1px solid #475569; color: #f8fafc; padding: 0; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; user-select: none; }
    .toolbar-icon-btn:hover { background: #334155; border-color: #ff8c00; color: #ff8c00; }
    .toolbar-icon-btn.dark-active { background: #f8fafc; color: #0f172a; border-color: #cbd5e1; box-shadow: 0 0 12px rgba(255, 255, 255, 0.25); }
    .toolbar-icon-btn.fs-active { border-color: #38bdf8; color: #38bdf8; box-shadow: 0 0 10px rgba(56, 189, 248, 0.4); }
    .toolbar-icon-btn .theme-icon { width: 18px; height: 18px; display: block; }

    .test-layout:fullscreen,
    .test-layout:-webkit-full-screen {
      background: #08080a;
      padding: 1.5rem;
      width: 100vw;
      height: 100vh;
      box-sizing: border-box;
      overflow-y: auto;
    }
    :fullscreen .controller-wrapper,
    :-webkit-full-screen .controller-wrapper {
      min-height: calc(100vh - 3rem);
    }

    :fullscreen .stick-axis-card,
    :-webkit-full-screen .stick-axis-card {
      width: 200px;
      padding: 0.8rem 0.9rem;
      border-radius: 12px;
    }
    :fullscreen .stick-axis-card h4,
    :-webkit-full-screen .stick-axis-card h4 {
      font-size: 0.82rem;
      margin-bottom: 0.45rem;
    }
    :fullscreen .stick-canvas-container,
    :-webkit-full-screen .stick-canvas-container {
      width: 168px;
      height: 168px;
      margin-bottom: 0.55rem;
    }
    :fullscreen .deadzone-ring,
    :-webkit-full-screen .deadzone-ring {
      width: 44px;
      height: 44px;
    }
    :fullscreen .stick-dot,
    :-webkit-full-screen .stick-dot {
      width: 15px;
      height: 15px;
    }
    :fullscreen .stick-value,
    :-webkit-full-screen .stick-value {
      padding: 0.32rem 0.4rem;
    }
    :fullscreen .stick-value span,
    :-webkit-full-screen .stick-value span {
      font-size: 0.68rem;
    }
    :fullscreen .stick-value strong,
    :-webkit-full-screen .stick-value strong {
      font-size: 0.82rem;
    }
    :fullscreen .ps5-container, :-webkit-full-screen .ps5-container,
    :fullscreen .ps4-container, :-webkit-full-screen .ps4-container,
    :fullscreen .ps3-container, :-webkit-full-screen .ps3-container,
    :fullscreen .xbox-container, :-webkit-full-screen .xbox-container,
    :fullscreen .xsx-container, :-webkit-full-screen .xsx-container,
    :fullscreen .xbox-series-container, :-webkit-full-screen .xbox-series-container,
    :fullscreen .xbox360-container, :-webkit-full-screen .xbox360-container,
    :fullscreen .xbox-360-container, :-webkit-full-screen .xbox-360-container,
    :fullscreen .switch-pro-container, :-webkit-full-screen .switch-pro-container,
    :fullscreen .switch-container, :-webkit-full-screen .switch-container,
    :fullscreen .nes-container, :-webkit-full-screen .nes-container,
    :fullscreen .gc-container, :-webkit-full-screen .gc-container,
    :fullscreen .fpp-container, :-webkit-full-screen .fpp-container {
      max-width: 680px;
    }

    .navbar, .navbar.update, .navbar.message, .navbar.ty, #thanks, .message, 
    .plshalpme, .update-message, .helptip, .slideout-menu { display: none !important; opacity: 0 !important; pointer-events: none !important; visibility: hidden !important; animation: none !important; transform: none !important; }

    .button-checklist { margin-top: 1rem; padding: 0.8rem; background: var(--deep); border-radius: 8px; border: 1px solid var(--border); }
    .button-checklist h4 { font-family: var(--font-display); font-size: 0.78rem; color: var(--steel); margin: 0 0 0.4rem; text-transform: uppercase; letter-spacing: 0.5px; }
    .button-checklist p { font-size: 0.72rem; color: var(--muted); margin: 0 0 0.6rem; }
    .button-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.35rem; }
    .button-check { aspect-ratio: 1; border-radius: 6px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.03); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; transition: all 0.12s ease; cursor: default; user-select: none; }
    .button-check .button-label { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
    .button-check .button-symbol { display: inline-block; line-height: 1; font-weight: 700; }
    .button-check .button-symbol.circle { width: 11px; height: 11px; border: 2px solid currentColor; border-radius: 50%; box-sizing: border-box; }
    .button-check .button-symbol.square { width: 10px; height: 10px; border: 2px solid currentColor; border-radius: 1px; box-sizing: border-box; }
    .button-check .button-symbol.triangle { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid currentColor; }
    .button-check .button-symbol.arrow-up { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid currentColor; }
    .button-check .button-symbol.arrow-down { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid currentColor; }
    .button-check .button-symbol.arrow-left { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 8px solid currentColor; }
    .button-check .button-symbol.arrow-right { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid currentColor; }
    .button-check .button-symbol.text { font-size: 0.65rem; letter-spacing: -0.3px; }
    .button-check.done { border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.12); color: #86efac; }
    .button-check.active { border-color: #ff8c00; background: rgba(255, 140, 0, 0.3); color: #ffffff; box-shadow: 0 0 10px rgba(255, 140, 0, 0.6); transform: scale(1.06); }
    .reset-checks { margin-top: 0.6rem; width: 100%; border: 1px solid rgba(255,255,255,0.12); background: transparent; color: var(--muted); font-size: 0.72rem; padding: 0.35rem 0.5rem; border-radius: 6px; cursor: pointer; transition: all 0.15s ease; font-family: var(--font-display); }
    .reset-checks:hover { color: var(--white); border-color: var(--orange); }

    .results-mini { margin-top: 1rem; padding: 0.8rem; background: var(--deep); border-radius: 8px; border: 1px solid var(--border); }
    .results-mini h4 { font-family: var(--font-display); font-size: 0.78rem; color: var(--steel); margin: 0 0 0.5rem; text-transform: uppercase; letter-spacing: 0.5px; }
    .result-row { display: flex; justify-content: space-between; align-items: center; padding: 0.3rem 0; font-size: 0.78rem; border-bottom: 1px solid rgba(255,255,255,0.03); }
    .result-row span:first-child { color: var(--muted); }
    .result-row .status { font-weight: 600; font-size: 0.75rem; }
    .result-row .status.ok { color: #22c55e; }
    .result-row .status.issue { color: #ef4444; }

    .extra-tests { margin-top: 1rem; padding: 0.8rem; background: var(--deep); border-radius: 8px; border: 1px solid var(--border); }
    .extra-tests h4 { font-family: var(--font-display); font-size: 0.78rem; color: var(--steel); margin: 0 0 0.5rem; text-transform: uppercase; letter-spacing: 0.5px; }
    .test-toggle { display: flex; justify-content: space-between; align-items: center; padding: 0.35rem 0; font-size: 0.78rem; color: var(--muted); border-bottom: 1px solid rgba(255,255,255,0.03); }
    .test-toggle input[type="checkbox"] { appearance: none; width: 34px; height: 18px; background: #333; border-radius: 10px; position: relative; cursor: pointer; outline: none; transition: background 0.2s; }
    .test-toggle input[type="checkbox"]:checked { background: var(--orange); }
    .test-toggle input[type="checkbox"]::before { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: transform 0.2s; }
    .test-toggle input[type="checkbox"]:checked::before { transform: translateX(16px); }
    .test-toggle label { cursor: pointer; }

    .touchpad-info { display: none; margin-top: 0.8rem; padding: 0.6rem; background: rgba(255,255,255,0.03); border-radius: 6px; border: 1px solid rgba(255,255,255,0.05); }
    .touchpad-info.visible { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
    .touchpad-info .axis-box { background: rgba(0,0,0,0.3); padding: 0.4rem; border-radius: 4px; text-align: center; }
    .touchpad-info .axis-box h5 { font-size: 0.65rem; color: var(--muted); margin: 0; text-transform: uppercase; }
    .touchpad-info .axis-box p { font-family: var(--font-display); font-size: 0.75rem; color: var(--steel); margin: 0.2rem 0 0; }

    .touchpad-panel { display: none; margin-top: 0.8rem; padding: 0.8rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
    .touchpad-panel.visible { display: block; }
    .touchpad-surface { position: relative; width: 100%; height: 90px; border-radius: 8px; border: 1px dashed rgba(255,255,255,0.2); background: rgba(255,255,255,0.02); overflow: hidden; margin-bottom: 0.6rem; }
    .touchpad-dot { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #38bdf8; box-shadow: 0 0 10px rgba(56, 189, 248, 0.8); transform: translate(-50%, -50%); pointer-events: none; display: none; }
    .touchpad-dot.active { background: #22c55e; box-shadow: 0 0 12px rgba(34, 197, 94, 0.9); }
    .hid-touch-button { width: 100%; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.04); color: var(--steel); border-radius: 6px; padding: 0.45rem 0.6rem; font-family: var(--font-display); font-size: 0.72rem; cursor: pointer; }
    .hid-touch-status { font-size: 0.68rem; color: var(--muted); margin: 0.4rem 0 0; }
    .touchpad-note { font-size: 0.68rem; color: var(--muted); margin: 0.35rem 0 0; line-height: 1.35; }

    .controller-info-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 9999; justify-content: center; align-items: center; padding: 1rem; }
    .controller-info-content { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; max-width: 450px; width: 100%; box-shadow: 0 20px 40px rgba(0,0,0,0.5); }
    .controller-info-content h3 { font-family: var(--font-display); font-size: 1rem; color: var(--steel); margin-bottom: 0.5rem; }
    .controller-info-content p { color: var(--muted); font-size: 0.8rem; margin-bottom: 1rem; }
    .info-row { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.8rem; }
    .info-row .info-label { color: var(--muted); }
    .info-row .info-value { font-family: var(--font-display); color: var(--steel); word-break: break-all; margin: 0 0.5rem; }
    .info-row .copy-btn { background: transparent; border: 1px solid rgba(255,255,255,0.1); color: var(--muted); padding: 0.2rem 0.4rem; border-radius: 4px; cursor: pointer; font-size: 0.7rem; }
    .info-row .copy-btn:hover { border-color: var(--orange); color: var(--orange); }
    .controller-connect-btn { width: 100%; margin-top: 1rem; padding: 0.6rem; background: var(--orange); border: none; border-radius: 6px; color: #fff; font-family: var(--font-display); font-size: 0.8rem; cursor: pointer; }

    .circularity-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 9999; justify-content: center; align-items: center; padding: 1rem; }
    .circularity-content { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; max-width: 700px; width: 100%; text-align: center; }
    .circularity-content h3 { font-family: var(--font-display); font-size: 1rem; color: var(--steel); margin-bottom: 0.3rem; }
    .circularity-content p { color: var(--muted); font-size: 0.8rem; margin-bottom: 1rem; }
    .circularity-canvas { width: 100%; max-width: 640px; height: auto; background: #0d0d0d; border-radius: 8px; border: 1px solid rgba(255,255,255,0.08); margin: 0 auto; display: block; }
    .circularity-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-top: 1rem; }
    .metric-card { background: rgba(255,255,255,0.03); padding: 0.6rem; border-radius: 6px; border: 1px solid rgba(255,255,255,0.05); text-align: left; }
    .metric-card strong { display: block; font-size: 0.75rem; color: var(--steel); font-family: var(--font-display); }
    .metric-card span { font-size: 0.75rem; color: var(--muted); }
    .circularity-actions { display: flex; gap: 0.8rem; justify-content: center; margin-top: 1.2rem; }
    .circularity-btn { padding: 0.5rem 1.4rem; border-radius: 6px; cursor: pointer; font-family: var(--font-display); font-size: 0.78rem; text-transform: uppercase; font-weight: 700; transition: all 0.15s ease; }
    .circularity-btn.reset { background: rgba(255, 140, 0, 0.15); border: 1px solid var(--orange); color: var(--orange); }
    .circularity-btn.reset:hover { background: var(--orange); color: #000; }
    .circularity-btn.close { background: transparent; border: 1px solid var(--border); color: var(--muted); }
    .circularity-btn.close:hover { border-color: #fff; color: #fff; }

    .control-panel { display: flex; flex-direction: column; gap: 1.2rem; }
    .controller-wrapper { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 520px; padding: 1rem 1rem 1.5rem 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 12px; position: relative; width: 100%; box-sizing: border-box; }
    .controller-empty { width: 100%; min-height: 480px; display: grid; place-items: center; border: 1px dashed rgba(255, 255, 255, 0.12); border-radius: 10px; color: var(--muted); text-align: center; padding: 2rem; box-sizing: border-box; }
    .controller-empty strong { display: block; color: var(--steel); font-family: var(--font-display); font-size: 0.95rem; margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.5px; }
    .controller-empty span { font-size: 0.85rem; }

    .axes-display { position: absolute; bottom: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; z-index: 10; width: auto; }
    .stick-axis-card { background: rgba(18, 18, 22, 0.88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); border-radius: 10px; padding: 0.55rem 0.65rem; display: flex; flex-direction: column; align-items: center; min-width: 0; width: 160px; flex-shrink: 0; pointer-events: auto; }
    .stick-axis-card h4 { margin: 0 0 0.35rem; font-size: 0.68rem; font-family: var(--font-display); color: var(--steel); letter-spacing: 0.5px; text-transform: uppercase; text-align: center; }
    .stick-canvas-container { position: relative; width: 132px; height: 132px; border-radius: 50%; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.08); display: grid; place-items: center; overflow: hidden; margin-bottom: 0.4rem; }
    .stick-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
    .deadzone-ring { position: absolute; width: 34px; height: 34px; border-radius: 50%; border: 1px dashed rgba(255, 140, 0, 0.35); pointer-events: none; }
    .stick-dot { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: #ff8c00; box-shadow: 0 0 8px #ff8c00; transform: translate(0, 0); pointer-events: none; transition: background 0.1s; }
    .stick-dot.drift { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
    .stick-values { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem; }
    .stick-value { background: rgba(0,0,0,0.35); padding: 0.22rem 0.3rem; border-radius: 4px; border: 1px solid rgba(255,255,255,0.04); text-align: center; }
    .stick-value span { display: block; font-size: 0.58rem; color: var(--muted); font-family: var(--font-display); line-height: 1; margin-bottom: 1px; }
    .stick-value strong { font-size: 0.68rem; color: var(--steel); font-family: var(--font-display); line-height: 1.1; letter-spacing: -0.2px; font-variant-numeric: tabular-nums; }
    .stick-value strong.warning { color: #ef4444; }
    .report-btn { text-align: center; padding-top: 0.5rem; }

    @media (max-width: 750px) {
      .test-layout { grid-template-columns: 1fr; }
      .instructions-panel { order: 2; }
      .control-panel { order: 1; }
      .axes-display { position: static; display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; width: 100%; margin-top: 0.8rem; pointer-events: auto; }
      .stick-axis-card { width: 100%; background: var(--card); border: 1px solid var(--border); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; padding: 0.55rem; }
      .stick-canvas-container { width: 132px; height: 132px; margin: 0 auto 0.4rem auto; }
      .controller-selector-bar { margin-right: 0; width: 100%; }
      .toolbar-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
    }

    .trigger-pct-meter { position: absolute; top: 30px; left: 50%; transform: translateX(-50%); font-family: Arial, sans-serif; font-weight: 900; font-size: 18px; color: #ff8c00; text-shadow: 0 0 6px rgba(0,0,0,0.9), 0 0 10px #ff8c00; pointer-events: none; opacity: 0; transition: opacity 0.1s ease; z-index: 5; }
