/* floppydisk.in – platform UI */

:root {
  --bg: #F4EEE3; --surface: #EAE1D2; --line: #D9CDB9; --ink: #1F1B16; --muted: #675D52; --paper: #FFFCF6;
  --accent: #FF5A00; --accent-hover: #FF7426; --danger: #B92D00;
  --gutter: clamp(16px, 5vw, 72px);
  --dw: clamp(150px, 14vw, 210px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --noise: 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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body.playing { overflow: hidden; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
code { font: 600 .92em ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------------------------------------------------------------- buttons */

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border: 0; border-radius: 999px; background: transparent; font-weight: 650; font-size: 15px; line-height: 1.2; white-space: nowrap; cursor: pointer; transition: background-color .15s, box-shadow .15s, transform .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--accent); color: var(--ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost:hover { background: var(--surface); }
.btn.outline { box-shadow: inset 0 0 0 2px var(--ink); }
.btn.outline:hover { background: var(--ink); color: var(--bg); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #9C2600; }

/* ---------------------------------------------------------------- top bar + hero */

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px var(--gutter); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 800; font-size: 21px; letter-spacing: -.035em; }
.brand-mark { position: relative; width: 24px; height: 24px; border-radius: 4px; background: var(--accent); clip-path: polygon(0 0, 80% 0, 100% 20%, 100% 100%, 0 100%); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: var(--bg); }
.brand-mark::before { left: 30%; width: 38%; top: 0; height: 30%; border-radius: 0 0 2px 2px; }
.brand-mark::after { left: 13%; right: 13%; bottom: 0; height: 46%; border-radius: 2px 2px 0 0; }
.bar, .account { display: flex; align-items: center; gap: 8px; }
.who { display: inline-flex; align-items: center; gap: 8px; margin-right: 4px; font-weight: 750; letter-spacing: .04em; }
button.who { padding: 4px 8px 4px 4px; border: 0; border-radius: 999px; background: none; color: inherit; font: inherit; font-weight: 750; letter-spacing: .04em; cursor: pointer; }
button.who:hover, button.who:focus-visible { background: rgb(31 27 22 / .07); }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 13px; }
.badge { padding: 2px 8px; border-radius: 999px; background: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

main { flex: 1; display: flex; flex-direction: column; }
.hero { margin: clamp(8px, 4vh, 48px) var(--gutter) clamp(20px, 5vh, 56px); font-size: clamp(44px, 8.4vw, 128px); font-weight: 850; line-height: .92; letter-spacing: -.055em; }
.hero em { font-style: normal; color: var(--accent); white-space: nowrap; }

/* ---------------------------------------------------------------- shelf
   Fixed-height rows; each row's background draws one shelf board. */

.shelf {
  --row: calc(var(--dw) * 94 / 90 + 72px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(var(--dw) + 40px), 1fr));
  grid-auto-rows: var(--row);
  margin: 0 var(--gutter) 56px;
  padding: 0;
  list-style: none;
  background: linear-gradient(to bottom, transparent calc(100% - 36px),
    #D8C9AF calc(100% - 36px), #E4D7C2 calc(100% - 24px), #F4ECDF calc(100% - 24px) calc(100% - 23px),
    #CFBDA0 calc(100% - 23px) calc(100% - 11px), #B9A586 calc(100% - 11px) calc(100% - 10px),
    rgb(31 27 22 / .14) calc(100% - 10px), transparent);
  background-size: 100% var(--row);
}
.slot { position: relative; display: flex; justify-content: center; align-items: flex-end; padding-bottom: 29px; }
.slot.is-out .disk { visibility: hidden; }
.disk { position: relative; display: block; width: var(--dw); padding: 0; border: 0; background: none; cursor: pointer; border-radius: 6px; animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.disk:focus-visible { outline-offset: 10px; --rx: 10deg; --ry: -26deg; }
.slot.is-new .disk { animation: drop-in .8s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-80px); } 60% { opacity: 1; } }
.d-shadow { position: absolute; left: 4%; right: 4%; bottom: -7px; height: 14px; border-radius: 50%; background: radial-gradient(closest-side, rgb(31 27 22 / .4), transparent); transition: transform .4s var(--ease), opacity .4s; }
.disk:hover .d-shadow, .disk:focus-visible .d-shadow { transform: scale(.85); opacity: .6; }

.live { position: absolute; left: 50%; bottom: 8px; display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 7px; border-radius: 999px; background: var(--paper); box-shadow: 0 1px 2px rgb(31 27 22 / .25); font-size: 11px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; transform: translateX(-50%); }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
.live.bump { animation: bump .5s var(--ease); }
/* scheduled floppy (release= in META.INI): greyed out with a countdown */
.slot.locked .disk { cursor: default; }
.slot.locked .disk3d { filter: grayscale(1) contrast(.9) opacity(.55); }
.soon { position: absolute; left: 50%; bottom: 8px; padding: 1px 9px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .03em; white-space: nowrap; transform: translateX(-50%); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(255 90 0 / .55); } 70%, 100% { box-shadow: 0 0 0 6px rgb(255 90 0 / 0); } }
@keyframes bump { 40% { transform: translateX(-50%) scale(1.18); } }

.del { position: absolute; top: 12px; left: 50%; z-index: 2; display: grid; place-items: center; width: 32px; height: 32px; margin-left: calc(var(--dw) / -2 - 10px); border: 0; border-radius: 50%; background: var(--ink); color: var(--bg); cursor: pointer; opacity: 0; transition: opacity .2s, background-color .15s; }
.slot:hover .del, .slot:focus-within .del { opacity: 1; }
.del:hover { background: var(--danger); }
.edit { position: absolute; top: 52px; left: 50%; z-index: 2; display: grid; place-items: center; width: 32px; height: 32px; margin-left: calc(var(--dw) / -2 - 10px); padding: 0; border: 0; border-radius: 50%; background: var(--ink); color: var(--bg); cursor: pointer; opacity: 0; transition: opacity .2s, background-color .15s; }
.slot:hover .edit, .slot:focus-within .edit { opacity: 1; }
.edit:hover, .edit:focus-visible { background: var(--accent); }
.dl { position: absolute; top: 12px; left: 50%; z-index: 2; display: grid; place-items: center; width: 32px; height: 32px; margin-left: calc(var(--dw) / 2 - 22px); border-radius: 50%; background: var(--ink); color: var(--bg); opacity: 0; transition: opacity .2s, background-color .15s; }
.slot:hover .dl, .slot:focus-within .dl { opacity: 1; }
.dl { padding: 0; border: 0; cursor: pointer; }
.dl:hover, .dl:focus-visible, .dl[aria-expanded="true"] { background: var(--accent); }
.slot:has(.dl[aria-expanded="true"]) .dl { opacity: 1; }
/* download fan (shelf + player): two round icon buttons fold out below
   the download button – whole disk (.img) or just the page (.htm) */
.dlfan { position: fixed; z-index: 70; display: grid; gap: 8px; justify-items: center; }
.dlfan a { display: grid; place-items: center; width: var(--s); height: var(--s); border-radius: 50%; background: var(--ink); color: var(--bg); box-shadow: 0 2px 8px rgb(31 27 22 / .3); animation: fan-in .24s var(--ease) both; transition: background-color .15s, color .15s; }
.dlfan a:nth-child(2) { animation-delay: .05s; }
.dlfan a:hover, .dlfan a:focus-visible { background: var(--accent); outline: none; }
.dlfan.big a { background: rgb(255 252 246 / .86); color: #1F1B16; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 2px 10px rgb(31 27 22 / .2); }
.dlfan.big a:hover, .dlfan.big a:focus-visible { background: rgb(255 252 246); color: var(--accent); }
body.player-dark .dlfan.big a { background: rgb(18 14 26 / .72); color: #F4EEE3; box-shadow: 0 0 0 1px rgb(255 255 255 / .12), 0 2px 10px rgb(0 0 0 / .4); }
@keyframes fan-in { from { opacity: 0; transform: translateY(-12px) scale(.5); } }
@media (prefers-reduced-motion: reduce) { .dlfan a { animation: none; } }

@media (hover: none) { .dl { width: 28px; height: 28px; opacity: .7; } }
@media (hover: none) { .del, .edit { width: 28px; height: 28px; opacity: .7; } .edit { top: 46px; } }

/* ---------------------------------------------------------------- the 3D floppy
   .disk3d (perspective) > .d-rot (preserve-3d box): front, back, 5 edges.
   Sizes in cqw of the disk width; thickness 4cqw, chamfer 6.5cqw. */

.disk3d { --disk: #2A2622; --edge: color-mix(in srgb, var(--disk) 70%, #000); position: relative; display: block; width: 100%; aspect-ratio: 90 / 94; container-type: inline-size; perspective: 1000px; text-align: left; }
.d-rot { position: absolute; inset: 0; transform-style: preserve-3d; transform: translateY(var(--lift, 0px)) rotateX(var(--rx, 4deg)) rotateY(var(--ry, -14deg)); transition: transform .7s var(--ease); }
.disk:hover .d-rot, .disk:focus-visible .d-rot { --lift: -12px; transition-duration: .25s; }
.disk3d span { position: absolute; display: block; }

.d-front, .d-back {
  inset: 0;
  border-radius: 3cqw;
  backface-visibility: hidden;
  background: var(--noise), linear-gradient(165deg, rgb(255 255 255 / .17), transparent 32%, rgb(0 0 0 / .2)), var(--disk);
  box-shadow: inset 0 0 0 .3cqw rgb(255 255 255 / .06), inset 0 -.8cqw 1cqw rgb(0 0 0 / .2);
}
.d-front { transform: translateZ(2cqw); clip-path: polygon(0 0, calc(100% - 6.5cqw) 0, 100% 6.5cqw, 100% 100%, 0 100%); }
.d-back { transform: rotateY(180deg) translateZ(2cqw); clip-path: polygon(0 6.5cqw, 6.5cqw 0, 100% 0, 100% 100%, 0 100%); }
.d-front::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at var(--gx, 22%) var(--gy, 12%), rgb(255 255 255 / .2), transparent 58%); pointer-events: none; }

.edge { background: linear-gradient(to bottom, var(--edge) 42%, color-mix(in srgb, var(--edge) 70%, #000) 42% 58%, var(--edge) 58%); }
.e-top { left: 0; top: -2cqw; width: calc(100% - 6.5cqw); height: 4cqw; transform: rotateX(90deg); filter: brightness(1.35); }
.e-cham { left: calc(100% - 7.85cqw); top: 1.25cqw; width: 9.19cqw; height: 4cqw; transform: rotateZ(45deg) rotateX(90deg); filter: brightness(1.2); }
.e-bottom { left: 0; bottom: -2cqw; width: 100%; height: 4cqw; transform: rotateX(-90deg); filter: brightness(.8); }
.e-left, .e-right { width: 4cqw; background: linear-gradient(to right, var(--edge) 42%, color-mix(in srgb, var(--edge) 70%, #000) 42% 58%, var(--edge) 58%); }
.e-left { top: 0; left: -2cqw; height: 100%; transform: rotateY(-90deg); }
.e-right { top: 6.5cqw; right: -2cqw; height: calc(100% - 6.5cqw); transform: rotateY(90deg); filter: brightness(1.1); }

.track { left: 19.5%; width: 63.5%; top: 0; height: 38.5%; border-radius: 0 0 1.6cqw 1.6cqw; background: rgb(0 0 0 / .22); box-shadow: inset 0 .6cqw 1.2cqw rgb(0 0 0 / .4); }
.shutter { left: 36%; width: 44%; top: 0; height: 36.5%; border-radius: 0 0 1.1cqw 1.1cqw; box-shadow: 0 .4cqw .8cqw rgb(0 0 0 / .45), inset 0 -.3cqw 0 rgb(0 0 0 / .12); transition: transform .55s var(--ease);
  background: repeating-linear-gradient(0deg, rgb(255 255 255 / .09) 0 .35cqw, rgb(0 0 0 / .05) .35cqw .7cqw), linear-gradient(90deg, #969BA1, #DADEE2 20%, #F7F8F9 40%, #C5CAD0 66%, #9EA3AA); }
.window { left: 56%; width: 22%; top: 15%; height: 66%; border-radius: .8cqw; background: var(--disk); box-shadow: inset 0 .4cqw .8cqw rgb(0 0 0 / .6); transition: background .55s var(--ease); }
/* closed: the shutter's window sits right of centre over plastic; open: it
   slides left until the window is on the centre line, where the heads read */
.disk:hover .d-front .shutter, .disk:focus-visible .d-front .shutter { transform: translateX(-35.2%); }
.disk:hover .d-back .shutter, .disk:focus-visible .d-back .shutter { transform: translateX(35.2%); }
.disk:hover .window, .disk:focus-visible .window { background: linear-gradient(90deg, #2E2016, #73502F 45%, #4A3220 70%, #2E2016); }
.arrow { left: 6%; top: 4.5%; border: 2.4cqw solid transparent; border-top: 0; border-bottom: 3.4cqw solid rgb(255 255 255 / .2); }
.wp, .hd { bottom: 4%; width: 6.4%; aspect-ratio: 1; border-radius: .8cqw; background: rgb(0 0 0 / .55); box-shadow: inset 0 .4cqw .6cqw rgb(0 0 0 / .6); }
.wp { left: 3.2%; overflow: hidden; }
.wp span { position: absolute; left: 0; right: 0; bottom: 0; height: 52%; background: rgb(255 255 255 / .18); }
.hd { right: 3.2%; }
.light .arrow { border-bottom-color: rgb(0 0 0 / .18); }
.light .wp, .light .hd { background: rgb(0 0 0 / .38); }

/* back: mirrored plate, plus the metal hub */
.d-back .track { left: 17%; }
.d-back .shutter { left: 20%; }
.d-back .window { left: 22%; }
.d-back .wp { left: auto; right: 3.2%; }
.d-back .hd { right: auto; left: 3.2%; }
.hub { left: 35%; top: 45%; width: 30%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #5B3E27 0 62%, rgb(0 0 0 / .45) 64%, transparent 70%); }
.hub span { position: absolute; inset: 17%; border-radius: 50%; background: conic-gradient(from 20deg, #B4BAC0, #F3F5F6, #A3A9AF, #E6E9EC, #B4BAC0); box-shadow: 0 .3cqw .6cqw rgb(0 0 0 / .5); }
.hub span::before, .hub span::after { content: ""; position: absolute; background: #1C1612; border-radius: .4cqw; }
.hub span::before { left: 40%; top: 40%; width: 20%; height: 20%; }
.hub span::after { left: 66%; top: 26%; width: 13%; height: 20%; }

/* label sticker */
.label { left: 12.5%; right: 12.5%; top: 44%; bottom: 0; display: flex !important; flex-direction: column; gap: 1.4cqw; padding: 4.2cqw 4.2cqw 3.4cqw; overflow: hidden; border-radius: 1.6cqw 1.6cqw 0 0;
  background: var(--noise), linear-gradient(180deg, #FFFDF8, var(--paper) 55%, #F3EBDD); box-shadow: 0 -.2cqw .8cqw rgb(0 0 0 / .3); }
.d-front .label > span { position: static; }
.art { position: relative !important; flex: 1; min-height: 0; overflow: hidden; border-radius: .8cqw; background: var(--paper); }
.art img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; mix-blend-mode: multiply; }
.ph { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 2.4cqw 3.2cqw; color: var(--ink);
  background: radial-gradient(circle at 80% 32%, hsl(var(--h) 90% 60%) 0 17%, transparent 17.5%), repeating-linear-gradient(-45deg, hsl(var(--h) 55% 86%) 0 2.2cqw, hsl(var(--h) 50% 80%) 2.2cqw 4.4cqw); }
.ph b { font-size: 12cqw; font-weight: 850; line-height: .9; letter-spacing: -.06em; }
.title { padding-bottom: 1.1cqw; border-bottom: 1px solid rgb(31 27 22 / .12); color: var(--ink); font-size: 7cqw; font-weight: 780; line-height: 1.15; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.author { color: var(--muted); font-size: 4.8cqw; font-weight: 650; line-height: 1.2; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- empty */

.empty { margin: 0 auto auto; padding: 24px var(--gutter) 64px; text-align: center; }
.empty h2 { margin: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; }
.empty p { margin: 8px auto 0; color: var(--muted); }
.empty .btn { margin-top: 18px; }

/* ---------------------------------------------------------------- player */

.player { position: fixed; inset: 0; z-index: 50; background: var(--player-bg, rgb(244 238 227 / .74)); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); opacity: 0; transition: opacity .4s var(--ease); }
.player.open { opacity: 1; }
.player.dark .status { color: #f4eee3; }
.player.dark .status p { color: rgb(244 238 227 / .7); }
.player.dark .screen { box-shadow: 0 0 0 1px rgb(255 255 255 / .08), 0 30px 80px rgb(0 0 0 / .5); }
.screen { position: absolute; inset: 12px; overflow: hidden; border-radius: 18px; background: var(--player-bg, #fff); box-shadow: 0 0 0 1px rgb(31 27 22 / .08), 0 30px 80px rgb(31 27 22 / .25); transform: scale(.97); transition: transform .5s var(--ease); }
.player.open .screen { transform: none; }
.screen iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.status { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 24px; background: var(--player-bg, var(--paper)); text-align: center; opacity: 0; visibility: hidden; transition: opacity .25s, visibility 0s .25s; }
.status.on { opacity: 1; visibility: visible; transition-delay: .1s, 0s; }
.status.error { transition-delay: 0s; }
.status h2 { margin: 0; font-size: clamp(24px, 3vw, 38px); letter-spacing: -.035em; line-height: 1.1; }
.status p { margin: 0; max-width: 34em; color: var(--muted); }
.status .btn { margin-top: 12px; }
.reading { position: relative; width: 140px; height: 4px; margin-bottom: 16px; overflow: hidden; border-radius: 2px; background: var(--line); }
.reading::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; border-radius: 2px; background: var(--accent); animation: read 1.1s var(--ease) infinite; }
.status.error .reading { display: none; }
@keyframes read { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

.eject { position: fixed; top: 22px; right: 36px; z-index: 60; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: rgb(255 252 246 / .72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 2px 10px rgb(31 27 22 / .2); cursor: pointer; opacity: 0; transform: scale(.6); pointer-events: none; transition: opacity .25s, transform .35s var(--ease); }
.eject.show { opacity: .85; transform: none; pointer-events: auto; }
.eject.show:hover, .eject.show:focus-visible { opacity: 1; }
.eject:focus-visible { border-radius: 50%; }
.eject svg { transition: transform .25s var(--ease); }
.eject:hover svg { transform: translateY(-2px); }
.eject { color: #1F1B16; }
.eject.fs { right: 84px; }
.eject.dlb { right: 132px; }
body.player-dark .eject { color: #F4EEE3; }
body.player-dark .eject { background: rgb(18 14 26 / .6); box-shadow: 0 0 0 1px rgb(255 255 255 / .12), 0 2px 10px rgb(0 0 0 / .4); }
.eject.show.idle { opacity: 0; pointer-events: none; transition: opacity .6s; }
.eject.show.idle:focus-visible { opacity: 1; transition: opacity .15s; }
.micdot { position: fixed; top: 4px; left: 50%; z-index: 62; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #ff2d2d; box-shadow: 0 0 0 3px rgb(255 45 45 / .3); animation: micpulse 1.6s ease-in-out infinite; pointer-events: auto; }
@keyframes micpulse { 50% { box-shadow: 0 0 0 7px rgb(255 45 45 / 0); } }
@media (prefers-reduced-motion: reduce) { .micdot { animation: none; } }
.hotcorner { position: fixed; top: 0; right: 0; z-index: 61; width: 28px; height: 28px; }
/* hot corner reached: the buttons light up briefly */
.eject.ping { animation: ping .9s ease-out; }
@keyframes ping { 20% { opacity: 1; filter: brightness(1.35); box-shadow: 0 0 0 1px rgb(255 255 255 / .5), 0 0 22px 4px rgb(255 255 255 / .75); } }
.flyer { position: fixed; left: 0; top: 0; z-index: 61; transform-origin: 0 0; pointer-events: none; }

/* ---------------------------------------------------------------- dialogs */

dialog { width: min(400px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 22px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 90px rgb(31 27 22 / .32); }
dialog::backdrop { background: rgb(31 27 22 / .36); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog[open] { animation: dlg .3s var(--ease); }
@keyframes dlg { from { opacity: 0; transform: translateY(12px) scale(.98); } }
dialog form { display: grid; gap: 16px; padding: 28px; }
dialog h2 { margin: 0; font-size: 30px; line-height: 1.1; letter-spacing: -.04em; }
dialog p { margin: 0; color: var(--muted); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: var(--surface); }
.tabs button { padding: 9px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-weight: 700; cursor: pointer; }
.tabs [aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgb(31 27 22 / .14); }
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 700; }
.field small { color: var(--muted); font-size: 13px; }
.field input { width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-size: 17px; }
.field input:focus { outline: none; border-color: var(--accent); }
.field input[name="user"] { font-weight: 700; letter-spacing: .14em; }
.form-error { padding: 10px 14px; border-radius: 12px; background: #FFE4D4; color: #8A2400 !important; font-size: 14px; font-weight: 600; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
dialog.wide { width: min(560px, calc(100vw - 32px)); }
#metadlg form { max-height: calc(100dvh - 32px); overflow: auto; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .two { grid-template-columns: 1fr; } }
.color { display: flex; gap: 8px; }
.color input[type="color"] { flex: none; width: 50px; height: auto; padding: 4px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.color input[name] { font-family: ui-monospace, Menlo, Consolas, monospace; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.users { display: grid; gap: 2px; max-height: min(60vh, 520px); margin: 0 -10px; padding: 0; overflow: auto; list-style: none; }
.users li { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; }
.users li:hover { background: var(--surface); }
.users .avatar { position: relative; }
.users .avatar.on::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border: 2px solid var(--paper); border-radius: 50%; background: #2FA84F; }
.users b { display: flex; align-items: center; gap: 8px; letter-spacing: .06em; }
.users small { display: block; color: var(--muted); font-size: 13px; }
.users .ops { display: flex; gap: 4px; }
.users .ops button { padding: 6px 10px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.users .ops button:hover, .users .ops button:focus-visible { background: var(--paper); color: var(--ink); }
.users .ops button.rm:hover, .users .ops button.rm:focus-visible { color: var(--danger); }
.usersb { display: inline-flex; align-items: center; gap: 7px; }
.linkish { justify-self: start; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkish:hover, .linkish:focus-visible { color: var(--danger); }
.linkish.calm:hover, .linkish.calm:focus-visible { color: var(--ink); }
.tok-new { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--surface); }
.tok-new textarea { width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); resize: none; font: 600 13px ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.tok-new .btn { justify-self: start; }
/* footer sits just below the fold: the page is ~120px taller than the
   viewport, so the link shows up only after scrolling a bit */
body:has(.foot:not([hidden])) { min-height: calc(100dvh + 120px); }
.foot { padding: 24px var(--gutter); text-align: right; font-size: 14px; line-height: 20px; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover, .foot a:focus-visible { color: var(--ink); text-decoration: underline; }
body.playing .foot { display: none; }

/* ---------------------------------------------------------------- drop + toasts */

.drop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgb(255 90 0 / .14); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drop.on { opacity: 1; }
.drop-card { display: grid; justify-items: center; gap: 4px; padding: 40px 56px; border: 3px dashed var(--accent); border-radius: 28px; background: var(--paper); color: var(--muted); text-align: center; transform: scale(.96); transition: transform .3s var(--ease); }
.drop.on .drop-card { transform: none; }
.drop-card strong { color: var(--ink); font-size: clamp(28px, 4vw, 44px); letter-spacing: -.04em; line-height: 1.1; }

.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 80; display: grid; justify-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); transform: translateX(-50%); pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: 0 12px 30px rgb(31 27 22 / .25); animation: toast .35s var(--ease); }
.toast.error { background: var(--danger); color: #fff; }
.toast.busy::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%; background: var(--accent); animation: blink 1s infinite; }
@keyframes toast { from { opacity: 0; transform: translateY(12px); } }
@keyframes blink { 50% { opacity: .25; } }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 640px) {
  :root { --dw: calc(50vw - 46px); }
  .shelf { grid-template-columns: repeat(auto-fill, minmax(calc(var(--dw) + 24px), 1fr)); --row: calc(var(--dw) * 94 / 90 + 62px); }
  .top { padding-block: 14px; }
  .brand { font-size: 18px; }
  .top, .bar, .account { gap: 6px; }
  .btn { padding: 8px 12px; font-size: 14px; }
  .who .badge, #insert .lbl, .usersb .lbl { display: none; }
  .usersb { padding-inline: 9px; }
  #insert { padding-inline: 13px; }
  .screen { inset: 0; border-radius: 0; }
  .eject { top: 10px; right: 10px; width: 36px; height: 36px; }
  .eject.fs { right: 52px; }
  .eject.dlb { right: 94px; }
}
@media (max-width: 420px) {
  .who { margin: 0; font-size: 0; }
  .who .avatar { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
