/* Daam on laptops and desktops. Linked after styles.css.
   Phones stay as they are: layout changes sit behind min-width: 900px and
   hover effects behind (hover: hover) and (pointer: fine). */

/* Keyboard hints are in the markup everywhere but only show on a wide screen with a mouse */
.chip kbd, .cta kbd { display: none; }

/* Results on phones: one column in DOM order, and the WhatsApp bar stays sticky
   against the whole scrolling result (the wrappers only matter on desktop). */
@media (max-width: 899.98px) {
  .res-main, .res-side { display: contents; }
  .res-main > .slip-wrap, .res-side > * { flex: none; }
}

/* ---------- Desktop shell ---------- */
@media (min-width: 900px) {
  body { font-size: 15px; }
  .app {
    max-width: 1080px;
    height: auto;
    min-height: 100dvh;
    padding: 0 32px;
  }
  .top { height: 76px; }
  .brand { gap: 9px; }
  .coin { width: 26px; height: 26px; }
  .wordmark { font-size: 28px; }
  .meta-1 { font-size: 12px; }
  .meta-2 { font-size: 11px; margin-top: 2px; }
  .actions { gap: 6px; margin-right: -4px; }
  .icon-btn { width: 42px; height: 42px; border-radius: 50%; transition: background-color .18s var(--ease), transform .12s var(--ease); }
  .icon-btn svg { width: 22px; height: 22px; }
  .screen { flex: 1 0 auto; min-height: 0; }
  .cap { font-size: 11.5px; }
  .rule { margin: 10px 0; }

  /* ---------- Play: receipt left, panel right ---------- */
  .play {
    display: grid;
    grid-template-columns: minmax(0, 540px) minmax(360px, 420px);
    justify-content: center;
    align-content: center;
    align-items: stretch;
    column-gap: clamp(40px, 5.5vw, 80px);
    row-gap: 0;
    padding: 16px 0 64px;
  }
  .play .slip-wrap { display: flex; min-height: 0; }
  .play .slip {
    --z: 6px;
    padding: 22px 28px calc(26px + var(--z));
    overflow: visible;
  }
  .play > .panel { margin-top: 0; align-self: center; min-width: 0; }

  .ladder { gap: 5px; }
  .ladder i { width: 12px; height: 12px; }
  .theme-line { display: block; margin-top: 6px; font-size: 15px; }

  /* The item card leads the receipt (level with the amount on the right) and the
     bill so far sits at the foot (level with the button). Upcoming lines print as
     blanks, so the receipt keeps its height from item 1 to item 5. */
  .play .card {
    order: 1;
    margin: 8px 0 18px;
    padding-top: 12px;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 24px;
  }
  .play .lines {
    order: 2;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px dashed var(--rule);
  }
  .lines .pending:not(.guessed) { display: grid; }
  .lines:not(:has(> li:not(.pending), > li.guessed)) { display: block; }
  .lines .pending:not(.cur):not(.guessed) { opacity: .5; }
  .ln {
    grid-template-columns: 24px minmax(0, 1fr) auto 30px 9px;
    gap: 8px;
    font-size: 13.5px;
    padding: 5px 0;
  }
  .ln-b, .ln.pending .ln-b { width: 9px; height: 9px; }

  .pic { width: 104px; height: 104px; border-radius: 3px; }
  .pic svg { width: 60px; height: 60px; stroke-width: 1.25; }
  .item-name { margin-top: 6px; font-size: 27px; line-height: 1.18; }
  .info { width: 19px; height: 19px; margin-left: 6px; vertical-align: 4px; font-size: 12px; }
  .about { margin-top: 8px; font-size: 14px; line-height: 1.45; max-width: 46ch; }
  .spec { margin-top: 6px; font-size: 12.5px; }
  .sticker { margin-top: 14px; padding: 5px 11px 6px; font-size: 11px; }
  .sticker b { font-size: 16px; }

  /* Panel */
  .entry { padding: 0; }
  .display {
    height: 64px; line-height: 64px;
    font-size: clamp(22px, calc(100cqw / var(--len, 8) / .6), 50px);
  }
  .words { min-height: 20px; font-size: 13px; margin-top: 2px; }
  .chips { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
  .chip { height: 44px; font-size: 12px; padding: 0 6px; }
  .keys { gap: 10px; margin-top: 14px; }
  .key { height: 54px; font-size: 23px; box-shadow: 0 3px 0 var(--key-shadow); }
  .key svg { width: 24px; height: 24px; }
  .cta { height: 58px; margin-top: 18px; font-size: 14px; }

  /* Reveal fits the same column without scrolling */
  .rv-top .cap { font-size: 11.5px; }
  .price { height: 72px; font-size: 54px; }
  .tape { height: 50px; margin-top: 12px; }
  .tick-l { font-size: 10.5px; }
  .rv-row { margin-top: 16px; }
  .gap-l { font-size: 17px; }
  .gap-l small { font-size: 11px; }
  .score .pts { font-size: 46px; }
  .score .pts small { font-size: 14px; }
  .bandw { font-size: 12px; margin-top: 5px; }
  .bandw i { width: 10px; height: 10px; }
  .fine { font-size: 12px; }
  .fine .fact { font-size: 13.5px; line-height: 1.5; margin-bottom: 4px; }
  .fine button { font-size: 12px; }
  .reveal .fine { padding: 18px 0; }

  /* ---------- Results: receipt left, stats and sharing right ---------- */
  .result {
    flex: 1 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 500px) minmax(0, 440px);
    justify-content: center;
    align-items: start;
    column-gap: clamp(40px, 5.5vw, 80px);
    overflow: visible;
    padding: 16px 0 64px;
  }
  .res-main, .res-side { min-width: 0; }
  .res-side { display: flex; flex-direction: column; gap: 22px; }
  .res-side > * { margin-top: 0; }
  .result .slip { --z: 6px; padding: 28px 30px calc(26px + var(--z)); }
  .bill-head .coin { width: 30px; height: 30px; }
  .bill-shop { font-size: 24px; }
  .cols { font-size: 11px; }
  .rl { padding: 9px 0; }
  .rl-1 { grid-template-columns: 26px minmax(0, 1fr) auto; font-size: 14px; }
  .rl-1 .s i { width: 9px; height: 9px; }
  .rl-2 { grid-template-columns: 26px minmax(0, 1fr) auto; font-size: 12.5px; margin-top: 3px; }
  .total { margin-top: 10px; }
  .tv .k { font-size: 11.5px; }
  .tv .v { font-size: 58px; }
  .tv .v small { font-size: 18px; }
  .stamp { font-size: 18px; padding: 7px 12px 6px; }
  .blocks { gap: 6px; }
  .blocks i { width: 24px; height: 24px; }
  .dir { font-size: 12.5px; }
  .thanks { margin-top: 18px; }
  .practice-mark { font-size: 56px; }

  .share { margin-top: 0; }
  .bubble { font-size: 13.5px; padding: 14px 16px; }
  .row2 { gap: 10px; margin-top: 10px; }
  .ghost { height: 46px; font-size: 12.5px; transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease); }
  .share-bar { position: static; margin-top: 0; padding: 0; background: none; }
  .next { margin-top: 0; padding: 18px 0 0; border-top: 1px dashed var(--rule); }
  .next .clock { font-size: 30px; }
  .links { column-gap: 16px; margin-top: 8px; }
  .links button { font-size: 12.5px; }

  /* ---------- Sheets become centred cards ---------- */
  .scrim { -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .sheet {
    top: 50%; left: 50%; right: auto; bottom: auto;
    width: min(520px, calc(100vw - 64px));
    max-width: none;
    margin: 0;
    max-height: 80vh;
    transform: translate(-50%, -50%);
    animation: sheetPop .26s var(--ease) both;
    filter: drop-shadow(0 18px 36px var(--shadow)) drop-shadow(0 2px 3px var(--shadow));
  }
  .sheet-inner {
    --z: 6px;
    padding: calc(24px + var(--z)) 32px calc(28px + var(--z));
    -webkit-mask:
      conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(2 * var(--z)) 51% repeat-x,
      conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--z)) 51% repeat-x;
            mask:
      conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(2 * var(--z)) 51% repeat-x,
      conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--z)) 51% repeat-x;
  }
  /* With a mouse there is no swipe hint, so show a thin scrollbar on long sheets */
  .sheet-inner { scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
  .sheet-inner::-webkit-scrollbar { display: block; width: 6px; }
  .sheet-inner::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
  .sheet h2 { font-size: 28px; }
  .sheet h3 { font-size: 11px; margin-top: 24px; }
  .sheet p { font-size: 14px; }
  .sheet .muted { font-size: 12.5px; }
  .ex, .bt { font-size: 13.5px; }
  .hrow { grid-template-columns: 170px 1fr 28px; font-size: 12px; }

  .toast { bottom: 32px; font-size: 13px; padding: 11px 16px; }
}
@keyframes sheetPop {
  from { opacity: 0; transform: translate(-50%, -50%) translateY(12px) scale(.97); }
}

/* Small laptops and tablets in landscape: give the receipt the spare width */
@media (min-width: 900px) and (max-width: 1099.98px) {
  .play { grid-template-columns: minmax(0, 1fr) 400px; column-gap: 40px; }
  .result { grid-template-columns: minmax(0, 1fr) minmax(0, 400px); column-gap: 40px; }
}

/* Tall laptop and desktop windows (1440x900, 1920x1080): use the room */
@media (min-width: 900px) and (min-height: 860px) {
  .top { height: 84px; }
  .play { padding-bottom: 84px; }
  .ln { padding: 6px 0; font-size: 14px; }
  .play .card { grid-template-columns: 116px minmax(0, 1fr); gap: 26px; padding-top: 16px; }
  .pic { width: 116px; height: 116px; }
  .pic svg { width: 66px; height: 66px; }
  .item-name { font-size: 30px; }
  .display { height: 76px; line-height: 76px; font-size: clamp(24px, calc(100cqw / var(--len, 8) / .6), 58px); }
  .chip { height: 48px; }
  .keys { gap: 12px; margin-top: 16px; }
  .chips { margin-top: 16px; }
  .key { height: 62px; font-size: 26px; box-shadow: 0 4px 0 var(--key-shadow); }
  .key svg { width: 26px; height: 26px; }
  .key.down { transform: translateY(4px) scale(.97); }
  .cta { height: 62px; margin-top: 20px; }
  .price { height: 80px; font-size: 62px; }
  .score .pts { font-size: 52px; }
}

/* Big screens (1920x1080 and up): scale the whole layout so it does not float in empty space */
@supports (zoom: 1.15) {
  @media (min-width: 1600px) and (min-height: 960px) {
    .app { zoom: 1.15; min-height: calc(100dvh / 1.15); }
  }
}

/* Laptops with short viewports (1366x768 with browser chrome, 1280x720) */
@media (min-width: 900px) and (max-height: 760px) {
  .top { height: 60px; }
  .play { padding: 4px 0 28px; }
  .play .slip { padding: 18px 24px calc(20px + var(--z)); }
  .ln { padding: 2px 0; font-size: 13px; }
  .play .card { margin-bottom: 18px; padding-top: 8px; grid-template-columns: 80px minmax(0, 1fr); gap: 18px; }
  .pic { width: 80px; height: 80px; }
  .pic svg { width: 48px; height: 48px; }
  .item-name { font-size: 23px; }
  .display { height: 54px; line-height: 54px; }
  .chips { margin-top: 10px; }
  .chip { height: 40px; }
  .keys { gap: 8px; margin-top: 10px; }
  .key { height: 46px; font-size: 21px; }
  .cta { height: 52px; margin-top: 14px; }
  .price { height: 62px; font-size: 48px; }
  .tape { margin-top: 6px; }
  .rv-row { margin-top: 10px; }
  .reveal .fine { padding: 12px 0; }
  .result { padding: 4px 0 40px; }
}

/* Keep the receipt in view while the side column scrolls, when the window is tall enough */
@media (min-width: 900px) and (min-height: 800px) {
  .res-main { position: sticky; top: 20px; }
}

/* ---------- Hover: mouse and trackpad only ---------- */
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { background: var(--paper-2); }
  .brand .coin { transition: transform .5s var(--spring); }
  .brand:hover .coin { transform: rotate(-16deg); }

  .chip { transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease); }
  .chip:not([aria-pressed="true"]):hover { background: var(--paper-2); }

  .key { transition: transform .12s var(--ease), box-shadow .12s var(--ease), background-color .15s var(--ease); }
  .key:hover { background: color-mix(in srgb, var(--paper-2) 60%, var(--rule)); }

  .cta { transition: opacity .15s, transform .12s var(--ease), background-color .18s var(--ease), box-shadow .18s var(--ease); }
  .cta:not(:disabled):hover { background: color-mix(in srgb, var(--stamp) 86%, var(--paper)); }

  .ghost:hover { background: var(--paper-2); }
  .info { transition: border-color .15s var(--ease), color .15s var(--ease), background-color .15s var(--ease); }
  .info:not([aria-expanded="true"]):hover { border-color: var(--ink); color: var(--ink); }
  .fine button { transition: color .15s var(--ease); }
  .fine button:hover { color: var(--ink); }
  .links button { transition: text-decoration-color .15s var(--ease); }
  .links button:hover { text-decoration-color: currentColor; }
  .close { border-radius: 50%; transition: background-color .15s var(--ease); }
  .close:hover { background: var(--paper-2); }
  .seg button { transition: background-color .15s var(--ease), color .15s var(--ease); }
  .seg button:not([aria-pressed="true"]):hover { background: var(--paper-2); }
  .arc { transition: background-color .15s var(--ease); }
  .arc:hover { background: var(--paper-2); }
}

/* ---------- Keyboard hints (wide screen, mouse) ---------- */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .chip { display: flex; align-items: center; justify-content: center; gap: 7px; }
  .chip kbd, .cta kbd {
    display: inline-grid;
    place-items: center;
    flex: none;
    min-width: 17px;
    height: 17px;
    padding: 0 3px;
    border: 1px solid currentColor;
    border-radius: 3px;
    font: 500 9.5px/1 var(--mono);
    letter-spacing: 0;
    text-transform: none;
    opacity: .45;
  }
  .chip[aria-pressed="true"] kbd { opacity: .6; }
  .cta kbd { height: 20px; min-width: 22px; margin-left: 2px; opacity: .7; font-size: 11px; }
  .cta:disabled kbd { opacity: .4; }
}

/* Reduced motion: the sheet still appears, just without the lift */
@media (min-width: 900px) and (prefers-reduced-motion: reduce) {
  .sheet { animation-name: fade; }
}
@media (min-width: 900px) {
  :root[data-motion="fast"] .sheet { animation-name: fade; }
}
