/* Tree Chop — game surface */

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

  html, body {
    height: 100%;
    overflow: hidden;
    background: #d9f1fb;
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
  }

  #game {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
  }

  /* ---------- top bar ---------- */
  .bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 14px 16px;
    z-index: 5;
  }

  /* ---------- score ---------- */
  .timer {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: min(58%, 300px);
    height: 20px;
    border-radius: 10px;
    background: #f8efdd;
    border: 3px solid #c9904d;
    box-shadow: 0 3px 0 rgba(150, 105, 55, 0.22), inset 0 2px 3px rgba(150, 105, 55, 0.18);
    overflow: hidden;
    z-index: 3;
  }

  .timer-fill {
    height: 100%;
    width: 100%;
    border-radius: 6px;
    background: linear-gradient(#a6d96a, #7cb342);
  }

  .timer-fill.low {
    background: linear-gradient(#f2a85a, #e05a3f);
  }

  .hud {
    position: fixed;
    top: 104px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 3;
    pointer-events: none;
  }

  .hud .score {
    font-size: 58px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -2.5px;
    color: #fdf6ea;
    text-shadow: 0 3px 0 rgba(110, 70, 38, 0.55);
  }

  .hud .level {
    margin-top: 3px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    color: #fdf6ea;
    text-shadow: 0 2px 0 rgba(110, 70, 38, 0.5);
  }

  .hud .level.pop { animation: levelpop 0.4s ease; }

  @keyframes levelpop {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); }
    100% { transform: scale(1); }
  }

  /* signed-in player chip */
  .user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 13px 5px 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: #4b5a63;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 3px 0 rgba(120, 160, 180, 0.25);
    max-width: 44%;
  }

  .user img,
  .user .initial {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0e8da;
    color: #a97539;
    font-weight: 800;
    font-size: 13px;
    display: grid;
    place-items: center;
    flex: none;
  }

  .user .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* out of time toast */
  .toast {
    position: fixed;
    top: 46%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    padding: 13px 26px;
    border-radius: 999px;
    background: rgba(224, 90, 63, 0.96);
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.3px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    box-shadow: 0 14px 34px rgba(180, 60, 40, 0.35);
    z-index: 6;
  }

  .toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

  .back-pill {
    position: fixed;
    top: 14px;
    left: 16px;
    z-index: 6;
    padding: 8px 15px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    color: #4b5a63;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 3px 0 rgba(120, 160, 180, 0.22);
  }

  .back-pill:active { transform: translateY(2px); }

  .first-hint {
    position: fixed;
    left: 50%;
    top: 58%;
    transform: translate(-50%, -50%) scale(0.96);
    z-index: 6;
    max-width: 260px;
    padding: 12px 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    color: #7a5a38;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
    box-shadow: 0 12px 30px rgba(120, 90, 50, 0.22);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .first-hint.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

  .toast.good {
    background: rgba(124, 179, 66, 0.96);
    box-shadow: 0 14px 34px rgba(90, 140, 50, 0.35);
  }

  /* ---------- screens ---------- */
  .screen {
    position: fixed;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    pointer-events: none;
  }

  .screen > * { pointer-events: auto; }

  #start-screen { justify-content: space-between; padding: 118px 24px 84px; }

  .title {
    font-size: clamp(38px, 11vw, 56px);
    font-weight: 800;
    letter-spacing: -1.5px;
    color: #6d4b2c;
    text-shadow: 0 0 26px rgba(255, 255, 255, 0.95), 0 0 12px rgba(255, 255, 255, 0.95), 0 3px 0 rgba(255, 255, 255, 0.85);
  }

  .title .start-meta {
    margin-top: 12px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: #8b6a45;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .title span {
    display: block;
    margin-top: 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #7d9aa6;
    text-shadow: none;
  }

  /* ---------- wooden log buttons ---------- */
  .log-btn {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    background: repeating-radial-gradient(circle at 50% 50%, #e3b475 0 9px, #d5a05c 9px 11px);
    box-shadow: inset 0 0 0 3px #c9904d, 0 6px 0 #b5814a, 0 12px 20px rgba(120, 80, 40, 0.18);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
  }

  .log-btn svg { width: 42%; height: 42%; fill: #8a5a2a; }

  .log-btn:active {
    transform: translateY(4px);
    box-shadow: inset 0 0 0 3px #c9904d, 0 2px 0 #b5814a, 0 6px 12px rgba(120, 80, 40, 0.2);
  }

  .log-btn.big { width: 118px; height: 118px; }

  /* ---------- bottom arrows ---------- */
  .arrows {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
    z-index: 5;
  }

  .arrows .log-btn { width: 88px; height: 88px; }

  /* ---------- game over ---------- */
  .over-title {
    font-size: clamp(26px, 7.5vw, 34px);
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #6d4b2c;
    text-shadow: 0 0 24px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.95), 0 2px 0 rgba(255, 255, 255, 0.85);
  }

  .over-score {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    font-size: clamp(52px, 15vw, 72px);
    font-weight: 800;
    letter-spacing: -3px;
    color: #6d4b2c;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.95), 0 0 12px rgba(255, 255, 255, 0.95), 0 3px 0 rgba(255, 255, 255, 0.85);
  }

  .over-score svg { width: 34px; height: 34px; }

  .over-why {
    margin-top: 10px;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #8b6a45;
    box-shadow: 0 2px 0 rgba(150, 105, 55, 0.15);
  }

  #over-screen { justify-content: flex-start; padding-top: 24vh; }

  .over-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 82px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .over-link {
    font-size: 13px;
    font-weight: 700;
    color: #8b6a45;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 0 rgba(150, 105, 55, 0.15);
  }

  .over-meta {
    margin-top: 8px;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    font-size: 13px;
    font-weight: 700;
    color: #8b6a45;
    box-shadow: 0 2px 0 rgba(150, 105, 55, 0.15);
  }

  .hidden { display: none !important; }

