html, body {
      height: 100%;
      margin: 0;
      background: #000;
      color: #eee;
      font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    }
    .stage {
      position: fixed;
      inset: 0;
      overflow: hidden;
    }
    .stage::before {
      content: "";
      position: absolute;
      inset: 0;
      background: center/cover no-repeat url("assets/audience_loop.gif");
      filter: brightness(0.75);
    }

    .banner {
      position: fixed;
      top: calc(env(safe-area-inset-top, 0px) + 0.6rem);
      left: 50%;
      transform: translateX(-50%);
      background: rgba(20, 20, 20, 0.35);
      backdrop-filter: blur(6px);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 12px;
      padding: .5rem 1rem;
      font-size: 3.25rem;
      color: #fff;
      font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
      font-weight: 600;
      letter-spacing: .5px;
      user-select: none;
      z-index: 10;
      text-transform: uppercase;
      text-shadow:
        0 0 2px rgba(255,255,255,0.4),
        0 0 4px rgba(255,0,0,0.5),
        0 0 6px rgba(0,255,255,0.3);
      animation: jitter 150ms infinite alternate, flicker 3s infinite;
    }
    @keyframes jitter {
      0%   { transform: translateX(-50%) translate(0px, 0px) skew(0deg); }
      25%  { transform: translateX(-50%) translate(-0.5px, 0.3px) skew(-0.2deg); }
      50%  { transform: translateX(-50%) translate(0.5px, -0.5px) skew(0.3deg); }
      75%  { transform: translateX(-50%) translate(-0.3px, 0.7px) skew(0deg); }
      100% { transform: translateX(-50%) translate(0.2px, -0.3px) skew(0.1deg); }
    }
    @keyframes flicker {
      0%, 18%, 22%, 25%, 53%, 57%, 100% {
        text-shadow:
          0 0 2px rgba(255,255,255,0.4),
          0 0 4px rgba(255,0,0,0.5),
          0 0 6px rgba(0,255,255,0.3);
        opacity: 1;
      }
      20%, 24%, 55% {
        text-shadow:
          0 0 1px rgba(255,255,255,0.1),
          0 0 3px rgba(255,0,0,0.3),
          0 0 3px rgba(0,255,255,0.2);
        opacity: 0.7;
      }
    }
    .banner:hover {
      animation: jitter 120ms infinite alternate, flicker 1.5s infinite;
      color: #f2f2f2;
      text-shadow:
        -1px 0 rgba(255,0,0,0.7),
         1px 0 rgba(0,255,255,0.7),
         0 0 6px rgba(255,255,255,0.5);
    }

    .panel {
      position: fixed;
      left: 1rem;
      bottom: calc(env(safe-area-inset-bottom, 0px) + 0.8rem);
      right: 1rem;
      max-width: 720px;
      margin: 0 auto;
      background: rgba(20,20,20,0.75);
      backdrop-filter: blur(6px);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 12px;
      padding: .75rem 1rem;
      transition: transform .2s ease, opacity .2s ease;
    }
    .panel.collapsed {
      transform: translateY(calc(100% - 3.25rem));
      opacity: .95;
    }
    .panel-header { display: flex; align-items: center; gap: .75rem; }
    .panel-title { font-weight: 700; letter-spacing: .2px; }
    .spacer { flex: 1; }

    .toggle {
      background: transparent;
      color: #eee;
      border: 1px solid rgba(255,255,255,0.25);
      padding: .35rem .65rem;
      border-radius: 10px;
      cursor: pointer;
      user-select: none;
      transition: background .15s ease, border-color .15s ease;
    }
    .toggle:hover,
    .toggle:focus-visible { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.45); }
    .toggle:active { background: rgba(255,255,255,0.15); }

    .row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
    .rows { margin-top: .5rem; }
    .row + .row { margin-top: .75rem; }

    .btn {
      background: #3a7f3a;
      color: #101;
      border: none;
      padding: .6rem 1rem;
      border-radius: 10px;
      cursor: pointer;
      font-weight: 600;
      transition: transform .04s ease, filter .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
      box-shadow: 0 2px 0 rgba(0,0,0,0.35);
      touch-action: manipulation;
    }
    .btn:hover { filter: brightness(1.05); }
    .btn:active { transform: translateY(1px); }
    .btn.secondary { background: #333; color: #eee; }
    .btn.active { background: #7bd07b; color: #101; }
    .btn.inactive { background: #444; color: #bbb; }
    .btn.pulse { animation: pulse 1s infinite; }
    @keyframes pulse { 0%{filter:brightness(1)} 50%{filter:brightness(1.25)} 100%{filter:brightness(1)} }


    fieldset {
      flex: 1 1 280px;
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 10px;
      padding: .5rem .75rem;
      min-width: 0;
      width: 100%;
      max-width: 100%;
    }
    legend { padding: 0 .35rem; font-size: .9rem; opacity: .9; }
    label { display: inline-flex; align-items: center; gap: .4rem; margin-right: .75rem; min-width: 0; }
    input[type="range"] { width: 100%; max-width: 100%; }
    .note { font-size: .9rem; opacity: .8; }

    .panel-body {
      overflow: hidden;
      transition: grid-template-rows .2s ease, opacity .2s ease;
      display: grid;
      grid-template-rows: 1fr;
    }
    .panel.collapsed .panel-body { grid-template-rows: 0fr; opacity: .0; }
    .panel-inner { min-height: 0; }

    .about-panel {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 90%;
      max-width: 600px;
      background: rgba(20,20,20,0.85);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 12px;
      padding: 1rem 1.5rem;
      box-shadow: 0 4px 12px rgba(0,0,0,0.5);
      color: #eee;
      display: none;
      flex-direction: column;
      max-height: 80vh;
      overflow: auto;
      z-index: 20;
      font-size: 0.759rem;
    }

    .code-panel {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 90%;
      max-width: 420px;
      background: rgba(20,20,20,0.9);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 12px;
      padding: 1rem 1.25rem;
      box-shadow: 0 4px 12px rgba(0,0,0,0.5);
      color: #eee;
      display: none;
      flex-direction: column;
      max-height: 80vh;
      overflow: auto;
      z-index: 30;
      font-size: 0.9rem;
    }
    .code-panel input {
      margin-left: 0.4rem;
    }
    

    .limit-modal {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 90%;
      max-width: 600px;
      background: rgba(20,20,20,0.9);
      backdrop-filter: blur(10px);
      border: 2px solid rgba(123,208,123,0.3);
      border-radius: 12px;
      padding: 1.5rem 2rem;
      box-shadow: 0 8px 24px rgba(0,0,0,0.7), 0 0 40px rgba(123,208,123,0.15);
      color: #eee;
      display: none;
      flex-direction: column;
      max-height: 85vh;
      overflow: auto;
      z-index: 25;
      font-size: 0.95rem;
    }

    .limit-modal h2 {
      margin-top: 0;
      color: #7bd07b;
      text-align: center;
      font-size: 1.5rem;
    }

    .limit-modal ul {
      margin: 0.75rem 0;
      padding-left: 1.25rem;
      line-height: 1.6;
    }

    .limit-modal li {
      margin: 0.5rem 0;
    }

    .limit-modal strong {
      color: #fff;
    }

    .limit-modal #closeLimit {
      margin-top: 1rem;
      align-self: center;
      background: #7bd07b;
      color: #101;
      font-weight: 600;
      padding: 0.6rem 1.5rem;
    }

    .limit-modal #closeLimit:hover {
      background: #9fe39f;
    }

    .status {
      margin-top: .5rem;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
      font-size: .85rem;
      background: rgba(0,0,0,0.35);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 8px;
      padding: .5rem .6rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ok { color: #9fe39f; }
    .warn { color: #ffd27a; }
    .err { color: #ff9f9f; }
    .panel.collapsed .status { display: none; }

    .about-link { color: #7af; text-decoration: none; }


    /* iPhone SE (2nd/3rd gen) and similarly small phones */
    @media (max-width: 375px) and (max-height: 667px) {
      .banner {
        max-width: 100vw;
        white-space: normal;      /* allow wrap */
        text-align: center;
        padding: .3rem .6rem;
        line-height: 1.05;
        font-size: clamp(1.1rem, 6.8vw, 2.1rem);
      }

      .panel {
        padding: .55rem .65rem;
        border-radius: 10px;
      }

      .btn, .toggle {
        padding: .48rem .7rem;
        border-radius: 9px;
        font-size: .95rem;
      }

      legend { font-size: .85rem; }
      .note  { font-size: .85rem; }

      /* keep the collapsed header a bit taller so the toggle is tappable */
      .panel.collapsed { transform: translateY(calc(100% - 3.6rem)); }
    }