:root {
  --canvas-bg: #ebebeb;
  --stamp-paper: #f6f4ea;
  --stamp-blank: #f2f1e6;
  --stamp-game: #eaede5;
  --stamp-hover-dark: #151618;
  --ink-1: #111111;
  --ink-2: #4a4842;
  --ink-3: #767268;
  --hairline: rgba(17, 17, 17, 0.10);
  --hairline-strong: rgba(17, 17, 17, 0.22);
  --font-sans: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--canvas-bg);
  color: var(--ink-1);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  user-select: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* Pure Boundless Matte Open Sheet Stage with Guaranteed Top & Bottom Minimum Breathing Margins */
.stage-outer {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 72px 16px 80px;
  overflow-x: clip;
}

.sheet-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
}

.arena-viewport {
  position: relative;
  transition: width 320ms var(--ease-spring), height 320ms var(--ease-spring);
}

.arena-viewport.is-flipping-next {
  animation: sheetFlipNext 240ms var(--ease-spring);
}

.arena-viewport.is-flipping-prev {
  animation: sheetFlipPrev 240ms var(--ease-spring);
}

@keyframes sheetFlipNext {
  0% {
    opacity: 0.48;
    transform: translateX(16px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes sheetFlipPrev {
  0% {
    opacity: 0.48;
    transform: translateX(-16px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Positioned Stamp / Signature Entity Strictly Inside Virtual Sheet [0..C-1] x [0..R-1] */
.grid-entity {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform, width, height;
  transition:
    transform 420ms var(--ease-spring),
    width 390ms var(--ease-spring),
    height 390ms var(--ease-spring),
    filter 190ms var(--ease-spring);
}

.grid-entity.is-dragging {
  transition: none !important;
  z-index: 45 !important;
  opacity: 0.88;
}

.grid-entity.is-stamp {
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.11));
  z-index: 2;
}

/* 우표섬네일 원칙: 외부 팝오버 없이 제자리 부드러운 확대 + 한 줄 단어 섬네일 전환 */
.grid-entity.is-stamp:not(.is-expanded):hover {
  z-index: 20;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.18));
}

.stamp-scale-shell {
  width: 100%;
  height: 100%;
  transition: transform 200ms var(--ease-spring);
}

.grid-entity.is-stamp:not(.is-expanded):hover .stamp-scale-shell {
  transform: scale(1.15);
}

/* Authentic 4-Edge Perforated Postage Stamp (Generous 62x65px Open-Sheet Scale) */
.stamp-paper {
  --r: 2.8px;
  --s: 9.2px;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 5px;
  background-color: var(--stamp-paper);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  -webkit-mask-image:
    radial-gradient(circle var(--r) at 50% 0, transparent 96%, #000 100%),
    radial-gradient(circle var(--r) at 50% 100%, transparent 96%, #000 100%),
    radial-gradient(circle var(--r) at 0 50%, transparent 96%, #000 100%),
    radial-gradient(circle var(--r) at 100% 50%, transparent 96%, #000 100%);
  -webkit-mask-size:
    var(--s) 100%,
    var(--s) 100%,
    100% var(--s),
    100% var(--s);
  -webkit-mask-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  -webkit-mask-composite: destination-in;
  mask-image:
    radial-gradient(circle var(--r) at 50% 0, transparent 96%, #000 100%),
    radial-gradient(circle var(--r) at 50% 100%, transparent 96%, #000 100%),
    radial-gradient(circle var(--r) at 0 50%, transparent 96%, #000 100%),
    radial-gradient(circle var(--r) at 100% 50%, transparent 96%, #000 100%);
  mask-size:
    var(--s) 100%,
    var(--s) 100%,
    100% var(--s),
    100% var(--s);
  mask-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  mask-composite: intersect;
}

.stamp-paper.is-blank {
  background-color: var(--stamp-blank);
}

.stamp-paper.is-ad {
  background-color: #f4f2e6;
}

.stamp-paper.is-game {
  background-color: var(--stamp-game);
}

.face-art {
  position: absolute;
  inset: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 175ms var(--ease-spring), transform 195ms var(--ease-spring);
}

.face-art svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Blank Uncollected Stamp Inner Frame */
.blank-box {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(25, 24, 21, 0.08);
  position: relative;
}

.blank-tick {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 5px;
  height: 5px;
  border-right: 1px solid rgba(25, 24, 21, 0.16);
  border-bottom: 1px solid rgba(25, 24, 21, 0.16);
}

/* Hover Face — Single-Line Word Thumbnail + Compact Domain (우표섬네일 원칙) */
.face-word {
  position: absolute;
  inset: 3.5px;
  background: var(--stamp-hover-dark);
  color: #f7f5eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 3px;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 165ms var(--ease-spring), transform 185ms var(--ease-spring);
  pointer-events: none;
}

.grid-entity.is-stamp:not(.is-expanded):hover .face-art {
  opacity: 0;
  transform: scale(1.06);
}

.grid-entity.is-stamp:not(.is-expanded):hover .face-word {
  opacity: 1;
  transform: scale(1);
}

.word-code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.05;
  white-space: nowrap;
  color: #ffffff;
}

.word-code.is-compact {
  font-size: 9.6px;
  letter-spacing: -0.02em;
}

.word-domain {
  margin-top: 3.5px;
  font-family: var(--font-mono);
  font-size: 7.6px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #d7be7a;
}

/* 1 -> 6 In-Frame Self-Morphing Expanded Video Tile */
.grid-entity.is-expanded {
  z-index: 30;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.28));
}

.grid-entity.is-expanded .stamp-paper {
  padding: 0;
  border-radius: 2px;
  -webkit-mask: none;
  -webkit-mask-image: none;
  mask: none;
  mask-image: none;
  background: #101419;
}

.expanded-cinema {
  position: relative;
  width: 100%;
  height: 100%;
  background: #101419;
  cursor: pointer;
  overflow: hidden;
}

.expanded-cinema canvas,
.expanded-cinema video,
.expanded-cinema iframe {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border: 0;
  pointer-events: none;
}

.cinema-link-pill {
  position: absolute;
  left: 5px;
  bottom: 6px;
  max-width: calc(100% - 10px);
  background: rgba(16, 20, 25, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2.5px 5px;
  border-radius: 2px;
  pointer-events: none;
}

.cinema-fold-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  width: 22px;
  height: 22px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(16, 20, 25, 0.74);
  color: #ffffff;
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Nators.app (Top) + Rounded Pill Search Bar (Bottom) Inside 3x1 Slot — 100% Mockup Match */
.signature-entity {
  z-index: 12;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 1px 2px 0;
  pointer-events: auto;
}

.signature-entity .sig-wordmark {
  width: 89%;
  max-height: min(35px, 52%);
  height: auto;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.sig-search-pill {
  width: 96%;
  height: min(25px, 42%);
  min-height: 18px;
  border-radius: 999px;
  border: 1.2px solid rgba(17, 17, 17, 0.16);
  background: rgba(234, 234, 234, 0.88);
  box-shadow:
    0 1.5px 3px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  padding: 0 9px;
  gap: 6px;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.sig-search-pill:focus-within {
  background: rgba(248, 247, 242, 0.96);
  border-color: rgba(17, 17, 17, 0.38);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.10);
}

.sig-search-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  display: block;
  pointer-events: none;
}

.sig-search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink-1);
  font-family: var(--font-sans);
  font-size: 11.5px;
  line-height: 1;
  padding: 0;
}

.sig-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.sig-search-clear {
  width: 15px;
  height: 15px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.14);
  color: var(--ink-1);
  font-size: 10px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sig-search-clear[hidden] {
  display: none !important;
}

.grid-entity.is-search-hit {
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.20));
}

/* Smartphone-Style Lightweight Multi-Page Switcher (Appears Only When >= 2 Pages!) */
.booklet-pager {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--hairline);
  border-radius: 999px;
}

.booklet-pager[hidden] {
  display: none !important;
}

.pager-arrow {
  width: 26px;
  height: 24px;
  border: 0;
  background: transparent;
  color: var(--ink-1);
  font-size: 14px;
  font-weight: 700;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 140ms ease;
}

.pager-arrow:hover {
  background: rgba(17, 17, 17, 0.08);
}

.pager-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pager-dot {
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pager-dot:hover {
  color: var(--ink-1);
  border-color: var(--hairline);
}

.pager-dot.is-active {
  background: var(--ink-1);
  color: #f6f4ea;
}

.pager-ellipsis {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  padding: 0 3px;
}

/* Instant In-Screen Web Game Popup Modal (Zero External Keys) */
.game-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(17, 18, 21, 0.56);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.game-modal-backdrop[hidden] {
  display: none !important;
}

.game-modal-card {
  width: min(504px, 100%);
  height: min(512px, calc(100vh - 32px));
  background: #f4f2e8;
  border: 1px solid rgba(17, 17, 17, 0.22);
  border-radius: 6px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.34);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.game-modal-header {
  padding: 9px 12px;
  background: #ebe8dc;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.game-modal-title-group {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

.game-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  background: var(--ink-1);
  color: #f6f4ea;
  border-radius: 2px;
}

.game-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-ext-link {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid rgba(17, 17, 17, 0.28);
}

.game-ext-link:hover {
  color: var(--ink-1);
}

.game-close-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--hairline-strong);
  background: #ffffff;
  color: var(--ink-1);
  border-radius: 3px;
  font-size: 12px;
}

.game-modal-body {
  flex: 1;
  min-height: 0;
}

.game-modal-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Strictly Visually-Hidden Semantic Multilingual Crawler Index (Zero Screen Footprint) */
.seo-crawler-bank {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .grid-entity,
  .stamp-scale-shell,
  .face-art,
  .face-word,
  .arena-viewport {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
