/* ─── XODE PULSE · observatory dark · museum edition ────────────── */

:root {
  --bg:        #070709;
  --bg-raise:  #0c0c10;
  --ink:       #e8e6ef;
  --ink-dim:   #8e8c9a;
  --ink-faint: #55535f;
  --accent:    #e9358b;
  --gold:      #d6af62;
  --gold-hi:   #f2d492;
  --epic:      #8fd8c2;
  --hairline:  rgba(255, 255, 255, 0.08);
  --hairline2: rgba(255, 255, 255, 0.045);
  --glass:     rgba(255, 255, 255, 0.028);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(233, 53, 139, 0.045), transparent 60%),
    radial-gradient(900px 600px at 85% 110%, rgba(110, 90, 200, 0.05), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* keep content above the rain / aurora layers */
.plaque, .stage, .strip-wrap { position: relative; z-index: 2; }

/* ─── atmosphere layers ─────────────────────────────────────────── */

.rain {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 0;
}

/* full-screen aurora — awakens only for LEGENDARY blocks */
.sky-aurora {
  position: fixed; inset: -10%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 3s ease;
  background: linear-gradient(112deg,
    transparent 8%,
    rgba(233, 53, 139, 0.10) 26%,
    rgba(242, 212, 146, 0.08) 42%,
    rgba(120, 220, 185, 0.09) 58%,
    rgba(110, 140, 255, 0.10) 74%,
    transparent 92%);
  background-size: 320% 320%;
  mix-blend-mode: screen;
  filter: blur(34px);
  animation: aurora-pan 28s ease-in-out infinite alternate;
}
body.legendary-live .sky-aurora { opacity: 1; }

@keyframes aurora-pan {
  0%   { background-position: 0% 30%; }
  100% { background-position: 100% 70%; }
}

/* film grain overlay */
.grain {
  position: fixed; inset: -50%;
  pointer-events: none;
  z-index: 50;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 1.4s steps(4) infinite;
}
@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-1.2%, 0.8%); }
  50%  { transform: translate(0.9%, -1.1%); }
  75%  { transform: translate(-0.6%, -0.7%); }
  100% { transform: translate(0, 0); }
}

.glass {
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
}

/* XODE family signature: pink→blue accent hairline along the panel top */
.meta::before,
.canvas-frame::before {
  content: "";
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(233, 53, 139, 0.55) 30%,
    rgba(110, 140, 255, 0.55) 70%,
    transparent);
  pointer-events: none;
  z-index: 4;
}
.meta { position: relative; overflow: hidden; }

/* ─── family nav ────────────────────────────────────────────────── */

.fam-nav {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-right: 6px;
}
.fam-nav a {
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 0.25s;
}
.fam-nav a:hover { color: var(--accent); }
.fam-sep { color: var(--ink-faint); opacity: 0.5; font-size: 9px; }

.brand-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
  font-size: 8.5px;
  letter-spacing: 0.26em;
  color: var(--ink-faint);
}
.brand-foot a {
  color: var(--ink-dim);
  text-decoration: none;
  transition: color 0.25s;
}
.brand-foot a:hover { color: var(--accent); }

/* ─── plaque / header ───────────────────────────────────────────── */

.plaque {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 34px clamp(20px, 5vw, 64px) 10px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.34em;
  color: var(--ink-faint);
  margin-bottom: 14px;
}

.plaque h1 {
  font-size: clamp(30px, 4.4vw, 46px);
  font-weight: 300;
  letter-spacing: 0.30em;
  line-height: 1;
  color: var(--ink);
}
.plaque h1 .accent { color: var(--accent); font-weight: 500; }

.sub-kr {
  margin-top: 14px;
  font-size: 13.5px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
}

.sub-en {
  margin-top: 7px;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  max-width: 460px;
  line-height: 1.6;
}

/* header controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ctl-btn {
  position: relative;
  overflow: hidden;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.26em;
  padding: 9px 16px 9px 18px;
  color: var(--ink-dim);
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(14px);
  transition: color 0.25s, border-color 0.25s, box-shadow 0.25s;
}
/* sheen sweep on hover (XODE family signature) */
.ctl-btn::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.09), transparent);
  transform: skewX(-18deg);
  transition: left 0.5s ease;
  pointer-events: none;
}
.ctl-btn:hover::after { left: 120%; }
.ctl-btn:hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.22);
}
.ctl-btn.icon {
  padding: 8px 10px;
  display: flex;
  align-items: center;
}
.ctl-btn.icon .snd-waves { opacity: 0; transition: opacity 0.25s; }
.ctl-btn.icon .snd-slash { opacity: 1; transition: opacity 0.25s; }
.ctl-btn.icon.on { color: var(--accent); border-color: rgba(233, 53, 139, 0.45); }
.ctl-btn.icon.on .snd-waves { opacity: 1; }
.ctl-btn.icon.on .snd-slash { opacity: 0; }

/* status chip */
.status {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border-radius: 999px;
  flex: none;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-faint);
  transition: background 0.4s;
}
.status.live .status-dot {
  background: #3ddc84;
  box-shadow: 0 0 8px rgba(61, 220, 132, 0.8);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
.status.sim .status-dot {
  background: #f0b429;
  box-shadow: 0 0 8px rgba(240, 180, 41, 0.7);
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
.status-text {
  font-size: 10px;
  letter-spacing: 0.26em;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

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

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3vw, 44px);
  padding: 18px clamp(20px, 5vw, 64px) 22px;
  flex-wrap: wrap;
}

.canvas-frame {
  position: relative;
  width: min(62vh, 86vw, 640px);
  aspect-ratio: 1 / 1;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-raise);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 30px 80px -20px rgba(0, 0, 0, 0.8),
    0 0 120px -40px rgba(233, 53, 139, 0.18);
  transition: border-color 0.8s, box-shadow 0.8s;
}

.canvas-frame::after {          /* hairline inner frame, like a mat */
  content: "";
  position: absolute; inset: 10px;
  border: 1px solid var(--hairline2);
  border-radius: 3px;
  pointer-events: none;
  transition: border-color 0.8s;
  z-index: 3;
}

#art { display: block; width: 100%; height: 100%; }

/* tier escalation on the main frame */
.canvas-frame.tier-rare {
  border-color: rgba(214, 175, 98, 0.5);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 30px 80px -20px rgba(0, 0, 0, 0.8),
    0 0 90px -34px rgba(214, 175, 98, 0.4);
}
.canvas-frame.tier-rare::after { border-color: rgba(214, 175, 98, 0.22); }

.canvas-frame.tier-epic,
.canvas-frame.tier-legendary {
  border-color: rgba(242, 212, 146, 0.62);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 30px 80px -20px rgba(0, 0, 0, 0.8),
    0 0 110px -28px rgba(242, 212, 146, 0.5);
}
.canvas-frame.tier-epic::after,
.canvas-frame.tier-legendary::after { border-color: rgba(242, 212, 146, 0.3); }

/* in-frame aurora wash (EPIC and LEGENDARY) */
.frame-aurora {
  position: absolute; inset: -20%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2s ease;
  background: linear-gradient(130deg,
    transparent 10%,
    rgba(233, 53, 139, 0.16) 30%,
    rgba(242, 212, 146, 0.13) 48%,
    rgba(120, 220, 185, 0.15) 64%,
    rgba(110, 140, 255, 0.14) 80%,
    transparent 95%);
  background-size: 300% 300%;
  mix-blend-mode: screen;
  filter: blur(26px);
  animation: aurora-pan 18s ease-in-out infinite alternate;
  z-index: 2;
}
.canvas-frame.tier-epic .frame-aurora      { opacity: 0.55; }
.canvas-frame.tier-legendary .frame-aurora { opacity: 0.8; animation-duration: 13s; }

/* next-block progress ring traced around the frame */
.ring {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 4;
}
.ring rect { fill: none; }
.ring-track { stroke: rgba(255, 255, 255, 0.055); stroke-width: 1; }
.ring-prog {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  stroke-linecap: round;
  opacity: 0.75;
  filter: drop-shadow(0 0 3px rgba(233, 53, 139, 0.7));
}
.canvas-frame.tier-rare .ring-prog,
.canvas-frame.tier-epic .ring-prog,
.canvas-frame.tier-legendary .ring-prog {
  stroke: var(--gold-hi);
  filter: drop-shadow(0 0 3px rgba(242, 212, 146, 0.7));
}

/* soft flash when a block lands */
.canvas-frame.landed { animation: land-flash 1s ease; }
@keyframes land-flash {
  0%   { box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 30px 80px -20px rgba(0,0,0,0.8), 0 0 60px -10px rgba(233, 53, 139, 0.55); }
  100% { box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 30px 80px -20px rgba(0,0,0,0.8), 0 0 120px -40px rgba(233, 53, 139, 0.18); }
}

/* ─── fullscreen view ───────────────────────────────────────────── */

.fs-cap {
  position: absolute;
  left: 20px; bottom: 17px;
  z-index: 5;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(232, 230, 239, 0.5);
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}

body.fs .plaque,
body.fs .strip-wrap,
body.fs .meta { display: none; }
body.fs .stage { padding: 0; }
body.fs .canvas-frame { width: min(97vh, 97vw); }
body.fs .fs-cap { opacity: 1; }

.sim-badge {
  position: absolute;
  top: 18px; right: 18px;
  font-size: 9px;
  letter-spacing: 0.3em;
  padding: 5px 9px 5px 11px;
  color: #f0b429;
  border: 1px solid rgba(240, 180, 41, 0.35);
  border-radius: 3px;
  background: rgba(10, 9, 5, 0.55);
  backdrop-filter: blur(6px);
  z-index: 5;
}

.live-btn {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--accent);
  background: rgba(10, 7, 9, 0.6);
  border: 1px solid rgba(233, 53, 139, 0.4);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.25s, box-shadow 0.25s;
  z-index: 5;
}
.live-btn:hover {
  background: rgba(233, 53, 139, 0.12);
  box-shadow: 0 0 20px -4px rgba(233, 53, 139, 0.5);
}

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

.meta {
  width: 300px;
  max-width: 92vw;
  border-radius: 8px;
  padding: 24px 24px 20px;
  align-self: center;
  transition: border-color 0.8s, box-shadow 0.8s;
}

/* gold plaque treatment for LEGENDARY blocks */
.meta.gold {
  border-color: rgba(214, 175, 98, 0.45);
  box-shadow: 0 0 44px -16px rgba(242, 212, 146, 0.4);
}
.meta.gold .meta-title { color: var(--gold-hi); }

.meta-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--ink);
  min-height: 20px;
  margin-bottom: 18px;
  transition: color 0.8s;
}

.meta-grid {
  display: grid;
  grid-template-columns: 74px 1fr;
  row-gap: 11px;
  align-items: baseline;
}

.label {
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--ink-faint);
}

.value {
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.value.num  { font-variant-numeric: tabular-nums; color: var(--ink); }
.value.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }

.tier {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.24em;
  padding: 3px 8px 3px 10px;
  border-radius: 3px;
  border: 1px solid var(--hairline);
  color: var(--ink-dim);
  cursor: help;
}
.tier.t-rare {
  color: var(--gold);
  border-color: rgba(214, 175, 98, 0.45);
}
.tier.t-epic {
  color: var(--epic);
  border-color: rgba(143, 216, 194, 0.45);
  box-shadow: 0 0 12px -4px rgba(143, 216, 194, 0.5);
}
.tier.t-legendary {
  color: var(--gold-hi);
  border-color: rgba(242, 212, 146, 0.6);
  box-shadow: 0 0 16px -4px rgba(242, 212, 146, 0.7);
  animation: legendary-breathe 3s ease-in-out infinite;
}
@keyframes legendary-breathe {
  0%, 100% { box-shadow: 0 0 16px -4px rgba(242, 212, 146, 0.7); }
  50%      { box-shadow: 0 0 24px -2px rgba(242, 212, 146, 0.95); }
}

.divider {
  height: 1px;
  background: var(--hairline2);
  margin: 18px 0;
}

.save-btn {
  margin-top: 22px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.26em;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 11px 0;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.save-btn:hover {
  color: var(--accent);
  border-color: rgba(233, 53, 139, 0.45);
  box-shadow: 0 0 24px -8px rgba(233, 53, 139, 0.5);
}

/* ─── filmstrip ─────────────────────────────────────────────────── */

.strip-wrap {
  border-top: 1px solid var(--hairline2);
  padding: 14px clamp(20px, 5vw, 64px) 20px;
  background: rgba(255, 255, 255, 0.012);
}

.strip-label {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--ink-faint);
  margin-bottom: 11px;
}

.strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-faint) transparent;
  min-height: 96px;
}
.strip::-webkit-scrollbar { height: 5px; }
.strip::-webkit-scrollbar-thumb { background: #2a2831; border-radius: 3px; }

.thumb {
  position: relative;
  flex: none;
  width: 88px; height: 88px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-raise);
  transition: transform 0.22s ease, border-color 0.22s, box-shadow 0.22s;
  animation: thumb-in 0.5s ease both;
}
@keyframes thumb-in {
  from { opacity: 0; transform: translateY(8px) scale(0.92); }
  to   { opacity: 1; transform: none; }
}
.thumb:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.22);
}
.thumb.current {
  border-color: var(--accent);
  box-shadow: 0 0 18px -6px rgba(233, 53, 139, 0.7);
}
.thumb canvas { display: block; width: 100%; height: 100%; }

/* tier-colored edge tick */
.thumb .tick {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  pointer-events: none;
}
.thumb .tick.t-rare      { background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.thumb .tick.t-epic      { background: linear-gradient(90deg, transparent, var(--epic), transparent); }
.thumb .tick.t-legendary {
  background: linear-gradient(90deg, transparent, var(--gold-hi), transparent);
  box-shadow: 0 0 8px rgba(242, 212, 146, 0.8);
}

.thumb .t-num {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 8.5px;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: rgba(232, 230, 239, 0.75);
  background: linear-gradient(transparent, rgba(5, 5, 7, 0.85));
  padding: 10px 2px 4px;
  pointer-events: none;
}

/* ─── gallery wall ──────────────────────────────────────────────── */

.gallery {
  position: fixed; inset: 0;
  z-index: 40;
  background: rgba(5, 5, 8, 0.86);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  overflow-y: auto;
  padding: 36px clamp(20px, 5vw, 72px) 60px;
  animation: gallery-in 0.45s ease;
}
@keyframes gallery-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.gallery-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 34px;
}
.gallery-title {
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 0.34em;
  color: var(--ink);
}
.gallery-sub {
  margin-top: 8px;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: clamp(22px, 3.4vw, 46px);
  max-width: 1180px;
  margin: 0 auto;
}

.g-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 0;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
}

.g-item {
  cursor: pointer;
  animation: thumb-in 0.5s ease both;
}
.g-item:hover .g-frame {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.24);
}

/* museum frame */
.g-frame {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  padding: 7px;
  background: linear-gradient(160deg, #101014, #0a0a0d);
  box-shadow:
    0 18px 40px -16px rgba(0, 0, 0, 0.9),
    inset 0 0 0 1px rgba(0, 0, 0, 0.7);
  transition: transform 0.25s ease, border-color 0.25s, box-shadow 0.25s;
}
.g-frame canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--hairline2);
  border-radius: 2px;
  background: #08080b;
}
.g-frame.t-rare      { border-color: rgba(214, 175, 98, 0.4); }
.g-frame.t-epic      { border-color: rgba(143, 216, 194, 0.42); box-shadow: 0 18px 40px -16px rgba(0,0,0,0.9), 0 0 40px -14px rgba(143, 216, 194, 0.35); }
.g-frame.t-legendary {
  border-color: rgba(242, 212, 146, 0.6);
  box-shadow: 0 18px 40px -16px rgba(0,0,0,0.9), 0 0 56px -12px rgba(242, 212, 146, 0.5);
}

/* tiny brass plaque */
.g-plaque {
  margin: 12px auto 0;
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 13px 5px 14px;
  border-radius: 2px;
  background: linear-gradient(175deg, #c9a75f 0%, #9a7b3c 55%, #b08f4b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 200, 0.55),
    inset 0 -1px 1px rgba(40, 26, 5, 0.6),
    0 3px 8px -2px rgba(0, 0, 0, 0.7);
}
.g-no {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: #231806;
  white-space: nowrap;
}
.g-sp {
  font-size: 8.5px;
  letter-spacing: 0.12em;
  color: #3b2c10;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

@media (max-width: 760px) {
  .plaque { flex-direction: column; }
  .header-controls { justify-content: flex-start; }
  .stage  { padding-top: 8px; }
  .meta   { width: min(86vw, 640px); }
}
