
@font-face{font-family:'Buzz';font-style:normal;font-weight:400;font-display:swap;src:url(assets/asset-01.otf) format('woff2');}
@font-face{font-family:'Avantt';font-style:normal;font-weight:500;font-display:swap;src:url(assets/asset-02.otf) format('woff2');}
@font-face{font-family:'Avantt';font-style:normal;font-weight:600;font-display:swap;src:url(assets/asset-03.otf) format('woff2');}
@font-face{font-family:'Avantt';font-style:normal;font-weight:800;font-display:swap;src:url(assets/asset-04.otf) format('woff2');}
  :root {
    color-scheme: light;
    --lime-1: #d6f58e;
    --lime-2: #c5e035;
    --teal:   #107060;
    --teal-d: #0b4f44;
    --teal-dd:#082f29;
    --purple:  #7d2e9e;
    --purple-d:#401050;
    --cream:  #f3f7e4;
    --ink:    #0b2e28;
    --font-display: "Buzz", system-ui, sans-serif;
    --font-ui: "Avantt", system-ui, sans-serif;
    --pik-avatar: url("assets/asset-05.png");
    --o-phone:   url("assets/asset-06.webp");
    --o-dimmer:  url("assets/asset-07.webp");
    --o-flower:  url("assets/asset-08.webp");
    --o-speaker: url("assets/asset-09.webp");
    --o-headph:  url("assets/asset-10.webp");
    --o-camera:  url("assets/asset-11.webp");
    --o-glasses: url("assets/asset-12.webp");
    --o-star:    url("assets/asset-13.png");
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  * { box-sizing: border-box; }
  html { height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
  body {
    margin: 0; min-height: 100%;
    font-family: var(--font-ui); color: var(--teal);
    background:
      radial-gradient(130% 90% at 70% 0%, var(--lime-1), transparent 55%),
      linear-gradient(170deg, var(--lime-1) 0%, var(--lime-2) 100%);
    background-attachment: fixed; -webkit-font-smoothing: antialiased;
    display: flex; flex-direction: column; align-items: center;
  }
  .wrap { width: 100%; max-width: 520px; padding: clamp(14px,4.5vw,24px) clamp(16px,4.5vw,24px) 40px; flex: 1; }

  .lockup { display: flex; align-items: center; justify-content: center; gap: clamp(12px,4vw,20px); flex-wrap: wrap; margin: 6px 0 4px; }
  .lockup img { display: block; width: auto; }
  .lockup .pik { height: clamp(50px, 13.5vw, 70px); }
  .lockup .carl { height: clamp(32px, 8.6vw, 44px); }
  .lockup .x { font-family: var(--font-display); font-size: clamp(22px,6vw,30px); color: var(--purple); line-height: 1; }
  .tagline { text-align: center; font-family: var(--font-ui); font-weight: 600; color: var(--teal); font-size: clamp(12.5px,3.4vw,14.5px); margin: 6px 0 0; }

  .prize {
    margin: 16px 0 16px; background: linear-gradient(135deg, var(--purple) 0%, var(--purple-d) 100%);
    color: var(--lime-1); border-radius: 16px; padding: 14px 16px; font-size: 14px; line-height: 1.4;
    display: flex; gap: 11px; align-items: center; box-shadow: 0 10px 24px -14px var(--purple-d);
  }
  .prize .burg { font-size: 23px; line-height: 1; flex: none; }
  .prize b { color: #fff; }

  .bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
  .stats { display: flex; gap: 20px; }
  .stat b { font-family: var(--font-display); font-size: 24px; color: var(--teal); line-height: 1; display: block; }
  .stat span { font-family: var(--font-ui); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--teal-d); opacity: .85; }
  .rank-btn { appearance: none; border: 2px solid var(--purple); background: transparent; color: var(--purple); font-family: var(--font-ui); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; padding: 8px 15px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; }
  .rank-btn:hover { background: var(--purple); color: var(--lime-1); }
  .rank-btn:active { transform: scale(.96); }

  .board-shell { position: relative; }
  #board { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px,2.4vw,12px); }
  .cell { aspect-ratio: 1; perspective: 700px; cursor: pointer; position: relative; }
  .inner { position: absolute; inset: 0; transition: transform .22s cubic-bezier(.3,.9,.3,1); transform-style: preserve-3d; }
  .cell.flip .inner, .cell.done .inner { transform: rotateY(180deg); }
  .face { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; display: grid; place-items: center; overflow: hidden; }

  .face.front {
    background: linear-gradient(150deg, var(--teal) 0%, var(--teal-d) 100%);
    border: 1.5px solid #ffffff22; box-shadow: inset 0 1px 0 #ffffff1f;
  }
  .face.front::after { content: ""; position: absolute; inset: 0; background: var(--pik-avatar) center/58% no-repeat; }

  .face.back {
    transform: rotateY(180deg);
    background: radial-gradient(120% 120% at 50% 20%, var(--teal-d), var(--teal-dd));
    border: 1.5px solid #ffffff1a;
  }
  .face.back.obj { background-position: center; background-repeat: no-repeat; background-size: 80%; filter: drop-shadow(0 4px 8px rgba(0,0,0,.4)); }
  .cell.done .face.back { animation: pop .4s ease; }
  .cell.done { cursor: default; }
  .cell.done .inner { box-shadow: 0 0 0 2px var(--lime-2), 0 0 22px -4px var(--lime-2); border-radius: 14px; }
  @keyframes pop { 0%{transform:rotateY(180deg) scale(1)} 50%{transform:rotateY(180deg) scale(1.08)} 100%{transform:rotateY(180deg) scale(1)} }

  .overlay { position: absolute; inset: -6px; display: none; place-items: center; z-index: 10; background: #0b4f44ee; backdrop-filter: blur(6px); border-radius: 20px; padding: 22px; }
  .overlay.show { display: grid; animation: fade .3s ease; }
  @keyframes fade { from{opacity:0; transform: translateY(10px)} to{opacity:1; transform:none} }
  .panel { text-align: center; max-width: 340px; width: 100%; }
  .panel .t { font-family: var(--font-display); font-size: clamp(26px,8vw,38px); color: var(--lime-1); line-height: .95; margin-bottom: 8px; }
  .panel .d { font-family: var(--font-ui); font-weight: 500; color: #eafbe6; font-size: 14.5px; line-height: 1.45; margin-bottom: 18px; }
  .panel .d b { color: #fff; }
  .win-badge { display: inline-flex; align-items: center; gap: 7px; background: var(--lime-2); color: var(--teal-dd); font-weight: 800; font-size: 13px; padding: 7px 14px; border-radius: 999px; margin-bottom: 14px; text-transform: uppercase; letter-spacing: .5px; }
  .time-big { font-family: var(--font-display); font-size: clamp(42px,13vw,58px); color: #fff; line-height: 1; margin: 4px 0 2px; }
  .time-cap { font-family: var(--font-ui); font-weight: 600; color: #cdeccb; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 18px; }

  .name-row { display: flex; gap: 8px; margin-bottom: 14px; }
  .name-row input { flex: 1; min-width: 0; font-family: var(--font-ui); font-size: 15px; color: var(--ink); background: var(--cream); border: none; border-radius: 12px; padding: 13px 14px; outline: none; }
  .name-row input::placeholder { color: #7a8f70; }

  .btn { appearance: none; border: none; cursor: pointer; font-family: var(--font-ui); font-weight: 800; font-size: 15px; padding: 13px 22px; border-radius: 12px; background: var(--lime-2); color: var(--teal-dd); transition: transform .1s, filter .15s; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
  .btn:hover { filter: brightness(1.06); }
  .btn:active { transform: scale(.96); }
  .btn.full { width: 100%; }
  .btn.ghost { background: transparent; color: var(--lime-1); border: 2px solid var(--lime-1); }

  .lb { text-align: left; margin: 6px 0 16px; max-height: 46vh; overflow-y: auto; }
  .lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #ffffff12; margin-bottom: 7px; }
  .lb-row.top { background: var(--lime-2); color: var(--teal-dd); }
  .lb-row.me { outline: 2px solid var(--lime-1); }
  .lb-pos { font-family: var(--font-display); font-size: 17px; width: 30px; flex: none; color: var(--lime-1); }
  .lb-row.top .lb-pos { color: var(--teal-dd); }
  .lb-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f0fbec; }
  .lb-row.top .lb-name { color: var(--teal-dd); }
  .lb-time { font-family: var(--font-display); font-size: 15px; color: #fff; }
  .lb-row.top .lb-time { color: var(--teal-dd); }
  .lb-burger { flex: none; font-size: 15px; }
  .lb-empty { color: #cdeccb; text-align: center; padding: 24px 0; font-size: 14px; }
  .mini { margin-top: 14px; }
  .mini a { color: #bfe6bb; font-size: 12px; text-decoration: underline; cursor: pointer; }

  footer { text-align: center; margin-top: 26px; font-family: var(--font-ui); font-weight: 600; font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--teal-d); opacity: .75; }

/* Standalone demo additions. */
.demo-note { text-align: center; font-size: 10px; line-height: 1.4; color: var(--teal-d); margin: 10px 0; }
.cell { appearance: none; border: 0; padding: 0; background: transparent; font: inherit; }
.cell:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; border-radius: 14px; }
