:root {
  --paper: #f2efe9;
  --paper-2: #e8e3da;
  --ink: #1d2126;
  --ink-soft: #6b6f75;
  --line: rgba(29, 33, 38, 0.08);
  --accent: #2f6df6;
  --accent-soft: #dbe6ff;
  --glass: rgba(255, 255, 255, 0.74);
  --glass-edge: rgba(255, 255, 255, 0.95);
  --tray: #ebe7df;
  --shadow: 24 22 18;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  background:
    radial-gradient(120% 70% at 50% -10%, #fbfaf7 0%, rgba(251, 250, 247, 0) 60%),
    radial-gradient(90% 60% at 50% 115%, var(--paper-2) 0%, rgba(232, 227, 218, 0) 70%),
    var(--paper);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.48 0 0 0 0 0.45 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.stage {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.2vh, 16px);
  padding: clamp(10px, 3vh, 28px) 14px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.head {
  width: var(--w, 380px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand__mark { width: 22px; height: 22px; fill: var(--accent); }
.brand__wave { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.brand__wave--2 { opacity: 0.4; }
.brand__name { font-weight: 640; font-size: 15px; letter-spacing: -0.01em; font-variation-settings: "wdth" 104; }

.count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 1px var(--line),
    0 6px 14px -8px rgb(var(--shadow) / 0.35);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.count__roll {
  position: relative;
  display: inline-flex;
  height: 18px;
  overflow: hidden;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 0 6px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 6px -2px rgba(47, 109, 246, 0.6);
}
.count__digit { display: inline-block; height: 18px; overflow: hidden; }
.count__digit span { display: block; height: 18px; }

.tray {
  position: relative;
  width: var(--w, 380px);
  height: var(--h, 420px);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.35) 100%),
    var(--tray);
  box-shadow:
    inset 0 2px 6px rgb(var(--shadow) / 0.10),
    inset 0 18px 30px -18px rgb(var(--shadow) / 0.18),
    inset 0 0 0 1px rgba(29, 33, 38, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: hidden;
  isolation: isolate;
}
.tray__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(70% 40% at 50% 0%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.tray__floor {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -18px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(var(--shadow) / 0.10), rgb(var(--shadow) / 0));
  pointer-events: none;
}
.tray__empty {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  opacity: 0;
  pointer-events: none;
}

.hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}

.card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw, 300px);
  height: var(--ch, 66px);
  will-change: transform;
  cursor: grab;
  z-index: 1;
}
.card.is-held { cursor: grabbing; z-index: 30; }
.card__shadow {
  position: absolute;
  inset: 6px 8px -2px;
  border-radius: 18px;
  box-shadow:
    0 1px 2px rgb(var(--shadow) / 0.10),
    0 6px 14px -4px rgb(var(--shadow) / 0.16),
    0 18px 30px -14px rgb(var(--shadow) / 0.22);
  transition: box-shadow 0.25s;
}
.card.is-held .card__shadow {
  box-shadow:
    0 2px 4px rgb(var(--shadow) / 0.10),
    0 14px 26px -6px rgb(var(--shadow) / 0.22),
    0 34px 50px -18px rgb(var(--shadow) / 0.32);
}
.card__body {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 14px 0 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), var(--glass));
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7), 0 0 0 1px rgba(29, 33, 38, 0.06);
}
.card__edge {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  pointer-events: none;
  background: linear-gradient(var(--sheen, 180deg), rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 38%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 1px;
}
.card__icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--i1, #4d86ff), var(--i2, #2f5ee0));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 4px 10px -4px var(--i2, #2f5ee0);
}
.card__icon svg { width: 19px; height: 19px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.card__text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.card__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card__title { font-size: 13.5px; font-weight: 620; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__time { flex: none; font-size: 11px; color: var(--ink-soft); }
.card__line { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}
.pointer path { fill: var(--ink); stroke: #fff; stroke-width: 1.3; stroke-linejoin: round; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
