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

    body {
      background: #f5f3ef;
      font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', sans-serif;
      color: #4a4a4a;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100dvh;
      max-height: 100dvh;
      margin: 0;
      padding: 0;
      overflow: hidden;
      -webkit-user-select: none;
      user-select: none;
    }

    #app {
      width: 100%;
      max-width: 420px;
      height: 100dvh;
      max-height: 100dvh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 8px 10px;
      box-sizing: border-box;
      overflow: hidden;
    }

    #canvas-wrap {
      width: 100%;
      max-width: 400px;
      height: 100%;
      max-height: 100%;
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
    }

    .canvas-header {
      position: absolute;
      top: 10px;
      left: 10px;
      right: 10px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      z-index: 10;
      pointer-events: none;
    }

    .header-right {
      display: flex;
      gap: 6px;
      align-items: center;
    }

    .header-btn {
      pointer-events: auto;
      background: rgba(245, 243, 239, 0.90);
      border: 1px solid rgba(185, 175, 165, 0.55);
      border-radius: 50%;
      width: 30px;
      height: 30px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      color: #555e69;
      cursor: pointer;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
      transition: background 0.15s, border-color 0.15s, transform 0.15s;
      font-family: inherit;
    }

    .header-btn:hover {
      background: #ffffff;
      color: #1a202c;
      border-color: #8c98a5;
      transform: scale(1.05);
    }

    .header-btn:active {
      transform: scale(0.95);
    }

    .announcer-toast {
      position: absolute;
      top: 48px;
      left: 50%;
      transform: translateX(-50%) translateY(-6px);
      background: rgba(40, 50, 65, 0.92);
      color: #ffffff;
      padding: 6px 14px;
      border-radius: 16px;
      font-size: 12px;
      font-weight: 600;
      letter-spacing: 0.5px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease, transform 0.2s ease;
      z-index: 30;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
      white-space: nowrap;
    }

    .announcer-toast.visible {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    canvas {
      display: block;
      height: 100%;
      max-height: 100%;
      width: auto;
      max-width: 100%;
      aspect-ratio: 400 / 760;
      border-radius: 12px;
      touch-action: none;
      cursor: default;
    }

    /* ----- Modal ----- */
    .overlay {
      position: fixed;
      inset: 0;
      background: rgba(80, 75, 70, 0.32);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 100;
      opacity: 0;
      transition: opacity 0.3s;
      pointer-events: none;
    }
    .overlay.visible {
      opacity: 1;
      pointer-events: auto;
    }

    .modal {
      background: #f5f3ef;
      border: 1px solid #ddd8d2;
      border-radius: 14px;
      padding: 32px 36px;
      text-align: center;
      max-width: 320px;
      width: 90%;
      position: relative;
      transform: translateY(10px);
      transition: transform 0.3s;
    }
    .overlay.visible .modal { transform: translateY(0); }

    .modal h2 {
      font-weight: 300;
      font-size: 16px;
      letter-spacing: 2px;
      text-transform: lowercase;
      margin-bottom: 4px;
    }

    .modal .modal-day {
      font-size: 12px;
      color: #8a8a8a;
      margin-bottom: 20px;
    }

    .score-display {
      margin-bottom: 18px;
    }
    .score-number {
      font-size: 48px;
      font-weight: 200;
      color: #c9a84c;
      line-height: 1;
    }
    .score-number.zero { color: #b0b0b0; }
    .score-label {
      font-size: 13px;
      color: #8a8a8a;
      letter-spacing: 1.5px;
      margin-top: 2px;
    }

    .throws-row {
      font-size: 22px;
      letter-spacing: 6px;
      margin-bottom: 22px;
    }

    .share-btn {
      background: none;
      border: 1.5px solid #b0a99f;
      border-radius: 8px;
      padding: 9px 28px;
      font-size: 13px;
      color: #4a4a4a;
      letter-spacing: 1.5px;
      cursor: pointer;
      font-family: inherit;
      transition: border-color 0.2s, color 0.2s;
    }
    .share-btn:hover { border-color: #7a7570; color: #2a2a2a; }
    .share-btn:active { transform: scale(0.97); }

    .countdown {
      font-size: 11px;
      color: #a0a0a0;
      margin-top: 18px;
      letter-spacing: 0.5px;
    }

    .close-btn {
      position: absolute;
      top: 10px;
      right: 14px;
      background: none;
      border: none;
      font-size: 18px;
      color: #b0a99f;
      cursor: pointer;
      padding: 4px;
      line-height: 1;
    }
    .close-btn:hover { color: #6a6560; }

    .results-toggle {
      display: none;
    }

    /* ----- Help Modal Specifics ----- */
    .help-modal {
      max-width: 360px;
      padding: 28px 24px 24px;
      text-align: left;
    }

    .help-modal h2 {
      text-align: center;
      margin-bottom: 18px;
    }

    .help-content {
      display: flex;
      flex-direction: column;
      gap: 14px;
      margin-bottom: 22px;
    }

    .help-step {
      display: flex;
      gap: 12px;
      align-items: flex-start;
    }

    .step-num {
      width: 22px;
      height: 22px;
      border-radius: 11px;
      background: #608ab9;
      color: #ffffff;
      font-size: 11.5px;
      font-weight: 600;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      margin-top: 1px;
    }

    .step-text strong {
      display: block;
      font-size: 12.5px;
      color: #2d3748;
      margin-bottom: 2px;
    }

    .step-text p {
      font-size: 11.5px;
      color: #64748b;
      line-height: 1.4;
      margin: 0;
    }

    #help-got-it {
      display: block;
      width: 100%;
      text-align: center;
    }
