/* ==========================================================================
   ECOBZ ORACLE DECK — light edition
   Shared tokens + component styles for index.html (product) and ci.html (CI)
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  /* canvas + surfaces — sky blue / white */
  --canvas: #f1f6fd;
  --canvas: #eaf1fa; /* round 3 — deeper so white cards lift */
  --canvas-2: #e8f1fd;
  --surface-1: #ffffff;
  --surface-2: #f8fbff;
  --surface-3: #e8f1fd;

  /* lines */
  --line-1: rgba(12, 27, 51, 0.08);
  --line-2: rgba(12, 27, 51, 0.14);
  --line-3: rgba(12, 27, 51, 0.26);

  /* text */
  --text-1: #0c1b33;
  --text-2: #46587a;
  --text-3: #7c8da9;

  /* accent — tech blue, used for action + ritual marks */
  --accent: #1667e8;
  --accent-strong: #0f4fbc;
  --accent-bright: #3d86fa;
  --accent-soft: rgba(22, 103, 232, 0.08);
  --accent-line: rgba(22, 103, 232, 0.3);
  --on-accent: #ffffff;
  --cyan: #22b8e6;

  /* card materials */
  --paper: #ffffff;
  --paper-2: #f7fbff;
  --ink-face: #0c1b33;
  --ink-face-2: #5a6c89;
  --ink-back: #dceafe;
  --ink-back-2: #cbe0f9;
  --back-line: rgba(22, 103, 232, 0.2);

  /* semantic */
  --ok: #17835b;
  --ok-soft: rgba(23, 131, 91, 0.09);
  --warn: #c0503a;
  --warn-soft: rgba(192, 80, 58, 0.08);

  /* radius ladder */
  --r-tag: 5px;
  --r-ctl: 9px;
  --r-card: 12px;
  --r-panel: 16px;
  --r-pill: 999px;

  /* spacing ladder */
  --sp-1: 4px;
  --sp-2: 6px;
  --sp-3: 8px;
  --sp-4: 12px;
  --sp-5: 16px;
  --sp-6: 20px;
  --sp-7: 24px;
  --sp-8: 32px;
  --sp-9: 40px;
  --sp-10: 56px;

  /* control heights */
  --ctl-sm: 28px;
  --ctl-md: 36px;
  --ctl-lg: 44px;

  /* type */
  --font-sans: "Sukhumvit Set", "SF Pro Text", "SF Pro Display", "Prompt",
    -apple-system, BlinkMacSystemFont, "Noto Sans Thai", "Thonburi", system-ui,
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  /* elevation — light, tight, never foggy */
  --el-1: 0 1px 2px rgba(12, 27, 51, 0.05);
  --el-2: 0 1px 2px rgba(12, 27, 51, 0.06), 0 8px 20px -12px rgba(12, 27, 51, 0.2);
  --el-3: 0 2px 4px rgba(12, 27, 51, 0.06), 0 18px 34px -16px rgba(12, 27, 51, 0.26);
  --el-4: 0 32px 64px -24px rgba(12, 27, 51, 0.34);

  --ease: cubic-bezier(0.22, 0.9, 0.28, 1);
  --ease-flip: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 2. Base ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--canvas);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* one soft light well behind the spread — depth without gradient noise */
body:not(.ci-page)::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    760px 420px at 50% 0%,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0) 68%
  );
  z-index: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-tag);
}

::selection {
  background: rgba(22, 103, 232, 0.18);
}

.label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* 3. Shell ----------------------------------------------------------------- */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: 0 28px;
  min-height: 64px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line-1);
  box-shadow: 0 1px 2px rgba(12, 27, 51, 0.03);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--r-tag);
  background: var(--accent);
  color: #fff;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-text {
  min-width: 0;
}

.brand-name {
  display: block;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.35;
}

.brand-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.meta-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  height: var(--ctl-sm);
  padding: 0 10px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-ctl);
  background: var(--surface-1);
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

.meta-item b {
  color: var(--text-1);
  font-weight: 600;
}

.meta-item .num {
  color: var(--text-1);
}

/* 4. Stage ----------------------------------------------------------------- */
.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-5);
  height: calc(100dvh - 64px);
  padding: 24px 28px 28px;
  overflow: hidden;
}

.stage-watermark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(80px, 18vw, 260px);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  color: var(--accent);
  opacity: 0.05;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  transition: opacity 0.3s var(--ease);
}

.stage.is-dealt .stage-watermark {
  opacity: 0;
}

.deck-zone {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-5);
}

.stage-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: 9px 14px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--el-1);
  font-size: 12.5px;
  color: var(--text-3);
}

.stage-foot b {
  color: var(--text-1);
  font-weight: 600;
}

/* 5. Deck ------------------------------------------------------------------ */
.deck-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px 18px;
}

.deck-wrap::after {
  content: "";
  position: absolute;
  left: 24%;
  right: 24%;
  bottom: 4px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    rgba(12, 27, 51, 0.2),
    rgba(12, 27, 51, 0) 72%
  );
  filter: blur(2px);
  transition: opacity 0.4s var(--ease);
}

.deck.is-dealt ~ .deck-wrap::after,
.deck.is-dealt + .deck-wrap::after {
  opacity: 0.45;
}

.deck {
  position: relative;
  width: 240px;
  aspect-ratio: 5 / 7;
  transition: transform 0.36s var(--ease);
}

.deck:hover {
  transform: translateY(-5px);
}

.deck:disabled {
  cursor: default;
  transform: none;
}

.deck-layer {
  position: absolute;
  inset: 0;
  border-radius: var(--r-card);
  background:
    repeating-linear-gradient(45deg, rgba(22, 103, 232, 0.1) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(-45deg, rgba(22, 103, 232, 0.1) 0 1px, transparent 1px 22px),
    linear-gradient(160deg, var(--ink-back) 0%, var(--ink-back-2) 100%);
  border: 1px solid var(--back-line);
  box-shadow: 0 2px 6px -2px rgba(12, 27, 51, 0.2);
}

.deck-layer:nth-child(1) {
  transform: translate(-8px, 6px) rotate(-4.6deg);
}

.deck-layer:nth-child(2) {
  transform: translate(-5.5px, 4px) rotate(-3deg);
}

.deck-layer:nth-child(3) {
  transform: translate(-3px, 2.2px) rotate(-1.6deg);
}

.deck-layer:nth-child(4) {
  transform: translate(-1px, 0.8px) rotate(-0.5deg);
}

.deck-card {
  position: absolute;
  inset: 0;
  container-type: inline-size;
}

.deck-card .card-inner {
  box-shadow: var(--el-3);
}

.deck.is-shuffling {
  animation: shuffle 0.8s var(--ease);
}

.deck.is-shuffling .deck-layer:nth-child(1) {
  animation: shuffle-layer 0.8s var(--ease);
}

.deck.is-shuffling .deck-layer:nth-child(2) {
  animation: shuffle-layer 0.8s var(--ease) 0.06s;
}

.deck.is-shuffling .deck-card {
  animation: shuffle-top 0.8s var(--ease);
}

@keyframes shuffle {
  0%,
  100% {
    transform: translateY(-5px);
  }
  30% {
    transform: translateY(-11px) rotate(-2deg);
  }
  62% {
    transform: translateY(-3px) rotate(1.4deg);
  }
}

@keyframes shuffle-layer {
  0%,
  100% {
    transform: translate(-14px, 11px) rotate(-7.5deg);
  }
  40% {
    transform: translate(-20px, 6px) rotate(-11deg);
  }
}

@keyframes shuffle-top {
  0%,
  100% {
    transform: none;
  }
  25% {
    transform: translate(-7px, -4px) rotate(-4deg);
  }
  55% {
    transform: translate(6px, -7px) rotate(3deg);
  }
  80% {
    transform: translate(-1px, -1px) rotate(-1deg);
  }
}

.deck.is-dealt .deck-layer,
.deck.is-dealt .deck-card {
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.deck-hint {
  text-align: center;
  max-width: 30ch;
}

.deck-hint strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-1);
  margin-bottom: 3px;
}

.deck-hint span {
  display: block;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.6;
}

.svc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

/* 6. Spread ---------------------------------------------------------------- */
.spread {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 18px;
  width: min(800px, calc(100dvh - 130px), 100%);
  max-width: 900px;
  align-content: center;
  justify-content: center;
  padding: 2px;
  overflow: visible;
}

.slot {
  position: relative;
  aspect-ratio: 5 / 7;
  perspective: 1400px;
  min-width: 0;
  container-type: inline-size;
}

.slot-ghost {
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-card);
  background:
    repeating-linear-gradient(45deg, rgba(22, 103, 232, 0.05) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(-45deg, rgba(22, 103, 232, 0.05) 0 1px, transparent 1px 18px),
    linear-gradient(166deg, rgba(220, 234, 254, 0.85) 0%, rgba(247, 251, 255, 0.9) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.6cqw;
  transition: opacity 0.3s var(--ease);
}

.ghost-seal {
  width: 30%;
  color: var(--accent);
  opacity: 0.5;
}

.ghost-index {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.2em;
  color: var(--text-3);
  text-indent: 0.2em;
}

.slot.is-dealt .slot-ghost {
  opacity: 0;
}

/* 7. Card ------------------------------------------------------------------ */
.card {
  position: absolute;
  inset: 0;
  padding: 0;
  border-radius: var(--r-card);
  background: transparent;
  transition: transform 0.6s var(--ease), box-shadow 0.3s var(--ease);
  outline-offset: 3px;
}

.card.is-predeal {
  opacity: 0;
  transform: translate(var(--deal-x, 0), var(--deal-y, 0)) rotate(var(--deal-r, -7deg))
    scale(0.9);
  transition: none;
}

.card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.64s var(--ease-flip);
  border-radius: var(--r-card);
}

.card.is-open .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-card);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

/* back — sky-blue card stock with grid and seal */
.card-back {
  background:
    repeating-linear-gradient(45deg, rgba(22, 103, 232, 0.1) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(-45deg, rgba(22, 103, 232, 0.1) 0 1px, transparent 1px 22px),
    linear-gradient(160deg, #dceafe 0%, #cbe0f9 100%);
  border: 1px solid var(--back-line);
  box-shadow: var(--el-2);
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.card-back::before {
  content: "";
  position: absolute;
  inset: 4.4cqw;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: calc(var(--r-card) - 4px);
}

.card-back::after {
  content: "";
  position: absolute;
  inset: 6.4cqw;
  border: 1px solid rgba(22, 103, 232, 0.12);
  border-radius: calc(var(--r-card) - 7px);
}

.card-seal {
  display: grid;
  place-items: center;
  width: 38%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  background: rgba(34, 184, 230, 0.12);
  color: var(--cyan);
}

.card-seal svg {
  width: 54%;
  height: 54%;
}

.card-back-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 58%;
  height: auto;
  transform: translate(-50%, -56%);
  color: rgba(22, 103, 232, 0.18);
  pointer-events: none;
}

.card-logo {
  position: relative;
  z-index: 1;
  margin-top: auto;
  margin-bottom: 1.4cqw;
  font-size: 7cqw;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--accent);
}

.card-tagline {
  position: relative;
  z-index: 1;
  margin-top: 2.2cqw;
  font-size: 2.8cqw;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  text-transform: uppercase;
  color: var(--ink-face-2);
}

/* front — clean white paper */
.card-front {
  --card-inner-line: rgba(22, 103, 232, 0.28);
  transform: rotateY(180deg);
  background: linear-gradient(170deg, #ffffff 0%, #f7fbff 100%);
  border: 1px solid rgba(22, 103, 232, 0.34);
  box-shadow: 0 12px 24px -14px rgba(12, 27, 51, 0.28);
  align-items: center;
  justify-content: space-between;
  padding: 7.5cqw 7cqw 7cqw;
  color: var(--ink-face);
  text-align: center;
}

.card-front::before {
  content: "";
  position: absolute;
  inset: 3.6cqw;
  border: 1px solid var(--card-inner-line);
  border-radius: calc(var(--r-card) - 6px);
  pointer-events: none;
}

.card-front::after {
  content: "";
  position: absolute;
  inset: 8.4cqw;
  border-radius: calc(var(--r-card) - 8px);
  background: radial-gradient(
    62% 58% at 50% 42%,
    rgba(255, 255, 255, 0.75),
    rgba(255, 255, 255, 0) 70%
  );
  pointer-events: none;
}

.card-numeral {
  position: relative;
  z-index: 1;
  font-size: 4.4cqw;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--ink-face);
  text-indent: 0.34em;
}

.card-glyph {
  position: relative;
  z-index: 1;
  width: 56%;
  stroke-width: 1.6;
  color: var(--ink-face);
}

.card-name {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.6cqw;
  align-items: center;
}

.card-name-th {
  font-size: 8.4cqw;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
}

.card-name-en {
  font-size: 4.2cqw;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-face-2);
  text-indent: 0.22em;
}

.card-service {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 1.6cqw;
  margin-top: 2.4cqw;
  padding-top: 2.4cqw;
  border-top: 1px solid rgba(22, 103, 232, 0.14);
  width: 84%;
  justify-content: center;
  font-size: 3.8cqw;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-face-2);
}

.card-service::before {
  content: "";
  width: 1.5cqw;
  height: 1.5cqw;
  border-radius: 50%;
  background: var(--cyan);
  flex: 0 0 auto;
}

.card-win-mark,
.card-lose-mark {
  position: absolute;
  z-index: 2;
  padding: 1.2cqw 2cqw;
  border-radius: 999px;
  border: 1px solid;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.card-win-mark {
  top: 6cqw;
  right: 6cqw;
  font-size: 4.2cqw;
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.card-lose-mark {
  top: 6cqw;
  right: 6cqw;
  font-size: 4.2cqw;
  color: var(--warn);
  border-color: rgba(192, 80, 58, 0.28);
  background: var(--warn-soft);
}

/* interaction */
.card.is-locked {
  pointer-events: none;
  cursor: default;
}

.slot:has(.card:not(.is-predeal)):hover .card {
  transform: translateY(-6px);
}

.slot:has(.card:not(.is-predeal)):hover .card-inner {
  box-shadow: var(--el-3);
}

.slot:has(.card.is-open):hover .card {
  transform: none;
}

.slot:has(.card.is-open):hover .card-inner {
  box-shadow: var(--el-2);
}

.card.is-open .card-back,
.card.is-open .card-front {
  pointer-events: none;
}

.card.is-selected .card-front {
  box-shadow: 0 0 0 2px var(--accent), var(--el-2);
}

.card.is-claimed .card-front::before {
  border-color: var(--accent-line);
}

.card.is-chosen {
  z-index: 3;
  transform: scale(1.03);
}

.card.is-chosen .card-inner {
  box-shadow: 0 0 0 2px var(--accent), var(--el-3);
}

.slot:has(.card.is-chosen):hover .card {
  transform: scale(1.03);
}

.card.is-dimmed {
  opacity: 0.72;
}

.card.is-dimmed .card-inner {
  box-shadow: var(--el-1);
}

/* 7b. Rarity materials, patterns & layers -------------------------------- */
.card-front.rarity-r {
  --ink-face: #0c1b33;
  --ink-face-2: #5a6c89;
  background: linear-gradient(170deg, #ffffff 0%, #f7fbff 100%);
}

.card-front.rarity-sr {
  --ink-face: #0c1b33;
  --ink-face-2: #4a5e82;
  background: linear-gradient(170deg, #f3f8ff 0%, #e3efff 100%);
}

.card-front.rarity-ssr {
  --ink-face: #4a3410;
  --ink-face-2: #7a5c22;
  background: linear-gradient(170deg, #fff8e6 0%, #fbebc4 100%);
  border-color: rgba(201, 150, 43, 0.6);
}

.card-front.rarity-sss {
  --ink-face: #e8eeff;
  --ink-face-2: rgba(232, 238, 255, 0.72);
  background: linear-gradient(170deg, #0b0d12 0%, #14161c 100%);
  border-color: transparent;
}

.card-front.rarity-sss::before {
  inset: 0;
  padding: 1.5px;
  border: 0;
  border-radius: var(--r-card);
  background: conic-gradient(from 0deg, #7dd3fc, #a78bfa, #fbcfe8, #fde68a, #7dd3fc);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.card-pattern {
  --pat-ink: rgba(22, 103, 232, 0.9);
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--r-card);
  opacity: 0.12;
  pointer-events: none;
}

.card-front.rarity-ssr .card-pattern {
  --pat-ink: rgba(122, 92, 34, 0.9);
}

.card-front.rarity-sss .card-pattern {
  --pat-ink: rgba(232, 238, 255, 0.9);
  opacity: 0.16;
}

.card-front.rarity-sss::after {
  background: radial-gradient(
    62% 58% at 50% 42%,
    rgba(232, 238, 255, 0.06),
    rgba(232, 238, 255, 0) 70%
  );
}

/* bonus card — Second Chance */
.card-front.card-bonus {
  border-color: rgba(34, 184, 230, 0.55);
  box-shadow: 0 12px 28px -14px rgba(34, 184, 230, 0.45);
}

.card-front .bonus-badge {
  border-color: rgba(34, 184, 230, 0.55);
  background: rgba(34, 184, 230, 0.16);
  color: #0b5c74;
}

.card.is-bonus-used .card-front {
  filter: saturate(0.6);
}

.card.is-bonus-used .bonus-badge {
  opacity: 0.55;
}

.card-pattern.pat-1 {
  background-image: radial-gradient(circle, var(--pat-ink) 1px, transparent 1.7px);
  background-size: 5cqw 5cqw;
}

.card-pattern.pat-2 {
  background-image:
    repeating-linear-gradient(0deg, var(--pat-ink) 0 1px, transparent 1px 5cqw),
    repeating-linear-gradient(90deg, var(--pat-ink) 0 1px, transparent 1px 5cqw);
}

.card-pattern.pat-3 {
  background-image: conic-gradient(
    from 0deg at 50% 50%,
    var(--pat-ink) 0 6deg,
    transparent 6deg 30deg
  );
}

.card-pattern.pat-4 {
  background-image: repeating-radial-gradient(
    circle at 50% 120%,
    var(--pat-ink) 0 1px,
    transparent 1px 5cqw
  );
}

.card-pattern.pat-5 {
  background-image:
    radial-gradient(circle at 20% 25%, var(--pat-ink) 0 1px, transparent 1.6px),
    radial-gradient(circle at 70% 60%, var(--pat-ink) 0 1px, transparent 1.6px),
    radial-gradient(circle at 40% 80%, var(--pat-ink) 0 1px, transparent 1.6px);
  background-size: 12cqw 12cqw;
}

.card-pattern.pat-6 {
  background-image: repeating-radial-gradient(
    circle at 0 50%,
    transparent 0 4cqw,
    var(--pat-ink) 4cqw 4.5cqw
  );
}

.card-sheen,
.card-holo {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--r-card);
  pointer-events: none;
}

.card-sheen {
  background: linear-gradient(
    115deg,
    transparent 40%,
    rgba(255, 255, 255, 0.75) 50%,
    transparent 60%
  );
}

.card-holo {
  background: conic-gradient(
    from 210deg at 30% 30%,
    rgba(125, 211, 252, 0.8),
    rgba(167, 139, 250, 0.7),
    rgba(251, 207, 232, 0.7),
    rgba(253, 230, 138, 0.6),
    rgba(125, 211, 252, 0.8)
  );
  opacity: 0.12;
  mix-blend-mode: screen;
}

.rarity-badge {
  position: absolute;
  top: 6cqw;
  left: 6cqw;
  z-index: 3;
  padding: 1cqw 2.2cqw;
  border: 1px solid rgba(22, 103, 232, 0.4);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink-face);
  font-size: 3.4cqw;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.card-front.rarity-ssr .rarity-badge {
  border-color: rgba(201, 150, 43, 0.6);
  background: rgba(201, 150, 43, 0.14);
  color: #7a5c22;
}

.card-front.rarity-sss .rarity-badge {
  border: 1.5px solid transparent;
  background:
    linear-gradient(#0b0d12, #0b0d12) padding-box,
    conic-gradient(from 0deg, #7dd3fc, #a78bfa, #fbcfe8, #fde68a, #7dd3fc) border-box;
  color: #e8eeff;
}

.card-front.rarity-ssr .card-win-mark {
  color: #4a3410;
  border-color: rgba(122, 92, 34, 0.5);
  background: rgba(201, 150, 43, 0.18);
}

.card-front.rarity-ssr .card-lose-mark {
  color: #7a2d1c;
  border-color: rgba(122, 45, 28, 0.4);
  background: rgba(192, 80, 58, 0.12);
}

.card-front.rarity-sss .card-win-mark {
  color: #e8eeff;
  border-color: rgba(232, 238, 255, 0.5);
  background: rgba(232, 238, 255, 0.12);
}

.card-front.rarity-sss .card-lose-mark {
  color: #e8eeff;
  border-color: rgba(232, 238, 255, 0.5);
  background: rgba(232, 238, 255, 0.12);
}

.card-front.rarity-sss .card-service {
  color: #e8eeff;
  border-top-color: rgba(232, 238, 255, 0.24);
}

/* 8. Reading overlay ------------------------------------------------------- */
.reading-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: var(--sp-6);
  background: rgba(12, 27, 51, 0.30);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s var(--ease), visibility 0.22s var(--ease);
}

.reading-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.reading-panel {
  width: min(94vw, 960px);
  max-width: 960px;
  max-height: min(88dvh, 760px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-6);
  border: 1px solid var(--line-1);
  border-radius: 18px;
  background: var(--surface-1);
  box-shadow: var(--el-4);
  transform: translateY(10px) scale(0.99);
  transition: transform 0.24s var(--ease);
}

.reading-backdrop.is-open .reading-panel {
  transform: none;
}

.reading-grid {
  display: grid;
  grid-template-columns: clamp(280px, 26vw, 320px) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.reading-main {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}

.reading-card {
  position: sticky;
  top: 0;
  width: 100%;
  aspect-ratio: 5 / 7;
  perspective: 1400px;
  container-type: inline-size;
}

.reading-card .card {
  width: 100%;
  height: auto;
  cursor: default;
}

@media (max-width: 900px) {
  .reading-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .reading-card {
    position: static;
    max-width: 200px;
    margin-inline: auto;
  }
}

.reading-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.reading-top-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.reading-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.reading-title {
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-top: 2px;
}

.reading-en {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 5px;
}

.reading-text {
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--text-2);
  padding-left: var(--sp-4);
  border-left: 2px solid var(--accent-line);
}

.prize-block {
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface-2);
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-4) + 1px);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.prize-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.prize-head .label {
  white-space: nowrap;
}

.prize-name {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.prize-meta {
  font-size: 12px;
  color: var(--text-3);
}

.service-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line-1);
}

.service-note p:last-child {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.7;
}

.reading-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-top: 20px;
}

/* 9. Buttons + chips + fields --------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--ctl-md);
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--r-ctl);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.005em;
  white-space: nowrap;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
    color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.btn svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  border: 1px solid var(--accent);
  box-shadow: 0 1px 2px rgba(22, 103, 232, 0.24);
}

.btn-primary:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
}

.btn-primary:active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: none;
  transform: translateY(0.5px);
}

.btn-secondary {
  background: var(--surface-1);
  border: 1px solid var(--line-2);
  color: var(--text-1);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--line-3);
}

.btn-quiet {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
}

.btn-quiet:hover {
  background: var(--surface-3);
  color: var(--text-1);
}

.btn-lg {
  height: var(--ctl-lg);
  min-height: 64px;
  font-size: 18px;
  padding: 0 28px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  background: var(--surface-3);
  color: var(--text-3);
  border-color: var(--line-2);
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--r-tag);
  color: var(--text-3);
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
}

.icon-btn:hover {
  color: var(--text-1);
  background: var(--surface-3);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.icon-btn svg {
  width: 13px;
  height: 13px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 23px;
  padding: 0 8px;
  border-radius: var(--r-tag);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line-2);
  background: var(--surface-1);
  color: var(--text-2);
  white-space: nowrap;
}

.chip-accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chip-ok {
  border-color: rgba(23, 131, 91, 0.34);
  background: var(--ok-soft);
  color: var(--ok);
}

.chip-win {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chip-lose {
  border-color: rgba(192, 80, 58, 0.3);
  background: var(--warn-soft);
  color: var(--warn);
}

.chip-bonus {
  border-color: rgba(34, 184, 230, 0.55);
  background: rgba(34, 184, 230, 0.14);
  color: #0b5c74;
}

.chip-dot::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
}

.input {
  height: var(--ctl-md);
  min-height: 56px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  background: var(--surface-1);
  font-size: 17px;
  color: var(--text-1);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.input::placeholder {
  color: var(--text-3);
}

.input:hover {
  border-color: var(--line-3);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input[aria-invalid="true"] {
  border-color: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
}

.field-error {
  font-size: 11.5px;
  color: var(--warn);
  display: none;
}

.field.is-invalid .field-error {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

/* 10. Modal ---------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: var(--sp-6);
  background: rgba(30, 26, 21, 0.34);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: min(432px, 100%);
  border: 1px solid var(--line-1);
  border-radius: 18px;
  background: var(--surface-1);
  box-shadow: var(--el-4);
  transform: translateY(10px) scale(0.99);
  transition: transform 0.24s var(--ease);
  overflow: hidden;
}

.modal-backdrop.is-open .modal {
  transform: none;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-5) 0;
}

.modal-body {
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.modal-foot {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line-1);
  background: var(--surface-2);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 11px 12px;
  border: 1px dashed var(--accent-line);
  border-radius: var(--r-ctl);
  background: var(--accent-soft);
}

.code-value {
  font: 600 16px/1 var(--mono);
  letter-spacing: 0.16em;
  color: var(--accent-strong);
}

.modal-note {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.7;
}

.modal-note b {
  color: var(--text-2);
  font-weight: 600;
}

.modal-claim .modal-head {
  align-items: center;
}

.claim-qr-body {
  align-items: center;
  text-align: center;
}

.claim-qr-lead {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-2);
}

.claim-qr {
  width: min(60vw, 360px);
  height: auto;
  padding: 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #fff;
  box-sizing: content-box;
  image-rendering: auto;
  box-shadow: var(--el-2);
}

.claim-qr-prize {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-1);
}

/* 11. Audit overlay -------------------------------------------------------- */
.audit-toggle {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 2147483647;
  height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(38, 32, 24, 0.2);
  border-radius: var(--r-tag);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-2);
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--el-2);
}

.audit-toggle:hover {
  color: var(--text-1);
  border-color: rgba(38, 32, 24, 0.4);
}

.audit-toggle[aria-pressed="true"] {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

body.audit-mode [data-ui] {
  outline: 1px solid rgba(29, 78, 216, 0.95);
  outline-offset: -1px;
}

body.audit-mode.audit-deep .stage * {
  outline: 1px dashed rgba(190, 40, 40, 0.4);
}

.audit-label {
  position: fixed;
  z-index: 2147483646;
  pointer-events: none;
  padding: 2px 5px;
  border-radius: 3px;
  background: #16233d;
  border: 1px solid rgba(90, 130, 220, 0.8);
  color: #e6eeff;
  font: 500 10px/1.35 var(--mono);
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

@media print {
  .audit-toggle,
  .audit-label {
    display: none !important;
  }
}

/* 13. Responsive ----------------------------------------------------------- */
@media (max-width: 1199px) {
  .stage {
    padding: 18px 18px 22px;
  }

  .deck {
    width: 180px;
  }

  .spread {
    width: min(560px, 66dvh, 100%);
  }

  .reading-title {
    font-size: 24px;
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 58px;
    padding: 0 14px;
    gap: var(--sp-3);
  }

  .brand-sub {
    display: none;
  }

  .brand-name {
    font-size: 14px;
    letter-spacing: 0.18em;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .topbar-meta .meta-item {
    height: 26px;
    font-size: 11.5px;
    padding: 0 8px;
  }

  .topbar-meta .meta-item:nth-child(2) {
    display: none;
  }

  .stage {
    height: calc(100dvh - 58px);
    padding: 12px 14px 18px;
    gap: var(--sp-3);
  }

  .deck {
    width: 140px;
  }

  .deck-hint strong {
    font-size: 14.5px;
  }

  .deck-hint span {
    font-size: 11px;
  }

  .spread {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(330px, calc((100dvh - 150px) / 2.1), 100%);
    gap: 14px 12px;
  }

  .card-name-th {
    font-size: 9cqw;
  }

  .card-numeral {
    font-size: 5cqw;
  }

  .card-name-en {
    display: none;
  }

  .card-service {
    font-size: 4.4cqw;
  }

  .stage-foot {
    font-size: 11.5px;
    padding: 7px 10px;
  }

  .reading-backdrop {
    place-items: end center;
    padding: 0;
  }

  .reading-panel {
    width: 100%;
    max-width: 520px;
    max-height: 88dvh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    padding: var(--sp-5) var(--sp-5) var(--sp-7);
  }

  .reading-title {
    font-size: 23px;
  }

  .reading-text {
    font-size: 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: var(--sp-3);
    place-items: end center;
  }

  .modal {
    width: 100%;
    border-radius: 18px 18px 0 0;
    margin-bottom: -8px;
  }
}

/* 13b. Large screens — the booth display case ------------------------------- */
@media (min-width: 1500px) {
  body {
    font-size: 15px;
  }

  .brand-name {
    font-size: 16px;
  }

  .brand-sub {
    font-size: 12.5px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .label {
    font-size: 11.5px;
  }

  .meta-item {
    height: 30px;
    font-size: 13px;
  }

  .deck-hint strong {
    font-size: 19px;
  }

  .deck-hint span {
    font-size: 13.5px;
  }

  .reading-title {
    font-size: 32px;
  }

  .reading-en {
    font-size: 11.5px;
  }

  .reading-text {
    font-size: 16px;
  }

  .prize-name {
    font-size: 17px;
  }

  .prize-meta {
    font-size: 13px;
  }

  .btn {
    height: 48px;
    font-size: 17px;
  }

  .btn-lg {
    height: 64px;
    font-size: 18px;
  }

  .chip {
    height: 25px;
    font-size: 11.5px;
  }

  .service-note p:last-child {
    font-size: 13.5px;
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-note {
    font-size: 13px;
  }

  .code-value {
    font-size: 18px;
  }

  .field-label {
    font-size: 12.5px;
  }

  .input {
    height: 56px;
    font-size: 17px;
  }
}

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

/* ==========================================================================
   15. CI page — layout only, same tokens & components
   ========================================================================== */
.ci-page {
  display: block;
  padding: 40px 32px 80px;
  background: var(--canvas);
}

.ci-wrap {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-10);
}

.ci-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--line-2);
}

.ci-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.ci-lede {
  font-size: 14px;
  color: var(--text-2);
  max-width: 72ch;
  line-height: 1.75;
}

.ci-lede b {
  color: var(--text-1);
}

.ci-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ci-nav a {
  font-size: 11px;
  text-decoration: none;
  color: var(--text-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-tag);
  padding: 4px 8px;
  background: var(--surface-1);
}

.ci-nav a:hover {
  color: var(--text-1);
  border-color: var(--line-3);
}

.ci-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  scroll-margin-top: 20px;
}

.ci-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line-2);
}

.ci-h2 {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ci-note {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.7;
}

.ci-grid {
  display: grid;
  gap: var(--sp-4);
}

.ci-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ci-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ci-grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ci-grid.cols-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.ci-card {
  border: 1px solid var(--line-1);
  border-radius: var(--r-panel);
  background: var(--surface-1);
  box-shadow: var(--el-1);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
}

.ci-swatch {
  height: 54px;
  border-radius: var(--r-tag);
  border: 1px solid var(--line-1);
}

.ci-swatch-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ci-token {
  font: 500 10.5px/1.4 var(--mono);
  color: var(--text-2);
}

.ci-hex {
  font: 500 10.5px/1.4 var(--mono);
  color: var(--text-3);
  word-break: break-word;
}

.ci-type-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: 10px 0;
  border-bottom: 1px dashed var(--line-2);
}

.ci-type-row:last-child {
  border-bottom: 0;
}

.ci-type-spec {
  font: 500 10.5px/1.4 var(--mono);
  color: var(--text-3);
  white-space: nowrap;
  flex: 0 0 auto;
}

.ci-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ci-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ci-bar i {
  display: block;
  height: 8px;
  background: var(--accent-soft);
  border-left: 1px solid var(--accent-line);
  border-radius: 1px;
}

.ci-bar span {
  font: 500 10.5px/1 var(--mono);
  color: var(--text-3);
  white-space: nowrap;
}

.ci-radius-demo {
  height: 62px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
}

.ci-state-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

.demo-hover {
  background: var(--accent-bright) !important;
  border-color: var(--accent-bright) !important;
}

.demo-focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ci-spec-frame {
  background: var(--surface-2);
  border: 1px solid var(--line-1);
  border-radius: var(--r-ctl);
  padding: var(--sp-5);
  display: grid;
  place-items: center;
  gap: var(--sp-4);
}

.spec-card {
  width: 136px;
  aspect-ratio: 5 / 7;
  position: relative;
}

.spec-card .card,
.spec-card .slot-ghost {
  position: absolute;
}

.ci-kv {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: 7px 0;
  border-bottom: 1px dashed var(--line-2);
  font-size: 12.5px;
  color: var(--text-2);
}

.ci-kv b {
  color: var(--text-1);
  font-weight: 600;
  text-align: right;
}

.ci-kv:last-child {
  border-bottom: 0;
}

.ci-handle-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ci-handle-table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-2);
}

.ci-handle-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-1);
  color: var(--text-2);
  vertical-align: top;
}

.ci-handle-table td:first-child {
  font: 500 11.5px/1.5 var(--mono);
  color: var(--accent-strong);
  white-space: nowrap;
}

.ci-handle-table tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 860px) {
  .ci-page {
    padding: 28px 18px 60px;
  }

  .ci-grid.cols-2,
  .ci-grid.cols-3,
  .ci-grid.cols-4,
  .ci-grid.cols-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 660px) {
  .ci-grid.cols-2,
  .ci-grid.cols-3,
  .ci-grid.cols-4,
  .ci-grid.cols-6 {
    grid-template-columns: minmax(0, 1fr);
  }

  .ci-section-head {
    flex-direction: column;
    gap: 6px;
  }

  .ci-kv {
    flex-direction: column;
    gap: 2px;
  }

  .ci-kv b {
    text-align: left;
  }

  .ci-type-row {
    flex-direction: column;
    gap: 4px;
  }

  .ci-title {
    font-size: 23px;
  }

  .ci-handle-table {
    table-layout: fixed;
  }

  .ci-handle-table td:first-child {
    white-space: normal;
    word-break: break-word;
  }

  .ci-handle-table th:nth-child(1) {
    width: 42%;
  }
}

/* 11. Prize inventory admin ------------------------------------------------ */
.admin-fab {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
  color: var(--text-3);
  opacity: 0.5;
  backdrop-filter: blur(4px);
  transition: opacity 0.16s var(--ease), background 0.16s var(--ease),
    color 0.16s var(--ease);
}

.admin-fab:hover,
.admin-fab:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-1);
}

body.is-claim-open .admin-fab {
  opacity: 0;
  pointer-events: none;
}

.admin-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: var(--sp-6);
  background: rgba(30, 26, 21, 0.34);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
}

.admin-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.admin-panel-inner {
  width: min(560px, 100%);
  border: 1px solid var(--line-1);
  border-radius: 18px;
  background: var(--surface-1);
  box-shadow: var(--el-4);
  overflow: hidden;
  transform: translateY(10px) scale(0.99);
  transition: transform 0.24s var(--ease);
}

.admin-backdrop.is-open .admin-panel-inner {
  transform: none;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--line-1);
}

.admin-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.admin-rows {
  display: flex;
  flex-direction: column;
  max-height: 55vh;
  overflow: auto;
  padding: var(--sp-2) var(--sp-5);
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line-1);
  font-size: 13.5px;
}

.admin-row:last-child {
  border-bottom: 0;
}

.admin-row-name {
  font-weight: 600;
  min-width: 0;
}

.admin-cell {
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.admin-cell b {
  color: var(--text-1);
}

.admin-cell-remaining b {
  color: var(--accent);
}

.admin-foot {
  display: flex;
  justify-content: flex-end;
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line-1);
  background: var(--surface-2);
}

@media (max-width: 560px) {
  .admin-row {
    grid-template-columns: minmax(0, 1fr) repeat(3, auto);
    gap: var(--sp-2);
    font-size: 12.5px;
  }
}
