/* ══════════════════════════════════════════════════════════
   白相 · 闪卡工作室   —   WHITE ATELIER CARD STUDIO
   ══════════════════════════════════════════════════════════ */

:root{
  --ink:        #05070d;
  --ink-2:      #080d18;
  --ink-3:      #0d1424;
  --paper:      #eef2f8;
  --muted:      rgba(226,236,250,.52);
  --muted-2:    rgba(226,236,250,.34);
  --line:       rgba(214,230,255,.11);
  --line-2:     rgba(214,230,255,.2);
  --ice:        #a9d8ff;
  --violet:     #b79bff;
  --gold:       #e8d3a0;

  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans:  "Inter", "Helvetica Neue", "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;

  --ease: cubic-bezier(.22,.61,.36,1);
}

*{ box-sizing: border-box; }

html, body{ height: 100%; }

body{
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body::before{
  content:"";
  position: fixed; inset: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(74,110,190,.16), transparent 60%),
    radial-gradient(80% 60% at 85% 100%, rgba(120,80,190,.13), transparent 65%),
    radial-gradient(60% 50% at 8% 80%, rgba(40,120,160,.1), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after{
  content:"";
  position: fixed; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: radial-gradient(90% 80% at 50% 40%, #000 10%, transparent 85%);
  pointer-events: none;
  z-index: 0;
}

.app{
  position: relative;
  z-index: 1;
  height: 100vh;
  display: grid;
  grid-template-columns: 92px minmax(0,1fr) 352px;
}

/* ───────────────────────── rail ───────────────────────── */

.rail{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 26px 0 22px;
  border-right: 1px solid var(--line);
  position: relative;
}

.rail__mark{
  writing-mode: vertical-rl;
  display: flex; gap: 14px; align-items: center;
}
.rail__cn{
  font-family: var(--serif);
  font-size: 21px; letter-spacing: .34em; font-weight: 500;
  color: rgba(238,244,255,.92);
}
.rail__en{
  font-size: 8.5px; letter-spacing: .42em;
  color: var(--muted-2);
}

.rail__nav{ display: flex; flex-direction: column; gap: 12px; }
.rail__dot{
  width: 5px; height: 5px; padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(214,230,255,.4);
  background: transparent;
  cursor: pointer;
  transition: .35s var(--ease);
}
.rail__dot.is-on{ background: var(--paper); border-color: var(--paper); box-shadow: 0 0 12px rgba(200,225,255,.6); }

.rail__year{
  writing-mode: vertical-rl;
  font-size: 8.5px; letter-spacing: .38em; color: var(--muted-2);
}

/* ───────────────────────── stage ───────────────────────── */

.stage-wrap{
  display: flex; flex-direction: column;
  min-width: 0;
  position: relative;
}

.topbar{
  height: 62px;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
}

.kicker{
  font-size: 8.5px; letter-spacing: .34em;
  color: var(--muted-2);
  text-transform: uppercase;
}

.topbar__left{ display: flex; align-items: baseline; gap: 14px; }
.topbar__title{
  font-family: var(--serif);
  font-size: 15px; letter-spacing: .18em;
  color: rgba(238,244,255,.9);
}

.topbar__mid{
  display: flex; align-items: center; gap: 10px;
  font-size: 10.5px; letter-spacing: .26em;
  color: var(--muted);
}
.topbar__mid i{ font-style: normal; color: var(--muted-2); }

.topbar__right{ display: flex; align-items: center; gap: 16px; }
.topbar__right > span{
  font-size: 9.5px; letter-spacing: .3em; color: var(--muted);
}

.icon-btn{
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: rgba(255,255,255,.02);
  color: rgba(230,240,255,.8);
  cursor: pointer;
  transition: .35s var(--ease);
}
.icon-btn svg{ width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover{ background: rgba(255,255,255,.08); border-color: rgba(214,230,255,.4); transform: rotate(180deg); }

.stage{
  position: relative;
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  perspective: 1200px;
  perspective-origin: 50% 46%;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.stage.is-dragging{ cursor: grabbing; }

.dust{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: .85;
  transition: opacity .6s;
}
.stage.is-plain .dust{ opacity: 0; }

.aura{
  position: absolute;
  width: 62%; aspect-ratio: 1;
  max-width: 720px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 38%, rgba(120,180,255,.24), transparent 58%),
    radial-gradient(circle at 62% 62%, rgba(160,110,255,.2), transparent 60%);
  filter: blur(46px);
  transform: translate3d(calc(var(--ax, 0) * 18px), calc(var(--ay, 0) * 14px), 0);
  transition: transform .6s var(--ease);
  pointer-events: none;
}

.floor-shadow{
  position: absolute;
  bottom: 12%;
  left: 50%;
  width: min(52vw, 620px);
  height: 120px;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, rgba(88,150,235,.16), transparent 72%),
    radial-gradient(closest-side, rgba(2,4,10,.8), transparent 78%);
  filter: blur(18px);
  transform: translateX(-50%) translateY(calc(var(--ty, 0) * 1px)) scaleX(calc(1 + var(--tilt, 0) * .06));
  transition: transform .5s var(--ease);
  pointer-events: none;
}

.card-float{
  animation: float 11s ease-in-out infinite;
  will-change: transform;
  transform-style: preserve-3d;   /* keep the depth chain alive from .stage down */
}
@keyframes float{
  0%,100%{ transform: translateY(-7px); }
  50%    { transform: translateY(7px); }
}

/* ───────────── the card ───────────── */

.card{
  position: relative;
  width: 336px;   /* same width as the desktop card, so the type matches */
  aspect-ratio: 2 / 3;
  transform-style: preserve-3d;
  outline: none;
  --light: .62;
  --px: 50%;
  --py: 42%;
  --ang: 0;
  --sh: 0;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

.face{
  position: absolute; inset: 0;
  border-radius: 16px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  isolation: isolate;
  container-type: inline-size;
  background: #060a14;
  box-shadow:
    0 50px 90px -36px rgba(0,0,0,.95),
    0 10px 26px rgba(0,0,0,.55),
    0 0 0 1px rgba(150,185,235,.1);
}

.face--back{ transform: rotateY(180deg); }

/* a turning card catches less light — sells the flip as a physical object */
.face{ filter: brightness(calc(1 - var(--arc, 0) * .22)); }

.art{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 52% 42%;
  display: block;
  pointer-events: none;
  transform: scale(1.02);
  filter: saturate(1.08) contrast(1.06);
}

/* scrims + vignette */
.scrim{ position: absolute; left: 0; right: 0; pointer-events: none; }
.scrim--top{
  top: 0; height: 44%;
  background: linear-gradient(180deg,
    rgba(2,5,12,.975) 0%,
    rgba(2,5,12,.9) 16%,
    rgba(3,7,16,.66) 27%,
    rgba(3,7,16,.3) 36%,
    rgba(3,7,16,.08) 44%,
    transparent 58%);
}
.scrim--bottom{
  bottom: 0; height: 44%;
  background: linear-gradient(0deg,
    rgba(2,5,12,.985) 0%,
    rgba(2,5,12,.9) 16%,
    rgba(3,7,16,.6) 28%,
    rgba(3,7,16,.22) 38%,
    transparent 52%);
}
.vignette{
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(112% 82% at 50% 44%, transparent 30%, rgba(1,3,9,.7) 100%);
}

/* iridescent foil — a rainbow band that slides across the surface */
.holo{
  position: absolute; inset: 0;
  pointer-events: none;
  background-image: linear-gradient(102deg,
    rgba(255,86,196,0) 24%,
    rgba(255,86,196,.5) 33%,
    rgba(255,214,110,.56) 39%,
    rgba(96,255,208,.5) 45%,
    rgba(96,150,255,.56) 51%,
    rgba(196,110,255,.5) 57%,
    rgba(255,86,196,0) 66%);
  background-size: 280% 130%;
  background-position: calc(50% + (var(--px) - 50%) * 1.6) 50%;
  mix-blend-mode: overlay;
  filter: saturate(1.5);
  opacity: calc(var(--light) * .85);
  -webkit-mask-image: radial-gradient(72% 62% at var(--px) var(--py), #000 0%, rgba(0,0,0,.45) 55%, transparent 86%);
  mask-image: radial-gradient(72% 62% at var(--px) var(--py), #000 0%, rgba(0,0,0,.45) 55%, transparent 86%);
  transition: opacity .45s var(--ease);
}

/* oil-slick bloom right under the cursor */
.sheen{
  position: absolute; inset: 0;
  pointer-events: none;
  background: conic-gradient(from calc(var(--ang) * 1deg) at var(--px) var(--py),
    #ff62d4, #ffd873, #5cffd9, #5f9dff, #c46bff, #ff62d4);
  mix-blend-mode: color-dodge;
  opacity: calc(var(--light) * .16);
  -webkit-mask-image: radial-gradient(38% 32% at var(--px) var(--py), #000 0%, transparent 70%);
  mask-image: radial-gradient(38% 32% at var(--px) var(--py), #000 0%, transparent 70%);
  transition: opacity .45s var(--ease);
}

/* fine diffraction lines */
.lines{
  position: absolute; inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(102deg,
    rgba(255,255,255,.1) 0 1px,
    transparent 1px 6px);
  mix-blend-mode: soft-light;
  opacity: calc(var(--light) * .45);
  -webkit-mask-image: radial-gradient(48% 42% at var(--px) var(--py), #000 0%, transparent 72%);
  mask-image: radial-gradient(48% 42% at var(--px) var(--py), #000 0%, transparent 72%);
  transition: opacity .45s var(--ease);
}

/* glitter specks */
.glitter{
  position: absolute; inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.7px 1.7px at 9px 13px, rgba(255,255,255,.95), transparent 55%),
    radial-gradient(1.2px 1.2px at 27px 5px, rgba(200,240,255,.85), transparent 55%),
    radial-gradient(1.4px 1.4px at 34px 27px, rgba(255,225,180,.8), transparent 55%),
    radial-gradient(1px 1px at 15px 33px, rgba(220,200,255,.85), transparent 55%),
    radial-gradient(1.6px 1.6px at 41px 42px, rgba(255,255,255,.75), transparent 55%),
    radial-gradient(1px 1px at 6px 46px, rgba(190,235,255,.8), transparent 55%);
  background-size: 52px 52px;
  background-position: calc(var(--px) * -.12) calc(var(--py) * -.12);
  mix-blend-mode: color-dodge;
  opacity: calc(var(--light) * .9);
  -webkit-mask-image: radial-gradient(38% 34% at var(--px) var(--py), #000 0%, rgba(0,0,0,.35) 52%, transparent 82%);
  mask-image: radial-gradient(38% 34% at var(--px) var(--py), #000 0%, rgba(0,0,0,.35) 52%, transparent 82%);
}

/* specular glare */
.glare{
  position: absolute; inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(24% 20% at var(--px) var(--py), rgba(255,255,255,.62), transparent 68%),
    linear-gradient(104deg, transparent 40%, rgba(255,255,255,.22) 48%, rgba(255,255,255,.05) 53%, transparent 60%);
  mix-blend-mode: screen;
  opacity: calc(.16 + var(--light) * .5);
  transform: translate3d(calc((var(--px) - 50%) * .1), calc((var(--py) - 50%) * .1), 0);
  transition: opacity .4s var(--ease);
}

/* paper grain */
.grain{
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: .17;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='.55'/></svg>");
  background-size: 140px 140px;
}

/* ───────── front typography ───────── */

.front-ui{
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 7.4cqw 7cqw 6.4cqw;
  pointer-events: none;
}

.head__meta{
  display: flex; align-items: center; gap: 2.4cqw;
  font-size: 2.55cqw;
  letter-spacing: .28em;
  color: rgba(226,238,255,.66);
}
.head__meta .tag{
  border: 1px solid rgba(214,232,255,.34);
  padding: .55cqw 1.5cqw;
  border-radius: 100px;
  text-indent: .1em;
  backdrop-filter: blur(2px);
}
.head__meta .rule{ flex: 0 0 4cqw; height: 1px; background: rgba(214,232,255,.34); }
.head__meta .serial{ font-variant-numeric: tabular-nums; }

.name{
  margin: 3.2cqw 0 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 12.8cqw;
  line-height: 1.04;
  letter-spacing: .04em;
  color: #f6f9ff;
  text-shadow:
    0 2px 26px rgba(90,150,255,.4),
    0 1px 2px rgba(0,0,0,.55);
  white-space: nowrap;
}

.name, .move, .latin{ white-space: nowrap; }

.latin{
  margin: 1.9cqw 0 0;
  font-size: 3.1cqw;
  letter-spacing: .42em;
  color: rgba(214,234,255,.88);
  font-weight: 300;
  text-transform: uppercase;
  text-shadow: 0 1px 10px rgba(0,0,0,.75), 0 0 22px rgba(90,150,255,.35);
}

.foot{ display: flex; flex-direction: column; gap: 1.3cqw; }

.move__label{
  font-size: 2.9cqw;
  letter-spacing: .42em;
  color: rgba(180,214,255,.72);
}

.move{
  font-family: var(--serif);
  font-size: 7.4cqw;
  font-weight: 400;
  letter-spacing: .1em;
  line-height: 1.2;
  color: #f2f7ff;
  text-shadow: 0 2px 18px rgba(70,130,230,.45), 0 1px 2px rgba(0,0,0,.6);
}

.foot__row{
  margin-top: 1.6cqw;
  padding-top: 2.2cqw;
  border-top: 1px solid rgba(214,232,255,.22);
  display: flex; align-items: center; gap: 2.4cqw;
  font-size: 2.5cqw;
  letter-spacing: .24em;
  color: rgba(200,222,250,.58);
}
.foot__hint{ flex: 1 1 auto; }
.foot__no{ font-variant-numeric: tabular-nums; }

.rarity{
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 2.9cqw;
  letter-spacing: .22em;
  padding: .5cqw 1.4cqw .35cqw;
  border-radius: 3px;
  color: #0a1220;
  background: linear-gradient(135deg, #dfeaff, #a9d8ff 45%, #e8d3a0);
  box-shadow: 0 0 18px rgba(150,200,255,.45);
}
.card[data-rarity="UR"] .rarity{ background: linear-gradient(135deg,#fff2cf,#e8d3a0 45%,#c9a86a); box-shadow: 0 0 22px rgba(232,211,160,.55); }
.card[data-rarity="SR"] .rarity{ background: linear-gradient(135deg,#efe0ff,#b79bff 50%,#8f7bff); box-shadow: 0 0 20px rgba(183,155,255,.5); }
.card[data-rarity="R"]  .rarity{ background: linear-gradient(135deg,#e2e8f0,#b6c1cf 55%,#98a4b4); box-shadow: none; }

/* frame + corner ticks */
.frame{
  position: absolute; inset: 0;
  border-radius: 15px;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(222,238,255,.16),
    inset 0 2px 0 rgba(255,255,255,.13),
    inset 0 -3px 12px rgba(0,0,0,.55),
    inset 0 0 42px rgba(70,130,220,.14),
    inset 0 0 0 6px rgba(4,8,16,.18);
}

.corner{
  position: absolute;
  width: 4.4cqw; height: 4.4cqw;
  pointer-events: none;
  border-color: rgba(232,242,255,.55);
  border-style: solid;
  border-width: 0;
}
.corner.tl{ top: 2.6cqw; left: 2.6cqw; border-top-width: 1px; border-left-width: 1px; }
.corner.tr{ top: 2.6cqw; right: 2.6cqw; border-top-width: 1px; border-right-width: 1px; }
.corner.bl{ bottom: 2.6cqw; left: 2.6cqw; border-bottom-width: 1px; border-left-width: 1px; }
.corner.br{ bottom: 2.6cqw; right: 2.6cqw; border-bottom-width: 1px; border-right-width: 1px; }

/* ───────── back face ───────── */

.art--back{
  filter: blur(26px) saturate(1.35) brightness(.42);
  transform: scale(1.35);
  object-position: 50% 40%;
}
.back-wash{
  position: absolute; inset: 0;
  background:
    radial-gradient(80% 60% at 50% 34%, rgba(30,60,120,.5), transparent 70%),
    linear-gradient(180deg, rgba(4,8,18,.86), rgba(4,8,18,.92) 55%, rgba(3,6,13,.97));
}

.holo--back{
  opacity: calc(var(--light) * .22);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 45%, #000 0%, transparent 82%);
  mask-image: radial-gradient(70% 60% at 50% 45%, #000 0%, transparent 82%);
}

.back-ui{
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 7cqw 7cqw 6.4cqw;
  text-align: center;
}
.back__top{
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 2.4cqw; letter-spacing: .3em;
  color: rgba(226,238,255,.5);
}
.back__no{ font-variant-numeric: tabular-nums; }

.emblem{
  position: relative;
  margin-top: 13cqw;
  width: 44cqw; aspect-ratio: 1;
  display: grid; place-items: center;
}
.emblem svg{ position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.emblem .e-c1{ fill: none; stroke: rgba(196,222,255,.34); stroke-width: .6; }
.emblem .e-c2{ fill: none; stroke: rgba(196,222,255,.16); stroke-width: .5; stroke-dasharray: 2 5; }
.emblem .e-d { fill: none; stroke: rgba(196,222,255,.22); stroke-width: .55; }
.emblem .e-d2{ fill: none; stroke: rgba(196,222,255,.14); stroke-width: .4; }

.emblem__cn{
  font-family: var(--serif);
  font-size: 13cqw;
  font-weight: 300;
  letter-spacing: .18em;
  text-indent: .18em;
  color: rgba(238,246,255,.94);
  text-shadow: 0 0 34px rgba(120,170,255,.5);
}

.back__quote{ margin-top: auto; }
.back__quote p{
  margin: 0;
  font-family: var(--serif);
  font-size: 4.2cqw;
  letter-spacing: .3em;
  text-indent: .3em;
  color: rgba(230,240,255,.86);
}
.back__quote span{
  display: block;
  margin-top: 1.8cqw;
  font-size: 2cqw;
  letter-spacing: .3em;
  color: rgba(190,214,248,.42);
}

.back__foot{
  width: 100%;
  margin-top: 7cqw;
  padding-top: 3cqw;
  border-top: 1px solid rgba(214,232,255,.12);
  display: flex; justify-content: space-between;
  font-size: 1.9cqw; letter-spacing: .28em;
  color: rgba(190,214,248,.4);
}

/* texture modes */
.card[data-texture="matte"] .holo{ opacity: calc(var(--light) * .22); filter: blur(2px) saturate(1.2); }
.card[data-texture="matte"] .sheen{ opacity: calc(var(--light) * .05); }
.card[data-texture="matte"] .lines{ opacity: calc(var(--light) * .22); }
.card[data-texture="matte"] .glitter{ opacity: calc(var(--light) * .18); }
.card[data-texture="matte"] .glare{ opacity: calc(.2 + var(--light) * .35); }

/* ───────── stage hint ───────── */

.stage__hint{
  position: absolute;
  bottom: 26px;
  margin: 0;
  font-size: 10px;
  letter-spacing: .32em;
  color: var(--muted-2);
  transition: opacity .8s var(--ease);
  pointer-events: none;
}
.stage__hint.is-hidden{ opacity: 0; }

/* ───────────────────────── panel ───────────────────────── */

.panel{
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(11,16,28,.9), rgba(6,9,17,.94));
  backdrop-filter: blur(18px);
  display: flex; flex-direction: column;
  min-height: 0;
}

.panel__head{
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
}
.panel__head h2{
  margin: 9px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: .22em;
  color: rgba(240,246,255,.94);
}

.panel__scroll{
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 26px 26px;
  display: flex; flex-direction: column; gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.16) transparent;
}
.panel__scroll::-webkit-scrollbar{ width: 6px; }
.panel__scroll::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.14); border-radius: 10px; }

.drop{
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 12px;
  border: 1px dashed rgba(214,230,255,.22);
  border-radius: 10px;
  background: rgba(255,255,255,.015);
  cursor: pointer;
  transition: .35s var(--ease);
  text-align: center;
}
.drop:hover, .drop.is-over{
  border-color: rgba(169,216,255,.6);
  background: rgba(120,170,255,.07);
}
.drop svg{
  width: 19px; height: 19px;
  fill: none; stroke: rgba(214,232,255,.7);
  stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round;
  margin-bottom: 2px;
}
.drop span{ font-size: 12px; letter-spacing: .16em; color: rgba(235,243,255,.86); }
.drop em{ font-style: normal; font-size: 9.5px; letter-spacing: .16em; color: var(--muted-2); }

.field{ display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-row{ display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field label, .label{
  font-size: 9px; letter-spacing: .3em;
  color: var(--muted-2);
  text-transform: uppercase;
}

.field input[type="text"]{
  width: 100%;
  padding: 8px 0 9px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(214,230,255,.16);
  color: rgba(240,246,255,.95);
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: .04em;
  outline: none;
  transition: border-color .3s var(--ease);
}
.field input[type="text"]:focus{ border-bottom-color: var(--ice); }
.field input::selection{ background: rgba(120,170,255,.35); }

.seg{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1px solid rgba(214,230,255,.16);
  border-radius: 8px;
  overflow: hidden;
}
.seg button{
  padding: 8px 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .16em;
  cursor: pointer;
  transition: .3s var(--ease);
}
.seg button + button{ border-left: 1px solid rgba(214,230,255,.1); }
.seg button:hover{ color: rgba(240,246,255,.95); background: rgba(255,255,255,.04); }
.seg button.is-on{
  color: #060a14;
  background: linear-gradient(180deg, #f4f8ff, #cfdcef);
  font-weight: 600;
}

.field__label-row{ display: flex; justify-content: space-between; align-items: baseline; }
.value{ font-size: 10px; letter-spacing: .2em; color: rgba(200,222,250,.75); font-variant-numeric: tabular-nums; }

.range{
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 20px; background: transparent; cursor: pointer;
}
.range::-webkit-slider-runnable-track{
  height: 1px;
  background: linear-gradient(90deg, rgba(169,216,255,.9), rgba(183,155,255,.7) 60%, rgba(214,230,255,.16));
}
.range::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: 11px; height: 11px;
  margin-top: -5px;
  border-radius: 50%;
  background: #eef4ff;
  box-shadow: 0 0 12px rgba(150,200,255,.8);
}

.switch-row{
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding-top: 4px;
}
.switch-row em{ display: block; font-style: normal; font-size: 9.5px; letter-spacing: .12em; color: var(--muted-2); margin-top: 4px; }

.switch{
  width: 40px; height: 22px;
  border-radius: 100px;
  border: 1px solid rgba(214,230,255,.2);
  background: rgba(255,255,255,.03);
  padding: 2px;
  cursor: pointer;
  transition: .35s var(--ease);
  flex: 0 0 auto;
}
.switch span{
  display: block;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: rgba(230,240,255,.55);
  transition: .35s var(--ease);
}
.switch.is-on{ background: rgba(169,216,255,.22); border-color: rgba(169,216,255,.55); }
.switch.is-on span{ transform: translateX(17px); background: #eaf5ff; box-shadow: 0 0 10px rgba(169,216,255,.9); }

.actions{ display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }

.btn{
  padding: 11px 14px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .2em;
  border-radius: 8px;
  cursor: pointer;
  transition: .3s var(--ease);
}
.btn--ghost{
  background: transparent;
  border: 1px solid rgba(214,230,255,.2);
  color: rgba(232,242,255,.85);
}
.btn--ghost:hover{ border-color: rgba(214,230,255,.5); background: rgba(255,255,255,.05); }
.btn--solid{
  border: 1px solid transparent;
  background: linear-gradient(180deg, #f6faff, #d5e1f2);
  color: #060a14;
  font-weight: 600;
}
.btn--solid:hover{ box-shadow: 0 0 26px rgba(180,215,255,.35); transform: translateY(-1px); }

.panel__note{
  margin: 2px 0 0;
  font-size: 9.5px;
  line-height: 1.9;
  letter-spacing: .1em;
  color: rgba(200,220,248,.3);
}

/* ───────────────────────── responsive ───────────────────────── */

@media (max-width: 980px){
  body{ overflow: auto; }
  .app{ grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .rail{ display: none; }
  .stage-wrap{ min-height: 78vh; }
  .panel{ border-left: 0; border-top: 1px solid var(--line); }
  .panel__scroll{ overflow: visible; }
  .topbar__mid{ display: none; }
}

@media (max-width: 720px){
  .topbar{ height: 54px; padding: 0 18px; }
  .topbar__title{ font-size: 13px; }
  .stage{ min-height: 62vh; }
  .card{ width: min(74vw, 320px); }
  .panel__head, .panel__scroll{ padding-left: 18px; padding-right: 18px; }
}

@media (prefers-reduced-motion: reduce){
  .card-float{ animation: none; }
  * { scroll-behavior: auto !important; }
}


/* ═════════════════ desktop widget mode ═════════════════ */

.widget-bar{ display: none; }

html.is-widget,
html.is-widget body{ background: transparent !important; }
html.is-widget body{ overflow: hidden; }
html.is-widget body::before,
html.is-widget body::after{ display: none; }

html.is-widget .rail,
html.is-widget .topbar,
html.is-widget .panel,
html.is-widget .stage__hint{ display: none; }

html.is-widget body{
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}

html.is-widget .app{
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: auto;
  padding: 0 4px 6px;
}
html.is-widget .stage-wrap{
  flex: 1 1 auto;
  min-height: 0;
}
html.is-widget .stage{ height: 100%; }
html.is-widget .card{ width: min(74vw, 336px); }

html.is-widget .widget-bar{
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 32px;
  height: 32px;
  padding: 0 8px 0 12px;
  -webkit-app-region: drag;
  color: rgba(226,238,255,.6);
  font-size: 9px;
  letter-spacing: .26em;
  user-select: none;
  cursor: grab;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, rgba(12,18,30,.86), rgba(8,12,20,.52));
  border-bottom: 1px solid rgba(214,230,255,.07);
  backdrop-filter: blur(10px);
}
html.is-widget .widget-bar__grip{
  width: 16px; height: 4px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, rgba(214,232,255,.45) 0 3px, transparent 3px 5px);
}
html.is-widget .widget-bar__title{
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: .22em;
  color: rgba(238,245,255,.86);
}
html.is-widget .widget-bar__hint{
  flex: 1 1 auto;
  text-align: right;
  font-size: 8px;
  letter-spacing: .16em;
  color: rgba(200,220,248,.35);
  transition: opacity .6s;
}
html.is-widget .widget-bar__hint.is-off{ opacity: 0; }
html.is-widget .widget-bar__btn{
  -webkit-app-region: no-drag;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 0; border-radius: 6px;
  background: transparent;
  color: rgba(226,238,255,.7);
  cursor: pointer;
  transition: background .25s, color .25s;
}
html.is-widget .widget-bar__btn:hover{ background: rgba(255,255,255,.08); color: #fff; }
html.is-widget .widget-bar__btn svg{ width: 14px; height: 14px; fill: currentColor; }

html.is-widget .aura{ opacity: .8; }
html.is-widget .floor-shadow{ bottom: 4%; }

/* ── widget: inline editing sheet ── */

.panel__done{ display: none; }

html.is-widget .stage-wrap{ position: relative; }

html.is-widget .panel{ display: none; }

html.is-widget.is-widget-editing .panel{
  display: flex;
  position: absolute;
  inset: 34px 6px 6px;
  z-index: 30;
  border: 1px solid rgba(214,230,255,.14);
  border-radius: 14px;
  background: rgba(6,9,17,.97);
  box-shadow: 0 30px 80px rgba(0,0,0,.7);
  overflow: hidden;
}

html.is-widget.is-widget-editing .panel__done{
  display: block;
  position: absolute;
  top: 22px; right: 22px;
  padding: 6px 14px;
  font-size: 11px;
  letter-spacing: .2em;
  color: #060a14;
  background: linear-gradient(180deg, #f6faff, #d5e1f2);
  border: 0;
  border-radius: 100px;
  cursor: pointer;
}

html.is-widget.is-widget-editing .panel__head{ padding-right: 96px; }

html.is-widget .widget-bar__btn.is-on{
  background: rgba(169,216,255,.18);
  color: #eaf5ff;
}

/* ═════════════════ card thickness + flip depth ═════════════════ */

.rim{
  position: absolute;
  pointer-events: none;
  opacity: .9;
  background: linear-gradient(180deg,
    rgba(226,238,255,.92) 0%,
    rgba(150,176,208,.9) 18%,
    rgba(72,92,122,.95) 52%,
    rgba(16,23,36,.98) 100%);
  filter: brightness(calc(1 + var(--arc, 0) * .7));
}
/* thin edges, symmetric about the card plane — no fins sticking out */
.rim--l{ left: 0; top: 0; bottom: 0; width: 7px; transform-origin: left center; transform: rotateY(90deg); }
.rim--r{ right: 0; top: 0; bottom: 0; width: 7px; transform-origin: right center; transform: rotateY(-90deg); }
.rim--t{ top: 0; left: 0; right: 0; height: 7px; transform-origin: center top; transform: rotateX(-90deg); }
.rim--b{ bottom: 0; left: 0; right: 0; height: 7px; transform-origin: center bottom; transform: rotateX(90deg); }

/* the cast shadow reacts to the flip arc */
.stage{ --arc: 0; }
.floor-shadow{
  opacity: calc(.95 - var(--arc, 0) * .35);
  transform: translateX(-50%)
             translateY(calc(var(--ty, 0) * 1px - var(--arc, 0) * 10px))
             scaleX(calc(1 + var(--tilt, 0) * .06 + var(--arc, 0) * .3));
}

/* ── panel section divider ── */

.panel__sep{
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 -2px;
  font-size: 8.5px;
  letter-spacing: .3em;
  color: rgba(200,222,250,.34);
}
.panel__sep::after{
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(214,230,255,.18), transparent);
}

/* ═════════════════ floating type layer ═════════════════ */

.layer{
  position: absolute;
  inset: 0;
  pointer-events: none;
  container-type: inline-size;
  will-change: transform;
}
/* Three real depths: the name sits well above the print, the footer just above,
   the art on the card itself. The size change is the depth cue — don't cancel it. */
.layer--head{ transform: translateZ(calc(74px * var(--sep, 1))); }
.layer--foot{ transform: translateZ(calc(58px * var(--sep, 1))); }
.layer--back{ transform: rotateY(180deg) translateZ(calc(28px * var(--sep, 1))); }

/* shadows track the tilt, so the type visibly floats over the print */
.layer .head,
.layer .foot{
  position: absolute;
  left: 7cqw;
  right: 7cqw;
  filter: drop-shadow(
    calc(var(--shx, 0) * 1px)
    calc((var(--shy, 12) + 4) * 1px)
    14px rgba(0, 0, 0, .5)
  );
}

/* directional shading — the side turning away from the light goes dark */
.shade{
  position: absolute; inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  background: linear-gradient(
    var(--shade-ang, 135deg),
    rgba(0, 0, 0, 0) 42%,
    rgba(0, 0, 0, var(--shade-a, 0)) 100%
  );
}
.shade--back{ mix-blend-mode: multiply; }
.layer .head{ top: 7.4cqw; }
.layer .back-ui{ filter: drop-shadow(0 10px 18px rgba(0,0,0,.5)); }
.layer .foot{ bottom: 6.4cqw; }



/* ── 2.5D subject layer: the middle of the art floats above the rest ── */
.pop{
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translateZ(calc(44px * var(--sep, 1)));
  -webkit-mask-image: radial-gradient(52% 46% at 50% 44%, #000 42%, rgba(0,0,0,.75) 66%, transparent 100%);
  mask-image: radial-gradient(52% 46% at 50% 44%, #000 42%, rgba(0,0,0,.75) 66%, transparent 100%);
  opacity: .97;
}
.pop img{
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 52% 42%;
  display: block;
  border-radius: 16px;
}

.card.no-depth .pop{ display: none; }
.card.no-depth .layer--head{ transform: translateZ(calc(30px * var(--sep, 1))); }
.card.no-depth .layer--foot{ transform: translateZ(calc(14px * var(--sep, 1))); }

/* ── real two-layer art from the desktop host ── */
.card.has-fg .pop{
  -webkit-mask-image: none;
  mask-image: none;
  opacity: 1;
}

/* the desktop host does the cut-out, so hide the browser drop zone there */
html.is-widget .drop{ display: none; }

html.is-busy .card{ filter: saturate(.9) brightness(.94); }

/* ── the subject casts a shadow on the background plate ── */
.pop-shadow{
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translateZ(calc(24px * var(--sep, 1)))
             translate(calc(var(--shx, 0) * -0.35px), calc((var(--shy, 0) * -0.35 + 6) * 1px));
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.card.has-fg .pop-shadow{ opacity: .85; }
.pop-shadow img{
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 52% 42%;
  display: block;
  filter: brightness(0) blur(16px);
  opacity: .75;
}

/* hide the widget chrome while recording the share video */
html.is-recording .widget-bar{ display: none; }
html.is-recording .app{ padding-top: 6px; }

/* keep the lifted subject inside the card outline: compensate the perspective
   growth on the image itself, so the layer can still slide for parallax */
.pop img{ transform: scale(0.967); transform-origin: 50% 50%; }
.pop-shadow img{ transform: scale(0.981); transform-origin: 50% 50%; }

/* "save to pack" only makes sense inside the desktop app */
.panel__save{ display: none; width: 100%; margin-top: 8px; }
html.is-widget .panel__save{ display: block; }
html.has-bridge .panel__save{ display: block; }

/* the subject and its shadow must not leak outside the card's outline */
.pop{ clip-path: inset(0.3% round 15px); }
.pop-shadow{ clip-path: inset(1.2% round 15px); }


/* ── card pack layer (same page, same renderer) ── */
.pack{
  position:fixed; inset:0; z-index:60; display:none;
  background:radial-gradient(120% 90% at 50% -10%, #16203a 0%, #0b0f19 46%, #05070c 100%);
  overflow:auto;
}
html.is-pack .pack{ display:block; }
.pack__head{
  position:sticky; top:0; z-index:2; display:flex; align-items:baseline; gap:14px;
  padding:20px 30px 14px; backdrop-filter:blur(10px);
  background:linear-gradient(to bottom, rgba(6,9,15,.92), rgba(6,9,15,.4));
}
.pack__mark{ color:#e8cf9a; }
.pack__title{ font-size:22px; letter-spacing:.34em; font-weight:600; }
.pack__count{ color:#8b98b3; font-size:12px; }
.pack__close{
  margin-left:auto; width:34px; height:34px; border-radius:50%; cursor:pointer;
  border:1px solid rgba(255,255,255,.1); background:rgba(255,255,255,.05); color:#c8d3e8;
}
.pack__grid{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,180px));
  gap:26px 22px; padding:8px 30px 70px; justify-content:start;
}
.pack__empty{ color:#5c6880; font-size:13px; letter-spacing:.1em; padding:40px 0; }
.packtile{ position:relative; cursor:pointer; transition:transform .28s cubic-bezier(.2,.8,.3,1); }
.packtile:hover{ transform:translateY(-6px); }
.packtile img{
  width:100%; display:block; border-radius:12px;
  box-shadow:0 20px 34px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06);
}
.packtile__r{
  position:absolute; right:8px; top:8px; font-size:9px; font-weight:700; letter-spacing:.12em;
  color:#0b0e16; background:linear-gradient(135deg,#f6e6bd,#c9a86a); padding:2px 6px; border-radius:5px;
}
.packtile__v{
  position:absolute; right:8px; top:8px; font-size:10px; color:#bfe3ff;
  background:rgba(10,24,40,.75); border:1px solid rgba(140,200,255,.35);
  padding:1px 6px; border-radius:6px;
}
.packtile__del{
  position:absolute; left:8px; top:8px; width:20px; height:20px; padding:0; line-height:1;
  border-radius:50%; border:1px solid rgba(255,120,140,.35);
  background:rgba(30,10,16,.85); color:#ffb4be; cursor:pointer; opacity:0; transition:opacity .2s;
}
.packtile:hover .packtile__del{ opacity:1; }
.packtile__n{
  margin-top:8px; font-size:12px; color:#aeb9d0; text-align:center;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
html.is-pack .panel,
html.is-pack .topbar,
html.is-pack .rail{ display:none !important; }

/* action bar under a card opened from the pack */
#packBar{
  position:fixed; left:50%; bottom:22px; transform:translate(-50%, 16px);
  display:none; gap:8px; align-items:center; z-index:80;
  padding:10px 12px; border-radius:14px;
  background:linear-gradient(160deg, rgba(23,29,44,.94), rgba(10,13,21,.96));
  border:1px solid rgba(255,255,255,.1);
  box-shadow:0 24px 50px rgba(0,0,0,.6);
  backdrop-filter:blur(10px);
  opacity:0; transition:opacity .25s, transform .25s;
}
#packBar.on{ display:flex; opacity:1; transform:translate(-50%, 0); }
#packBar button{
  height:32px; padding:0 12px; border-radius:9px; cursor:pointer; font-family:inherit;
  font-size:12px; letter-spacing:.06em;
  border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.06); color:#dfe7f5;
}
#packBar button:hover{ background:rgba(255,255,255,.14); }
#packBar button.danger{ color:#ffb3bd; border-color:rgba(255,110,130,.3); background:rgba(60,14,22,.55); }
#packBar #packMsg{ font-size:11.5px; color:#8fd4ff; margin-left:6px; }


/* ── view mode: one card, no workbench (used by the pack) ── */
html.is-view .widget-bar,
html.is-view .panel,
html.is-view .stage__hint,
html.is-view .topbar,
html.is-view .rail{ display:none !important; }
html.is-view body{
  background:
    radial-gradient(120% 80% at 50% -8%, #17213b 0%, #0b0f19 48%, #05070c 100%) !important;
  overflow:hidden;
}
html.is-view .app{
  padding:0 !important;
  height:100vh;
  display:flex;
  flex-direction:column;
}
html.is-view .stage-wrap{
  flex:1 1 auto;
  min-height:0;
  width:100% !important;
  display:grid;
  place-items:center;
}
html.is-view .stage{
  height:100%;
  width:100%;
  padding:0 !important;
}
html.is-view .pack{ display:none !important; }


/* ── phone layout for the read-only pack ── */
@media (max-width: 700px) {
  html.is-player .pack__head{ padding:14px 16px 10px; gap:10px; }
  html.is-player .pack__mark{ font-size:13px; }
  html.is-player .pack__title{ font-size:17px; letter-spacing:.24em; }
  html.is-player .pack__count{ font-size:11px; }
  html.is-player .pack__close{ width:30px; height:30px; font-size:12px; padding:0 10px; }
  html.is-player .pack__grid{
    grid-template-columns:repeat(2, minmax(0,1fr)) !important;
    gap:18px 14px; padding:6px 14px 96px;
  }
  html.is-player .packtile img{ border-radius:10px; }
  html.is-player .packtile__n{ font-size:11px; margin-top:6px; }
  html.is-player .packtile__del{ opacity:1; width:24px; height:24px; font-size:13px; }
  html.is-player .packtile__r{ font-size:8px; right:6px; top:6px; }
  html.is-player .pack__empty{ font-size:12px; padding:24px 0; line-height:1.7; }

  html.is-view .card{ width:min(84vw, 330px) !important; }
  html.is-view .stage-wrap{ place-items:center; }

  #packBar{
    left:10px; right:10px; bottom:calc(10px + env(safe-area-inset-bottom, 0px));
    transform:none; justify-content:center; flex-wrap:wrap; gap:6px; padding:8px;
  }
  #packBar.on{ transform:none; }
  #packBar button{ height:34px; padding:0 11px; font-size:11.5px; }
  #packBar #packMsg{ font-size:11px; }
}
