/* Element Lab */
:root {
  --bg: #0d1b2a;
  --bg2: #13283d;
  --ink: #f3f6fb;
  --dim: #9fb3c8;
  --panel: rgba(16, 32, 50, 0.86);
  --line: rgba(255, 255, 255, 0.12);
  --accent: #ffd166;
  --spring: cubic-bezier(.34, 1.7, .5, 1);
  --c-alkali: #ff6b6b;
  --c-alkaline: #ff9f43;
  --c-transition: #ffd166;
  --c-post: #8fd694;
  --c-metalloid: #4ecdc4;
  --c-nonmetal: #5aa9ff;
  --c-halogen: #a78bfa;
  --c-noble: #e879f9;
  --c-lanthanide: #ff8fab;
  --c-actinide: #fb7185;
  --c-unknown: #b6c2cf;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: Rubik, "Nunito", "Segoe UI", system-ui, sans-serif; overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.screen { position: fixed; inset: 0; display: none; }
.screen.on { display: block; }

/* ---------- table screen ---------- */
#tableScreen {
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(90, 169, 255, .18), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(232, 121, 249, .14), transparent 60%),
    linear-gradient(180deg, #0f2235, #0b1622);
  overflow: auto;
  padding: 18px 22px 22px;
}
#tableScreen::before { /* soft grid */
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
}
.tt-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1500px; margin: 0 auto 14px; }
.logo { display: flex; align-items: center; gap: 14px; }
.logo h1 { margin: 0; font-size: clamp(26px, 3.4vw, 44px); letter-spacing: .06em; font-weight: 800; line-height: 1; }
.logo h1 span { color: var(--accent); }
.logo p { margin: 4px 0 0; color: var(--dim); font-size: clamp(13px, 1.3vw, 16px); }
.atom { position: relative; width: 54px; height: 54px; flex: none; }
.atom i { position: absolute; inset: 0; border: 2.5px solid #7cc4ff; border-radius: 50%; transform: rotate(var(--r)) scaleY(.38); }
.atom i:nth-child(1) { --r: 0deg; } .atom i:nth-child(2) { --r: 60deg; border-color: #ffd166; } .atom i:nth-child(3) { --r: 120deg; border-color: #ff8fab; }
.atom b { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #ffd166 45%, #ff6b6b); box-shadow: 0 0 14px #ffd166; animation: pulse 2s ease-in-out infinite; }
.atom { animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.25); } }
.tt-tools { display: flex; gap: 10px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; transition: transform .35s var(--spring), background .2s; }
.search:focus-within { transform: scale(1.04); background: rgba(255,255,255,.12); }
.search svg { width: 18px; height: 18px; color: var(--dim); }
.search input { background: none; border: 0; outline: 0; color: var(--ink); font: inherit; width: 200px; }
.search input::placeholder { color: #7890a8; }

.ptable {
  position: relative; max-width: min(1500px, calc((100vh - 170px) * 1.6)); margin: 0 auto;
  display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); grid-template-rows: repeat(7, auto) 14px repeat(2, auto);
  gap: clamp(2px, .35vw, 5px);
}
.tile {
  --c: var(--c-unknown);
  position: relative; aspect-ratio: 1 / 1.08; border: 0; padding: 0; border-radius: clamp(4px, .55vw, 9px);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 92%, #fff 8%), color-mix(in srgb, var(--c) 70%, #000 30%));
  color: #10151c; text-align: left; overflow: visible;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 50%, #000 50%), 0 4px 10px rgba(0,0,0,.25);
  transition: transform .45s var(--spring), box-shadow .3s, filter .25s, opacity .25s;
  animation: tileIn .6s var(--spring) backwards; animation-delay: calc(var(--i) * 6ms);
}
@keyframes tileIn { from { transform: scale(.3) translateY(20px); opacity: 0; } }
.tile .num { position: absolute; left: 7%; top: 5%; font-size: clamp(6px, .68vw, 11px); font-weight: 700; opacity: .75; }
.tile .sym { position: absolute; left: 0; right: 0; top: 24%; text-align: center; font-size: clamp(10px, 1.45vw, 25px); font-weight: 800; letter-spacing: -.01em; }
.tile .nm { position: absolute; left: 2%; right: 2%; bottom: 7%; text-align: center; font-size: clamp(5px, .55vw, 9.5px); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.tile .st { position: absolute; right: 7%; top: 6%; width: clamp(4px, .5vw, 8px); height: clamp(4px, .5vw, 8px); border-radius: 50%; }
.tile .st.gas { background: transparent; border: 1.5px solid #10151c; }
.tile .st.liquid { background: #1d6fe0; }
.tile .st.rad { background: #36ff8a; box-shadow: 0 0 6px #36ff8a; }
.tile:hover, .tile:focus-visible { transform: translateY(-6px) scale(1.28) rotate(-2deg); z-index: 5; box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 50%, #000 50%), 0 14px 28px rgba(0,0,0,.45); outline: none; animation: wob .55s ease-out; }
.tile:active { transform: translateY(-2px) scale(1.12, 1.02); transition-duration: .08s; }
@keyframes wob { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-8px) scale(1.34, 1.2) rotate(3deg); } 60% { transform: translateY(-5px) scale(1.22, 1.32) rotate(-4deg); } 80% { transform: translateY(-6px) scale(1.3, 1.26) rotate(-1deg); } 100% { transform: translateY(-6px) scale(1.28) rotate(-2deg); } }
.ptable.filtering .tile:not(.match) { opacity: .16; filter: saturate(.3); }
.ptable.filtering .tile.match { box-shadow: 0 0 0 2px #fff, 0 4px 14px rgba(255,255,255,.3); }
.placeholder { border-radius: 8px; border: 1.5px dashed rgba(255,255,255,.18); display: grid; place-items: center; color: var(--dim); font-size: clamp(6px, .7vw, 11px); font-weight: 700; aspect-ratio: 1 / 1.08; }

.info {
  grid-column: 3 / 13; grid-row: 1 / 4; align-self: stretch; margin: 0 2% 6px;
  display: flex; gap: 18px; align-items: center; padding: 10px 18px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); border: 1px solid var(--line);
  pointer-events: none; min-height: 0; overflow: hidden;
}
.info .big { --c: var(--c-unknown); flex: none; width: clamp(64px, 8vw, 128px); aspect-ratio: 1/1.08; border-radius: 14px; position: relative; color: #10151c;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 92%, #fff 8%), color-mix(in srgb, var(--c) 70%, #000 30%)); box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 50%, #000 50%); animation: pop .5s var(--spring); }
.info .big .num { position: absolute; left: 9%; top: 6%; font-weight: 800; font-size: clamp(10px, 1vw, 16px); }
.info .big .sym { position: absolute; inset: 22% 0 auto; text-align: center; font-weight: 800; font-size: clamp(26px, 3.3vw, 56px); }
.info .big .ms { position: absolute; bottom: 7%; left: 0; right: 0; text-align: center; font-size: clamp(8px, .8vw, 13px); font-weight: 700; opacity: .8; }
.info .txt { min-width: 0; }
.info h2 { margin: 0 0 2px; font-size: clamp(16px, 2vw, 30px); }
.info .cat { display: inline-block; font-size: clamp(9px, .85vw, 13px); font-weight: 700; padding: 2px 10px; border-radius: 99px; color: #10151c; margin-bottom: 6px; }
.info p { margin: 0; color: #d7e2ee; font-size: clamp(10px, 1vw, 15px); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.info .welcome h2 { color: var(--accent); }
@keyframes pop { from { transform: scale(.6) rotate(-8deg); } }

.legend { position: relative; max-width: 1500px; margin: 14px auto 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { --c: #fff; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.05); font-size: 13px; font-weight: 600; transition: transform .4s var(--spring), background .2s; }
.chip::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: var(--c); }
.chip:hover, .chip.on { transform: translateY(-3px) scale(1.08); background: rgba(255,255,255,.13); }
.chip.key::before { display: none; }
.chip.key i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------- lab ---------- */
#labScreen { background: #0b1520; touch-action: none; }
#lab { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: default; }
#lab.can-grab { cursor: grab; }
#lab.grabbing { cursor: grabbing; }
.hud-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; z-index: 3; }
.hud-top > * { pointer-events: auto; }
.hud-right { display: flex; gap: 8px; }
.pill, .iconbtn {
  border: 0; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(6px);
  height: 44px; border-radius: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px 0 10px; font-weight: 700;
  box-shadow: 0 4px 0 rgba(0,0,0,.35); transition: transform .4s var(--spring), background .2s, box-shadow .2s;
}
.iconbtn { width: 44px; padding: 0; justify-content: center; }
.pill svg, .iconbtn svg { width: 22px; height: 22px; }
.pill:hover, .iconbtn:hover { transform: translateY(-3px) scale(1.07) rotate(-2deg); background: rgba(40, 70, 100, .95); }
.pill:active, .iconbtn:active { transform: translateY(1px) scale(.92, 1.04); box-shadow: 0 1px 0 rgba(0,0,0,.35); transition-duration: .08s; }
.iconbtn.on { background: #ffd166; color: #10151c; }
.mute::before { content: ""; width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat;
  --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9z'/%3E%3Cpath d='M16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12'/%3E%3C/svg%3E"); }
.mute.off::before { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9z'/%3E%3Cpath d='M17 9l5 6M22 9l-5 6'/%3E%3C/svg%3E"); }
#tableScreen .iconbtn { height: 40px; width: 40px; }

.card {
  position: absolute; left: 12px; top: 66px; width: 300px; max-height: calc(100% - 66px - 130px); overflow: auto; z-index: 3;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(8px);
  padding: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.35); transition: transform .45s var(--spring), opacity .3s;
  scrollbar-width: thin;
}
.card.min { transform: translateX(-252px); }
.card.min > *:not(.c-head) { opacity: 0; pointer-events: none; }
.card .c-head { display: flex; gap: 12px; align-items: center; }
.card .big { --c: var(--c-unknown); flex: none; width: 74px; aspect-ratio: 1/1.08; border-radius: 12px; position: relative; color: #10151c;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 92%, #fff 8%), color-mix(in srgb, var(--c) 70%, #000 30%)); box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 50%, #000 50%); }
.card .big .num { position: absolute; left: 8%; top: 5%; font-weight: 800; font-size: 11px; }
.card .big .sym { position: absolute; inset: 20% 0 auto; text-align: center; font-weight: 800; font-size: 32px; }
.card .big .ms { position: absolute; bottom: 6%; left: 0; right: 0; text-align: center; font-size: 9px; font-weight: 700; opacity: .8; }
.card h2 { margin: 0; font-size: 22px; line-height: 1.1; }
.card .cat { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 99px; color: #10151c; margin-top: 5px; }
.card .minbtn { margin-left: auto; align-self: flex-start; width: 30px; height: 30px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); display: grid; place-items: center; transition: transform .35s var(--spring); }
.card .minbtn:hover { transform: scale(1.15); }
.card .minbtn svg { width: 16px; height: 16px; transition: transform .3s; }
.card.min .minbtn svg { transform: rotate(180deg); }
.card .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0 10px; }
.card .f { background: rgba(255,255,255,.05); border-radius: 10px; padding: 6px 8px; }
.card .f b { display: block; font-size: 10px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.card .f span { font-size: 13px; font-weight: 700; }
.card .f.wide { grid-column: 1 / -1; }
.bar { height: 7px; border-radius: 9px; background: rgba(255,255,255,.1); margin-top: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, #4ecdc4, #ffd166); }
.card .fact { font-size: 13.5px; line-height: 1.4; color: #e3ecf5; background: rgba(255, 209, 102, .09); border-left: 3px solid var(--accent); padding: 8px 10px; border-radius: 0 10px 10px 0; margin: 0 0 10px; }
.card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 12px 0 6px; }
.card ul { margin: 0; padding: 0; list-style: none; }
.card li { font-size: 13px; line-height: 1.35; padding: 5px 0 5px 24px; position: relative; color: #d7e2ee; }
.card li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 13px; height: 13px; border-radius: 5px; border: 2px solid #5a7590; }
.card li.done { color: #9fe6b0; }
.card li.done::before { background: #39d98a; border-color: #39d98a; }
.card li.done::after { content: ""; position: absolute; left: 7px; top: 9px; width: 4px; height: 7px; border: solid #0d1b2a; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.card .uses { font-size: 12.5px; color: var(--dim); line-height: 1.4; }
.card .disc { display: flex; flex-wrap: wrap; gap: 5px; }
.card .disc span { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: rgba(57, 217, 138, .16); color: #9fe6b0; animation: pop .5s var(--spring); }
.card .disc em { font-size: 12px; color: var(--dim); }

.toasts { position: absolute; top: 66px; left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 640px)); min-width: 300px; z-index: 4; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { --c: #ffd166; display: flex; gap: 10px; align-items: flex-start; background: rgba(12, 24, 38, .93); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 14px; padding: 10px 14px; box-shadow: 0 10px 26px rgba(0,0,0,.4);
  animation: toastIn .55s var(--spring); transition: opacity .5s, transform .5s; }
.toast.out { opacity: 0; transform: translateY(-14px) scale(.95); }
.toast .ic { font-size: 22px; line-height: 1; flex: none; margin-top: 2px; }
.toast .tt { display: block; font-size: 14.5px; margin-bottom: 2px; color: var(--c); }
.toast span b { color: #fff; }
.toast span { font-size: 13px; line-height: 1.38; color: #dbe6f1; }
.toast sub { font-size: 70%; }
@keyframes toastIn { from { transform: translateY(-24px) scale(.8); opacity: 0; } }

.hovertip { position: absolute; z-index: 5; pointer-events: none; background: rgba(8, 16, 26, .92); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 12.5px; line-height: 1.35; opacity: 0; transform: translateY(6px) scale(.95); transition: opacity .15s, transform .25s var(--spring); white-space: nowrap; }
.hovertip.on { opacity: 1; transform: none; }
.hovertip b { color: var(--accent); }

.trash { position: absolute; right: 14px; bottom: 132px; width: 58px; height: 58px; border-radius: 18px; background: rgba(255, 90, 90, .12); border: 2px dashed rgba(255, 120, 120, .4); display: grid; place-items: center; color: #ff9a9a; z-index: 3; transition: transform .4s var(--spring), background .2s; opacity: 0; pointer-events: none; }
.trash svg { width: 28px; height: 28px; }
.trash.show { opacity: 1; }
.trash.hot { transform: scale(1.25) rotate(-8deg); background: rgba(255, 90, 90, .35); }

.tray {
  position: absolute; left: 0; right: 0; bottom: 0; height: 118px; z-index: 3; display: flex; gap: 6px; align-items: stretch;
  padding: 10px 12px 12px; overflow-x: auto; overflow-y: hidden;
  background: linear-gradient(180deg, rgba(10, 20, 32, .0), rgba(10, 20, 32, .9) 22%); scrollbar-width: thin;
}
.tgroup { display: flex; flex-direction: column; flex: none; }
.tgroup > h4 { margin: 0 0 4px 4px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.tgroup > div { display: flex; gap: 6px; flex: 1; }
.tsep { width: 1px; background: var(--line); margin: 18px 6px 4px; flex: none; }
.tbtn {
  position: relative; width: 78px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, rgba(40, 64, 90, .9), rgba(22, 40, 60, .95));
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 2px 3px 5px; box-shadow: 0 4px 0 rgba(0,0,0,.4);
  transition: transform .45s var(--spring), box-shadow .2s, background .2s; touch-action: none;
}
.tbtn canvas { width: 62px; height: 46px; flex: none; pointer-events: none; }
.tbtn span { font-size: 11px; font-weight: 700; line-height: 1.1; text-align: center; pointer-events: none; }
.tbtn:hover { transform: translateY(-7px) scale(1.08) rotate(-2deg); background: linear-gradient(180deg, rgba(60, 94, 128, .95), rgba(30, 54, 80, .95)); animation: twob .5s ease-out; }
.tbtn:active { transform: translateY(0) scale(.9, 1.05); box-shadow: 0 1px 0 rgba(0,0,0,.4); transition-duration: .08s; animation: none; }
@keyframes twob { 0% { transform: none; } 40% { transform: translateY(-9px) scale(1.14, 1.0) rotate(3deg); } 70% { transform: translateY(-6px) scale(1.04, 1.12) rotate(-3deg); } 100% { transform: translateY(-7px) scale(1.08) rotate(-2deg); } }
.tbtn.el { --c: #fff; }
.tbtn.el::after { content: attr(data-sym); position: absolute; top: 4px; right: 5px; font-size: 9.5px; font-weight: 800; padding: 1px 4px; border-radius: 5px; background: var(--c); color: #10151c; pointer-events: none; }
.hint { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); font-size: 13px; color: var(--dim); background: rgba(8, 16, 26, .75); padding: 6px 14px; border-radius: 99px; z-index: 2; pointer-events: none; transition: opacity 1s; white-space: nowrap; }
.hint.gone { opacity: 0; }

.wipe { position: fixed; inset: 0; z-index: 50; pointer-events: none; background: var(--c, #ffd166); clip-path: circle(0% at var(--x, 50%) var(--y, 50%)); }
.wipe.go { transition: clip-path .5s cubic-bezier(.7, 0, .3, 1); clip-path: circle(150% at var(--x, 50%) var(--y, 50%)); }
.wipe.back { transition: clip-path .45s cubic-bezier(.7, 0, .3, 1); clip-path: circle(0% at var(--x, 50%) var(--y, 50%)); }
.wipe .wsym { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 160px; font-weight: 800; color: rgba(16, 21, 28, .85); }

@media (max-width: 900px) {
  .card { width: 250px; font-size: 12px; }
  .card.min { transform: translateX(-202px); }
  .toasts { width: calc(100% - 24px); min-width: 0; top: auto; bottom: 130px; }
  .search input { width: 120px; }
  .info p { -webkit-line-clamp: 2; }
}
@media (max-width: 640px) {
  #tableScreen { padding: 10px; }
  .ptable { min-width: 760px; }
  .tt-head { flex-wrap: wrap; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tile, .tbtn, .pill, .iconbtn, .chip { transition-duration: .01s; animation: none !important; }
  .atom { animation: none; }
}

/* ---------- v2: readable toasts, tasks, element picker, machines ---------- */
.toast { position: relative; overflow: hidden; pointer-events: auto; cursor: pointer; }
.toast:hover { border-color: rgba(255,255,255,.28); }
.toast .tbar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--c); opacity: .55; transform-origin: left; animation: tbar linear forwards; }
.toast.held .tbar { animation-play-state: paused; }
@keyframes tbar { to { transform: scaleX(0); } }
/* notes: a quiet collapsible column on the far right */
.notes { position: absolute; right: 12px; top: 66px; width: 300px; z-index: 4; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; }
.notes-btn { pointer-events: auto; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(12, 24, 38, .8); color: var(--dim); font-size: 12.5px; transition: transform .35s var(--spring), background .2s; }
.notes-btn:hover { transform: translateY(-2px) scale(1.05); background: rgba(30, 54, 80, .9); color: var(--ink); }
.notes-btn svg { width: 14px; height: 14px; transform: rotate(90deg); transition: transform .3s; }
.notes.min .notes-btn svg { transform: rotate(-90deg); }
.notes-btn .cnt:empty { display: none; }
.notes-btn .cnt { min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: #1a1406; font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 5px; }
.notes.ping .notes-btn { animation: ping 1.6s ease-in-out infinite; color: var(--ink); }
@keyframes ping { 50% { transform: scale(1.08) rotate(-3deg); } }
.notes .toasts { position: static; transform: none; width: 100%; min-width: 0; top: auto; left: auto; }
.notes.min .toasts { display: none; }
.notes .toast { padding: 8px 11px; gap: 8px; border-radius: 12px; background: rgba(12, 24, 38, .82); box-shadow: 0 6px 16px rgba(0,0,0,.3); }
.notes .toast .ic { font-size: 17px; }
.notes .toast .tt { font-size: 13px; }
.notes .toast span { font-size: 12px; line-height: 1.35; }

.card .tasks { margin: 12px 0 4px; padding: 10px 12px 8px; border-radius: 14px; background: rgba(57, 217, 138, .08); border: 1px solid rgba(57, 217, 138, .25); }
.card .t-head { display: flex; align-items: baseline; justify-content: space-between; }
.card .t-head h3 { margin: 0; color: #7dffb4; font-size: 13px; }
.card .t-head .prog { font-size: 13px; font-weight: 800; color: #7dffb4; }
.card .tprog { height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); margin: 6px 0 4px; overflow: hidden; }
.card .tprog i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #39d98a, #a6ff6b); transition: width .6s var(--spring); }
.card .tasks li { font-size: 14px; font-weight: 600; padding: 6px 0 6px 28px; color: #e6eef6; }
.card .tasks li::before { width: 15px; height: 15px; top: 7px; border-radius: 6px; }
.card .tasks li.done { color: #9fe6b0; text-decoration: line-through; text-decoration-color: rgba(159, 230, 176, .5); }
.card .tasks li.done::after { left: 8px; top: 9px; }
.card .tasks li.just { animation: tdone .7s var(--spring); }
@keyframes tdone { 0% { transform: scale(1); } 35% { transform: scale(1.12) rotate(-2deg); background: rgba(57,217,138,.25); } 100% { transform: none; } }
.card .ideas li::before { content: "•"; border: 0; width: auto; height: auto; top: 4px; left: 8px; color: var(--accent); }

.tbtn { width: 72px; }
.tbtn.addel { width: 82px; justify-content: center; gap: 2px; background: linear-gradient(180deg, #ffd166, #f4a93a); color: #2a1a00; border-color: #ffe39a; }
.tbtn.addel b { font-size: 34px; line-height: 1; font-weight: 800; }
.tbtn.addel span { font-size: 12px; }
.tbtn.addel:hover, .tbtn.addel.on { background: linear-gradient(180deg, #ffe08a, #ffbb4a); }
.tbtn.addel.on { box-shadow: 0 0 0 3px rgba(255, 209, 102, .5), 0 4px 0 rgba(0,0,0,.4); }
.tbtn.mach { background: linear-gradient(180deg, rgba(110, 60, 140, .9), rgba(54, 30, 80, .95)); }

.picker { position: absolute; left: 50%; bottom: 128px; z-index: 6; width: min(640px, calc(100% - 24px)); padding: 10px 12px 12px; border-radius: 18px;
  background: rgba(10, 22, 36, .96); border: 1px solid rgba(255, 209, 102, .35); box-shadow: 0 18px 50px rgba(0,0,0,.55); backdrop-filter: blur(10px);
  transform: translate(-50%, 30px) scale(.9); opacity: 0; pointer-events: none; transition: transform .45s var(--spring), opacity .2s; }
.picker.on { transform: translate(-50%, 0) scale(1); opacity: 1; pointer-events: auto; }
.pk-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pk-head > b { font-size: 15px; color: var(--accent); flex: none; }
.pk-head span { flex: 1; font-size: 12.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-head span b { color: #fff; }
.pk-head input { width: 130px; background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px; color: var(--ink); font: inherit; font-size: 13px; outline: 0; }
.pk-x { width: 30px; height: 30px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); transition: transform .35s var(--spring); }
.pk-x:hover { transform: scale(1.15) rotate(8deg); }
.pk-grid { display: grid; grid-template-columns: repeat(18, 1fr); grid-template-rows: repeat(7, auto) 6px repeat(2, auto); gap: 2px; }
.pk { aspect-ratio: 1; border: 0; padding: 0; border-radius: 5px; font-size: 11.5px; font-weight: 800; color: #10151c; touch-action: none;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 92%, #fff 8%), color-mix(in srgb, var(--c) 70%, #000 30%)); transition: transform .35s var(--spring), opacity .2s, filter .2s; }
.pk:hover { transform: scale(1.45); z-index: 2; position: relative; box-shadow: 0 4px 12px rgba(0,0,0,.5); filter: brightness(1.12); }
.pk:active { transform: scale(1.15); }
.pk.dim { opacity: .15; }
.pk.pop { animation: pkpop .5s var(--spring); }
@keyframes pkpop { 40% { transform: scale(1.7) rotate(-8deg); } }
.pk-gap { grid-row: 8; grid-column: 1 / -1; }

.pill.games { text-decoration: none; color: var(--ink); flex: none; }
#tableScreen .pill.games { height: 40px; }

/* Tray on narrower screens: slightly smaller buttons, wheel scrolls sideways, arrows show there is more */
@media (max-width: 1500px) {
  .tbtn { width: 64px; }
  .tbtn canvas { width: 56px; height: 42px; }
  .tbtn.addel { width: 76px; }
  .tray { gap: 4px; }
  .tgroup > div { gap: 5px; }
  .tsep { margin: 18px 3px 4px; }
}
.tray-arrow { position: absolute; bottom: 38px; z-index: 4; width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255, 209, 102, .5);
  background: rgba(16, 32, 50, .94); color: var(--accent); font: 800 22px/1 Rubik, "Nunito", "Segoe UI", system-ui, sans-serif; cursor: pointer;
  display: none; place-items: center; padding: 0 0 3px; box-shadow: 0 4px 14px rgba(0,0,0,.45); transition: transform .45s var(--spring), opacity .2s; }
.tray-arrow.on { display: grid; animation: arrowNudge 2.4s ease-in-out infinite; }
.tray-arrow.l { left: 4px; } .tray-arrow.r { right: 4px; }
.tray-arrow:hover { transform: translateY(-3px) scale(1.12) rotate(-2deg); animation: none; }
.tray-arrow:active { transform: scale(.9); }
@keyframes arrowNudge { 0%, 100% { translate: 0 0; } 50% { translate: 3px 0; } }
.tray-arrow.l.on { animation-direction: reverse; }
