/* =========================
   /style.css
   ========================= */
   :root {
    --page-bg: #ffffff;
    --text: #111;
  
    --text-max: 1000px;
    --analysis-max: 820px;
  
    --pulseRGBA: rgba(77,163,255,0.28);
  
    /* Pads */
    --kickColor: #0ea5e9;
    --snareColor: #f97316;
    --padShadow: rgba(0,0,0,0.18);
  
    /* Beat */
    --beatOn: #22c55e;
    --beatOff: rgba(34,197,94,0.18);
    --beatPurpleOn: #a855f7;
    --beatPurpleOff: rgba(168,85,247,0.18);
    --beatOrangeOn: #f97316;
    --beatOrangeOff: rgba(249,115,22,0.18);
  
    /* Score colors */
    --score1: #ef4444;
    --score2: #f97316;
    --score3: #f59e0b;
    --score4: #84cc16;
    --score5: #22c55e;
  }
  
  * { box-sizing: border-box; }
  
  body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--page-bg);
    color: var(--text);
  }
  
  .app {
    max-width: 1260px;
    margin: 8px auto;
    padding: 12px 14px;
  }
  
  .hero { text-align: center; margin: 0 0 10px; }
  
  .app-title-img {
    display: block;
    margin: 20px auto 2px;
    padding-bottom: 10px;
  }
  
  .app-title-img img {
    display: block;
    margin: 0 auto;
    /* Use a standard percentage or max-width for the desktop layout */
    width: 60%; 
    max-width: 600px;
    height: auto;
  }
  
  /* When the screen hits your 799px breakpoint and the wrapped image loads, 
     tell it to take up way more space to compensate for the invisible padding */
  @media (max-width: 799px) {
    .app-title-img img {
      width: 95%; /* Push this to 100% or even 110% if the padding is really severe */
      max-width: none;
    }
  }
  
  .controlsPanel {
    background: #fff;
    border: 1px solid rgba(0,0,0,.0);
    border-radius: 16px;
    padding: 0;
  }
  .controlsPanelActions { margin-top: 6px; }
  
  .hidden { display: none !important; }
  .srOnly { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  
  select {
    height: 38px;
    width: 100%;
    padding: 0 10px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.2);
    background: #fff;
    cursor: pointer;
    font-weight: 800;
  }
  
  .compactSelectAuto { width: auto; max-width: none; inline-size: auto; justify-content: center; }
  .inlineControl { display: flex; flex-direction: column; gap: 6px; }
  
  button {
    height: 38px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.2);
    background: #fff;
    cursor: pointer;
    font-weight: 900;
    white-space: nowrap;
    max-width: max-content;
  }
  button:active { transform: translateY(1px); }
  button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
  
  .primary {
    background: rgb(71, 101, 166);
    color: #fff;
    border-color: rgba(0,0,0,.2);
  }
  
  /* Begin pulse */
  @keyframes beginPulse {
    0%   { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
    55%  { box-shadow: 0 0 0 12px var(--pulseRGBA); }
    100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
  }
  .pulse { animation: beginPulse 1.25s ease-in-out infinite; }
  
  .actionsRow {
    padding: 2px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .actionsCentered { justify-content: center; }
  .wrapTight { gap: 8px; }
  
  .bpmRow {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
  }
  #bpmRange, #introBpmRange { width: 150px; }
  #bpmNum, #introBpmNum {
    width: 76px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.2);
    padding: 0 10px;
    font-weight: 900;
  }
  
  /* Status / Beat */
  .statusPanel {
    max-width: var(--text-max);
    margin: 8px auto 0;
    background: #fff;
    border: 1px solid rgba(0,0,0,.0);
    border-radius: 16px;
    padding: 0;
  }
  
  .statusRow {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 6px 10px 8px;
  }
  
  .beatLights {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    width: 100%;
  }
  
  .beatDot {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--beatOff);
    border: 1px solid rgba(0,0,0,.15);
  }
  .beatDot {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--beatOff);
    border: 1px solid rgba(0,0,0,.15);
    transition: background-color 0.1s;
  }
  .beatDot[data-color="green"] { background: var(--beatOff); }
  .beatDot[data-color="green"].on { background: var(--beatOn); box-shadow: 0 0 0 8px rgba(34,197,94,0.20); }
  
  .beatDot[data-color="purple"] { background: var(--beatPurpleOff); }
  .beatDot[data-color="purple"].on { background: var(--beatPurpleOn); box-shadow: 0 0 0 8px rgba(168,85,247,0.20); }
  
  .beatDot[data-color="orange"] { background: var(--beatOrangeOff); }
  .beatDot[data-color="orange"].on { background: var(--beatOrangeOn); box-shadow: 0 0 0 8px rgba(249,115,22,0.20); }
  .beatDot.on { background: var(--beatOn); box-shadow: 0 0 0 8px rgba(34,197,94,0.20); }
  
  .statusText { width: 100%; text-align: center; }
  .phaseTitle { font-weight: 900; font-size: 16px; }
  .phaseSub { margin-top: 2px; font-size: 13px; opacity: .78; line-height: 1.2; }
  
  .scoreInline {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 0 10px 12px;
    flex-wrap: wrap;
  }
  .scorePill {
    display: flex;
    gap: 8px;
    align-items: baseline;
    border: 1px solid rgba(0,0,0,.16);
    border-radius: 999px;
    padding: 6px 10px;
    background: #fff;
    font-variant-numeric: tabular-nums;
  }
  .scoreLabel { font-size: 12px; opacity: .7; font-weight: 900; }
  .scoreValue { font-size: 14px; font-weight: 900; }
  
  /* Pads */
  .padsPanel {
    max-width: var(--text-max);
    margin: 10px auto 0;
  }
  .padsRow {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }
  .padBtn {
    --padSize: 180px; 
    width: var(--padSize);
    height: var(--padSize);
    flex: 0 0 var(--padSize);
    flex-shrink: 0;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,.18);
    box-shadow: 0 12px 26px var(--padShadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    box-sizing: border-box;
    user-select: none;
    touch-action: manipulation;
  }
  .padBtn:disabled { opacity: .55; box-shadow: none; }
  .padBtn img, .padBtn .padIcon {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    filter: drop-shadow(0 8px 10px rgba(0,0,0,.15));
  }
  .padBtn .padKey, .padBtn span {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 0 auto;
    font-size: 14px;
    opacity: .9;
    font-weight: 900;
  }
  
  .kickPad { background: var(--kickColor); color: #fff; }
  .snarePad { background: var(--snareColor); color: #fff; }
  
  @keyframes padFlash {
    0% { transform: translateY(0); filter: brightness(1); }
    35% { transform: translateY(-1px); filter: brightness(1.15); }
    100% { transform: translateY(0); filter: brightness(1); }
  }
  .padBtn.flash { animation: padFlash 180ms ease-out; }
  
  /* Analysis / Scorecard */
  .analysis {
    align-items: center;
    max-width: var(--analysis-max);
    margin: 10px auto 0;
    background: #fff;
    border: 1px solid rgba(0,0,0,.0);
    border-radius: 16px;
    padding: 0;
  }
  .analysisGrid { display: grid; gap: 10px; margin: 0 auto; }
  .oneCol { grid-template-columns: 1fr; }
  
  .analysisCard {
    border: 1px solid rgba(0,0,0,.18);
    border-radius: 14px;
    padding: 12px;
    background: #f9f9f9;
    text-align: center;
    transition: background-color 240ms ease, box-shadow 240ms ease, border-color 240ms ease;
  }
  .fixedFeedbackCard { min-height: 160px; }
  .analysisLabel {
    font-size: 16px;
    opacity: .85;
    margin-bottom: 8px;
    font-weight: 900;
    letter-spacing: .2px;
  }
  .analysisBody { font-size: 14px; line-height: 1.45; word-break: break-word; }
  
  .dim { opacity: .7; }
  
  /* Scorecard Grid Elements inside Modals */
  .scoreCardNarrow { padding: 14px 10px; margin: 0 auto; width: 100%; max-width: 440px; }
  .scoreGrid { display: grid; gap: 8px 10px; }
  .scoreGridVertical { grid-template-columns: 1fr; gap: 8px; max-width: 420px; margin: 0 auto; }
  .scoreItem {
    display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
    padding: 8px 10px; border: 1px solid rgba(0,0,0,.2); border-radius: 12px; background: #fff;
  }
  .scoreK { font-size: 12px; opacity: .75; font-weight: 800; }
  .scoreV { font-weight: 900; font-variant-numeric: tabular-nums; }
  .scoreActions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
  .scoreFooter { text-align: center; font-size: 12px; font-weight: 800; opacity: 0.55; margin-top: 24px; }
  #modalPlayerNameInput { height: 38px; padding: 0 10px; border-radius: 12px; border: 1px solid rgba(0,0,0,.2); font-weight: 800; width: min(240px, 70vw); }
  .modalActionsCentered { justify-content: center; }
  
  /* Large feedback display */
  .scoreBigWrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin: 4px 0 10px;
  }
  .scoreBigLine { font-size: 48px; font-weight: 900; letter-spacing: .4px; line-height: 1; }
  .scoreBigWord { font-size: 26px; font-weight: 900; line-height: 1.1; }
  .scoreBelow { margin-top: 6px; }
  
  /* Feedback color shifts */
  .analysisCard[data-score="1"]{ background: color-mix(in srgb, var(--score1) 18%, #fff); border-color: color-mix(in srgb, var(--score1) 55%, rgba(0,0,0,.18)); box-shadow: 0 0 0 6px color-mix(in srgb, var(--score1) 25%, transparent); }
  .analysisCard[data-score="2"]{ background: color-mix(in srgb, var(--score2) 18%, #fff); border-color: color-mix(in srgb, var(--score2) 55%, rgba(0,0,0,.18)); box-shadow: 0 0 0 6px color-mix(in srgb, var(--score2) 25%, transparent); }
  .analysisCard[data-score="3"]{ background: color-mix(in srgb, var(--score3) 18%, #fff); border-color: color-mix(in srgb, var(--score3) 55%, rgba(0,0,0,.18)); box-shadow: 0 0 0 6px color-mix(in srgb, var(--score3) 25%, transparent); }
  .analysisCard[data-score="4"]{ background: color-mix(in srgb, var(--score4) 18%, #fff); border-color: color-mix(in srgb, var(--score4) 55%, rgba(0,0,0,.18)); box-shadow: 0 0 0 6px color-mix(in srgb, var(--score4) 25%, transparent); }
  .analysisCard[data-score="5"]{ background: color-mix(in srgb, var(--score5) 18%, #fff); border-color: color-mix(in srgb, var(--score5) 55%, rgba(0,0,0,.18)); box-shadow: 0 0 0 6px color-mix(in srgb, var(--score5) 25%, transparent); }
  
  .scoreBarWrap{ display:none; }
  .scoreBar{ display:none; }
  
  /* Exact Modals from Rushing/Dragging baseline */
  .modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 60px; padding-left: 10px; padding-right: 10px;
    z-index: 50; overflow: auto;
  }
  .modalCard {
    width: min(720px, 100%); background: white; border-radius: 18px;
    padding: 18px; box-shadow: 0 12px 30px rgba(0,0,0,.25);
    max-height: calc(100dvh - 36px); overflow: auto;
    display: flex; flex-direction: column; align-items: center;
  }
  .modalCardCompact {
    width: max-content;
    max-width: min(400px, calc(100vw - 32px));
  }
  .modalTitle { font-size: 18px; font-weight: 900; margin: 0 0 8px; text-align: center; }
  .modalBody { font-size: 14px; line-height: 1.45; opacity: .95; text-align: center; width: 100%; }
  .modalBody p { margin: 0 0 10px; }
  .modalActions { margin-top: 10px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
  
  .modalTitleImg { display: block; margin: 0 auto 0px; max-width: 280px; padding: 0px; }
  .modalTitleImg img { display: block; width: 100%; height: auto; padding: 0px; }
  
  .settingsSection { margin-top: 6px; }
  .settingsLabel {
    font-size: 13px;
    font-weight: 900;
    opacity: .78;
    text-align: center;
  }
  
  /* Responsive */
  @media (max-width: 980px) {
    #bpmRange, #introBpmRange { width: 100%; }
    .bpmRow { width: 100%; }
  }
  @media (max-width: 520px) {
    .app-title { font-size: 40px; }
    .app-subtitle-large { font-size: 24px; }
    .scoreBigLine { font-size: 42px; }
    .scoreBigWord { font-size: 22px; }
  }
  @media (max-width: 420px) {
    button { padding: 0 12px; }
  }
  @media (max-height: 720px) {
    .modal { padding: 6px; }
    .modalCard { max-height: calc(100vh - 20px); }
    .modalCardCompact { max-height: calc(100vh - 20px); }
  }