/* =========================================================
   SAKANA-HEN — single-page scroll (hero / intro / gallery)
   Tech: Pure HTML + CSS + vanilla JS
   ========================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cream: #f5f0e8;
  --cream-muted: #d9d0c3;
  --wood-deep: #1a120c;
  --mat: #2a3a48;
  --ui-shadow: 0 10px 28px rgba(40, 24, 12, 0.28);
  --ui-inset: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(40, 24, 12, 0.18);
  --supports-backdrop: 1;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  font-family: "Outfit", "Hiragino Kaku Gothic ProN", "メイリオ", sans-serif;
  color: var(--cream);
  overflow-x: hidden;
}

/* ---------- Fixed hero background ---------- */
.hero-bg-fixed {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-picture,
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-bg {
  object-fit: cover;
  object-position: center center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.12) 22%,
    transparent 42%
  );
}

/* Cover residual Gemini watermark in hero desk BR corner */
.hero-bg-fixed::after {
  content: "";
  position: absolute;
  right: -1%;
  bottom: -1%;
  width: min(16vw, 200px);
  height: min(14vh, 130px);
  background: url("assets/hero-wood-patch.jpg") center / cover no-repeat;
  -webkit-mask-image: radial-gradient(ellipse 80% 75% at 70% 65%, #000 35%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 75% at 70% 65%, #000 35%, transparent 75%);
  opacity: 0.92;
  pointer-events: none;
  z-index: 2;
}

/* ---------- Site nav (fixed) ---------- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1rem, 2.5vh, 1.4rem) clamp(1.2rem, 4vw, 2.5rem);
  pointer-events: none;
}

.site-nav-brand,
.site-nav-links a {
  pointer-events: auto;
}

.site-nav-brand {
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(245, 240, 232, 0.9);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}

.site-nav-links {
  display: flex;
  gap: clamp(1.25rem, 2.5vw, 2.25rem);
}

.hero-nav-link {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: "Outfit", sans-serif;
  font-size: clamp(0.9rem, 1.4vw, 1.1rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  text-decoration: none;
  color: rgba(245, 240, 232, 0.92);
  cursor: pointer;
  padding: 0.4em 0.2em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hero-nav-link:hover,
.hero-nav-link:focus-visible {
  outline: none;
  opacity: 0.75;
  transform: translateY(-1px);
}

/* ---------- Hero (text layer only) ---------- */
.hero {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 560px;
  overflow: hidden;
  background: transparent;
}

.hero-ui {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.hero-text {
  position: absolute;
  left: 46%;
  top: 24%;
  transform: translate(-50%, -40%);
  width: min(78vw, 960px);
  text-align: left;
  z-index: 3;
  pointer-events: none;
  will-change: opacity, transform;
}

.hero-title {
  margin: 0;
  font-family: "Outfit", sans-serif;
  font-size: clamp(1.87rem, 6.67vw, 8vw);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  color: #f5f0e8;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(18px);
  animation: hero-fade-up 0.8s ease-out 0.1s forwards;
}

.hero-tagline {
  margin: 0.55em 0 0;
  max-width: 28em;
  font-family: "Outfit", sans-serif;
  font-size: clamp(0.72rem, 1.7vw, 1.35rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(245, 240, 232, 0.85);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(14px);
  animation: hero-fade-up 0.8s ease-out 0.4s forwards;
}

@keyframes hero-fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.writing-start-btn {
  position: absolute;
  /* center of hanshi in hero art (~53.6% / 55.6%) */
  top: 55.5%;
  left: 53.5%;
  transform: translate(-50%, -50%) scale(0.85);
  z-index: 5;
  padding: clamp(14px, 2vh, 18px) clamp(28px, 4.5vw, 48px);
  background:
    linear-gradient(
      155deg,
      #f7e7c2 0%,
      #e4c078 28%,
      #c8963a 52%,
      #f0d9a0 72%,
      #b8842e 100%
    );
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid rgba(255, 236, 190, 0.85);
  border-radius: 999px;
  box-shadow:
    0 10px 28px rgba(70, 42, 12, 0.28),
    0 2px 0 rgba(255, 245, 220, 0.55) inset,
    0 -2px 0 rgba(120, 70, 20, 0.22) inset,
    0 0 18px rgba(232, 190, 100, 0.35);
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3a2610;
  text-shadow: 0 1px 0 rgba(255, 245, 220, 0.45);
  font-size: clamp(14px, 1.6vw, 18px);
  cursor: pointer;
  overflow: hidden;
  opacity: 0;
  animation: writing-start-in 0.65s cubic-bezier(0.34, 1.45, 0.64, 1) 1.1s forwards;
  transition: background 0.35s ease, box-shadow 0.35s ease, filter 0.35s ease;
  will-change: opacity, transform;
}

@keyframes writing-start-in {
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.writing-start-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    115deg,
    transparent 28%,
    rgba(255, 255, 255, 0.72) 48%,
    rgba(255, 245, 210, 0.35) 54%,
    transparent 72%
  );
  transition: left 0.55s ease;
  pointer-events: none;
}

.writing-start-btn:hover::before,
.writing-start-btn:focus-visible::before {
  left: 100%;
}

.writing-start-btn:hover {
  filter: brightness(1.06);
  box-shadow:
    0 12px 34px rgba(70, 42, 12, 0.34),
    0 2px 0 rgba(255, 245, 220, 0.7) inset,
    0 -2px 0 rgba(120, 70, 20, 0.25) inset,
    0 0 26px rgba(240, 200, 110, 0.5);
  transform: translate(-50%, -50%) scale(1.04);
}

.writing-start-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(255, 236, 190, 0.85),
    0 12px 34px rgba(70, 42, 12, 0.34),
    0 2px 0 rgba(255, 245, 220, 0.7) inset,
    0 0 26px rgba(240, 200, 110, 0.5);
  transform: translate(-50%, -50%) scale(1.04);
}

.writing-start-btn:active {
  transform: translate(-50%, -50%) scale(0.98);
}

.no-backdrop .gallery-card {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(255, 252, 246, 0.82);
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: clamp(1.4rem, 3.5vh, 2.4rem);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: rgba(245, 240, 232, 0.88);
  font-family: "Outfit", sans-serif;
  font-size: clamp(0.58rem, 1.05vw, 0.72rem);
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  z-index: 4;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
  opacity: 0;
  animation: hero-fade-up 0.6s ease-out 1.4s forwards;
}

.scroll-cue:hover,
.scroll-cue:focus-visible {
  outline: none;
  opacity: 0.75;
  transform: translateX(-50%) translateY(2px);
}

.scroll-chevron {
  width: 10px;
  height: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  animation: scroll-bob 1.8s ease-in-out infinite;
}

@keyframes scroll-bob {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.85; }
  50% { transform: rotate(45deg) translateY(3px); opacity: 1; }
}

/* ---------- Intro ---------- */
.intro {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(4rem, 10vh, 7rem) 1.5rem;
  background: rgba(245, 240, 232, 0.92);
  color: #2a1c12;
}

.intro-inner {
  max-width: 640px;
  text-align: left;
}

.intro-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #6b5a4a;
  margin-bottom: 0.85rem;
}

.intro-title {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
  color: #1a120c;
  margin-bottom: 1.25rem;
}

.intro-text {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.65;
  color: #4a3c30;
  margin-bottom: 1rem;
}

.intro .continue-cta {
  margin-top: 1.5rem;
  color: #f5f0e8;
  background: linear-gradient(180deg, rgba(70, 90, 110, 0.95), rgba(40, 55, 72, 0.95));
  border: 1px solid rgba(40, 30, 20, 0.15);
}

.continue-cta {
  appearance: none;
  border: 1px solid rgba(245, 237, 224, 0.3);
  border-radius: 999px;
  padding: 0.95rem 2.2rem;
  font-family: "Outfit", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream);
  background: linear-gradient(180deg, rgba(90, 110, 128, 0.65), rgba(50, 68, 84, 0.7));
  box-shadow: var(--ui-shadow), var(--ui-inset);
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.continue-cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Gallery ---------- */
.gallery {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding: clamp(4rem, 9vh, 6.5rem) 1.5rem 5rem;
  background:
    linear-gradient(180deg, rgba(26, 18, 12, 0.88), rgba(18, 12, 8, 0.94));
}

.gallery-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.gallery-header {
  text-align: center;
  margin-bottom: clamp(2rem, 5vh, 3rem);
}

.gallery-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cream-muted);
  margin-bottom: 0.6rem;
}

.gallery-title {
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cream);
  margin-bottom: 0.5rem;
}

.gallery-sub {
  font-size: 0.95rem;
  color: rgba(245, 240, 232, 0.7);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(1rem, 2.5vw, 1.5rem);
  perspective: 1000px;
}

.gallery-card {
  position: relative;
  aspect-ratio: 3 / 4.2;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  transform-style: preserve-3d;
  transition: box-shadow 0.3s ease;
  cursor: pointer;
  opacity: 0;
  transform: translateY(24px);
}

.gallery-card.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease,
    box-shadow 0.3s ease;
}

.gallery-card:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.18), transparent 55%),
    linear-gradient(160deg, #3a4a58 0%, #1c2832 55%, #121820 100%);
}

.yuji-mai-regular {
  font-family: "Yuji Mai", serif;
  font-weight: 400;
  font-style: normal;
}

.card-kanji {
  font-family: "Yuji Mai", serif;
  font-size: clamp(3.2rem, 8vw, 4.5rem);
  font-weight: 400;
  font-style: normal;
  color: #f5f0e8;
  line-height: 1;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.card-emoji {
  font-size: 1.6rem;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.card-emoji.is-replaced-by-3d {
  display: none;
}

.fish-3d-canvas {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 72%;
  width: 100%;
  display: block;
  z-index: 1;
  pointer-events: none;
}

.fish-card-art {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: calc(88% - 1cm);
  height: calc(68% - 1cm);
  max-width: calc(100% - 1.2cm);
  object-fit: contain;
  object-position: center;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.35));
  animation: fish-card-float 4.5s ease-in-out infinite;
}

@keyframes fish-card-float {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, calc(-50% - 6px)); }
}

.gallery-card:hover .fish-card-art {
  animation-duration: 2.2s;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.4));
}

.result-fish-art {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  width: min(calc(72vw - 1cm), 242px);
  height: min(calc(48vw - 1cm), 182px);
  margin: 0 auto;
  display: block;
  animation: fish-card-float-result 4.5s ease-in-out infinite;
}

@keyframes fish-card-float-result {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.gallery-card.unlocked .card-kanji {
  position: absolute;
  top: 8%;
  right: 8%;
  z-index: 2;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  opacity: 0.72;
  pointer-events: none;
}

.gallery-card.unlocked .card-stroke {
  position: absolute;
  inset: 18% 14% 28%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0.18;
  filter: grayscale(0.2);
  z-index: 0;
  pointer-events: none;
}

.result-fish-host {
  position: relative;
  width: min(72vw, 280px);
  height: min(42vw, 200px);
  margin: 0 auto;
}

.result-fish-canvas,
.result-fish-host .fish-3d-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.holo-layer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 20%,
    rgba(255, 0, 150, 0.3) 36%,
    rgba(0, 225, 255, 0.3) 44%,
    rgba(255, 231, 0, 0.3) 52%,
    transparent 70%
  );
  background-size: 250% 250%;
  mix-blend-mode: color-dodge;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

.sparkle-texture {
  position: absolute;
  inset: 0;
  background: url("assets/sparkle-noise.png") repeat;
  background-size: 180px 180px;
  mix-blend-mode: overlay;
  opacity: 0.45;
  pointer-events: none;
  z-index: 3;
}

.card-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 0.85rem 0.9rem;
  font-family: "Outfit", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f5f0e8;
  background: linear-gradient(0deg, rgba(10, 12, 16, 0.72), transparent);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

@media (hover: none), (pointer: coarse) {
  .gallery-card {
    transform: none !important;
  }
  .holo-layer {
    opacity: 0.22;
    background-position: 40% 35%;
  }
}

@media (max-width: 720px) {
  .hero-text {
    left: 50%;
    top: 20%;
    width: min(90vw, 560px);
  }

  .hero-title {
    font-size: clamp(1.6rem, 7.67vw, 2.4rem);
  }

  .writing-start-btn {
    top: 55.5%;
    left: 53.5%;
    padding: 14px 28px;
    font-size: 13px;
  }

  .site-nav-brand {
    font-size: 0.72rem;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .gallery-card {
    background: rgba(255, 252, 246, 0.85);
  }
}
/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 24, 0.72);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  padding: 1rem;
}

.modal-overlay.hidden,
.writing-3d-overlay.hidden {
  display: none;
}

.modal-content {
  background: rgba(255, 252, 246, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  width: min(520px, 94vw);
  max-height: 90vh;
  padding: 1rem 1.1rem 1.2rem;
  position: relative;
  box-shadow: 0 18px 48px rgba(10, 12, 18, 0.35);
  display: flex;
  flex-direction: column;
  color: #1e293b;
}

/* CLEAR / UNLOCK result — glassmorphism */
.clear-modal-overlay {
  z-index: 240;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  /* soft desk glow behind glass when page bg is plain */
  background-image:
    radial-gradient(ellipse at 50% 40%, rgba(180, 140, 90, 0.18), transparent 55%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.55));
}

.clear-modal {
  width: min(480px, 90vw);
  padding: 2.4rem 1.85rem 1.85rem;
  text-align: center;
  color: #f5f0e8;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 20px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  overflow: hidden;
  transform-origin: center center;
}

.clear-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.18) 0%,
    transparent 42%,
    transparent 58%,
    rgba(255, 255, 255, 0.08) 100%
  );
  pointer-events: none;
  z-index: 0;
}

.clear-modal > * {
  position: relative;
  z-index: 1;
}

.clear-modal-close {
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #f5f0e8;
}

.clear-modal-close:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #f5f0e8;
}

.clear-badge,
.clear-modal .result-badge {
  display: inline-block;
  padding: 8px 28px;
  margin-bottom: 1.1rem;
  background: rgba(120, 200, 140, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(120, 200, 140, 0.5);
  border-radius: 999px;
  color: #f5f0e8;
  font-family: "Outfit", sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.clear-modal .result-badge.fail {
  background: rgba(220, 80, 80, 0.28);
  border-color: rgba(255, 140, 140, 0.5);
}

.clear-modal .large-emoji {
  font-size: clamp(3rem, 8vw, 4rem);
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.35));
}

.clear-modal .kanji-display,
.clear-modal .huge-kanji {
  font-family: "Yuji Mai", serif;
  font-size: clamp(3.6rem, 12vw, 5.5rem);
  font-weight: 400;
  color: #f5f0e8;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  margin: 0.35rem 0 0.5rem;
  line-height: 1.05;
}

.clear-modal .kanji-reading,
.clear-modal .reading-text {
  color: #b8d4f0;
  font-weight: 700;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  margin-bottom: 0.85rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.clear-modal .kanji-description,
.clear-modal .origin-description {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 14px 18px;
  margin-top: 0.35rem;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(245, 240, 232, 0.92);
  text-align: left;
}

.next-kanji-btn {
  width: 100%;
  margin-top: 0;
  padding: 15px 18px;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 14px;
  color: #f5f0e8;
  font-family: "Outfit", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.28);
  transition: background 0.3s ease, transform 0.25s ease, box-shadow 0.3s ease;
}

.next-kanji-btn:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: translateY(-2px);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

.next-kanji-btn:active {
  transform: translateY(0);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1.35rem;
  width: 100%;
}

.rewrite-kanji-btn {
  width: 100%;
  padding: 14px 18px;
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  color: rgba(245, 240, 232, 0.9);
  font-family: "Outfit", sans-serif;
  font-size: 0.88rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease;
}

.rewrite-kanji-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.result-main-illustration {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.35rem 0 0.5rem;
  min-height: 11rem;
}

.result-stroke {
  position: absolute;
  width: min(120px, 28vw);
  height: min(120px, 28vw);
  object-fit: contain;
  opacity: 0.22;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  border-radius: 10px;
  right: 4%;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
}

#result-modal.has-stroke .result-stroke {
  display: block;
}

#result-modal.has-stroke .large-emoji {
  display: none;
}

#result-modal .result-fish-host:not([hidden]) ~ .large-emoji {
  display: none;
}

#result-modal.has-stroke .kanji-display,
#result-modal.has-stroke .huge-kanji {
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  margin-top: 0.15rem;
}

.no-backdrop .clear-modal {
  background: rgba(40, 32, 26, 0.88);
}

.no-backdrop .clear-modal-overlay {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  color: #1e293b;
  transition: transform 0.18s ease, background 0.18s ease;
}

.close-btn:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.8);
}

.canvas-header {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: #1e293b;
  padding-right: 28px;
}

.about-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #334155;
  overflow-y: auto;
}

.about-body p + p {
  margin-top: 0.75rem;
}

.action-btn {
  flex: 1;
  padding: 13px 16px;
  font-family: "Outfit", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  border: 1px solid rgba(40, 50, 60, 0.2);
  border-radius: 18px;
  background: linear-gradient(180deg, #f7f1e8, #e8dcc8);
  color: #2a1c12;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(40, 24, 12, 0.15), var(--ui-inset);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.action-btn.primary {
  background: linear-gradient(180deg, #7a97ab, #4f6d82);
  border-color: rgba(245, 237, 224, 0.35);
  color: var(--cream);
}

.action-btn.full-width {
  width: 100%;
  flex: none;
}

.action-btn:active {
  transform: translateY(1px) scale(0.99);
}

.result-card {
  text-align: center;
}

.result-badge {
  display: inline-block;
  font-family: "Outfit", sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 16px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.result-main-illustration {
  margin: 4px 0;
}

.large-emoji {
  font-size: 3.8rem;
}

.huge-kanji {
  font-family: "Yuji Mai", serif;
  font-size: 3.5rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.1;
}

.reading-text {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 6px;
}

.origin-description {
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 12px;
  margin-bottom: 10px;
  text-align: left;
}

.zukan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.zukan-item {
  border: 1px solid rgba(180, 160, 130, 0.35);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
}

.zukan-item .k { font-size: 1.5rem; font-weight: bold; }
.zukan-item .r { font-size: 0.7rem; color: #64748b; }

/* =========================================================
   Fullscreen 3D writing mode
   ========================================================= */
.writing-3d-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #2c1e14;
  overflow: hidden;
}

.writing-3d-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(28, 18, 10, 0.38) 100%);
}

.shodo-hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(28, 18, 10, 0.55), transparent);
}

.shodo-brand {
  font-family: "Outfit", sans-serif;
  font-size: clamp(1.2rem, 2.6vw, 1.75rem);
  font-weight: 800;
  color: var(--cream);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 12px rgba(20, 12, 8, 0.6);
}

.desk-title {
  display: inline-block;
  font-family: "Outfit", sans-serif;
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--cream);
  background: linear-gradient(180deg, rgba(60, 48, 38, 0.55), rgba(35, 26, 18, 0.5));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(245, 237, 224, 0.28);
  border-radius: 18px;
  padding: 10px 18px;
  box-shadow: var(--ui-shadow), var(--ui-inset);
  text-shadow: 0 2px 8px rgba(20, 12, 8, 0.5);
}

.brush-chip {
  appearance: none;
  border: 1px solid rgba(245, 237, 224, 0.26);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(70, 55, 42, 0.62), rgba(40, 30, 22, 0.58));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  min-width: 128px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  font-family: "Outfit", sans-serif;
  box-shadow: var(--ui-shadow), var(--ui-inset);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.brush-chip:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.08);
}

.brush-chip.active {
  border-color: rgba(245, 237, 224, 0.55);
  background: linear-gradient(180deg, rgba(95, 75, 55, 0.72), rgba(55, 42, 30, 0.65));
  box-shadow:
    0 12px 28px rgba(40, 24, 12, 0.35),
    var(--ui-inset),
    0 0 18px rgba(245, 237, 224, 0.12);
}

/* Goat — smooth soft-touch */
.brush-chip.sheep {
  border-color: rgba(245, 237, 224, 0.32);
  background: linear-gradient(180deg, rgba(90, 78, 68, 0.7), rgba(48, 38, 30, 0.62));
  box-shadow:
    0 10px 24px rgba(40, 24, 12, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(40, 24, 12, 0.15);
}

.brush-chip.sheep:hover,
.brush-chip.sheep.active {
  border-color: rgba(245, 237, 224, 0.55);
}

/* Horse — fibrous / rough */
.brush-chip.horse {
  border: 1px solid rgba(210, 180, 140, 0.45);
  border-radius: 14px;
  background:
    repeating-linear-gradient(
      118deg,
      rgba(70, 48, 30, 0.55) 0 2px,
      rgba(50, 34, 22, 0.55) 2px 4px
    ),
    linear-gradient(180deg, rgba(92, 64, 40, 0.75), rgba(42, 28, 18, 0.7));
  box-shadow:
    0 10px 22px rgba(40, 24, 12, 0.3),
    inset 0 0 0 1px rgba(255, 220, 170, 0.08),
    inset 0 -2px 0 rgba(20, 12, 8, 0.25);
}

.brush-chip.horse:hover,
.brush-chip.horse.active {
  border-color: rgba(230, 190, 140, 0.7);
}

/* Aged Ink — matte soak */
.brush-chip.bleed {
  border-color: rgba(120, 120, 130, 0.4);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(80, 80, 90, 0.35), transparent 55%),
    linear-gradient(180deg, rgba(55, 55, 62, 0.72), rgba(28, 28, 34, 0.75));
  box-shadow:
    0 10px 26px rgba(10, 10, 16, 0.35),
    inset 0 1px 0 rgba(200, 200, 210, 0.12),
    inset 0 0 18px rgba(0, 0, 0, 0.22);
}

.brush-chip.bleed:hover,
.brush-chip.bleed.active {
  border-color: rgba(180, 180, 190, 0.5);
}

/* Gold Leaf — brushed metal */
.brush-chip.golden {
  border-color: rgba(245, 200, 100, 0.55);
  background:
    linear-gradient(135deg, rgba(255, 230, 150, 0.35), transparent 42%),
    linear-gradient(180deg, rgba(180, 130, 40, 0.75), rgba(90, 60, 18, 0.78));
  box-shadow:
    0 10px 26px rgba(80, 50, 10, 0.35),
    inset 0 1px 0 rgba(255, 240, 180, 0.55),
    inset 0 -1px 0 rgba(60, 35, 8, 0.35),
    0 0 18px rgba(245, 180, 60, 0.18);
}

.brush-chip.golden:hover,
.brush-chip.golden.active {
  border-color: rgba(255, 220, 140, 0.85);
  box-shadow:
    0 14px 30px rgba(80, 50, 10, 0.4),
    inset 0 1px 0 rgba(255, 245, 200, 0.65),
    0 0 22px rgba(255, 200, 80, 0.28);
}

.brush-chip .brush-chip-name {
  display: block;
  font-family: "Outfit", sans-serif;
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--cream);
  text-shadow: 0 2px 8px rgba(20, 12, 8, 0.45);
}

.brush-chip .brush-chip-sub {
  display: block;
  font-family: "Outfit", sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--cream-muted);
  margin-top: 3px;
  text-transform: none;
}

.brush-chip.sheep .brush-chip-name { color: #f5f0e8; }
.brush-chip.horse .brush-chip-name { color: #e8c9a0; }
.brush-chip.bleed .brush-chip-name { color: #d4cfc6; }
.brush-chip.golden .brush-chip-name { color: #f0d9a8; }

.shodo-actions .action-btn {
  padding: 14px 18px;
  font-size: 1rem;
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--cream);
  background: linear-gradient(180deg, rgba(70, 55, 42, 0.75), rgba(40, 30, 22, 0.7));
  border: 1px solid rgba(245, 237, 224, 0.28);
  border-radius: 18px;
  box-shadow: var(--ui-shadow), var(--ui-inset);
  text-shadow: 0 2px 8px rgba(20, 12, 8, 0.45);
}

.shodo-actions .action-btn.primary {
  background: linear-gradient(180deg, rgba(120, 150, 175, 0.62), rgba(70, 100, 125, 0.55));
  border-color: rgba(245, 237, 224, 0.38);
}

.shodo-actions .action-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.three-host {
  position: absolute;
  inset: 0;
}

.three-host canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
  cursor: crosshair;
}

.ink-canvas-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.shodo-target {
  justify-self: center;
  pointer-events: none;
}

.target-badge-wrapper {
  position: relative;
  display: inline-block;
  pointer-events: auto;
}

.target-badge {
  appearance: none;
  cursor: pointer;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  text-align: center;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.target-badge:hover,
.target-badge:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.target-badge:focus-visible {
  outline: 2px solid rgba(245, 237, 224, 0.65);
  outline-offset: 3px;
}

.guide-hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  background: rgba(245, 237, 224, 0.18);
  border: 1px solid rgba(245, 237, 224, 0.35);
  opacity: 0.9;
}

.guide-tooltip {
  position: absolute;
  top: calc(100% + 16px);
  left: 50%;
  --tooltip-offset-x: 0px;
  transform: translateX(calc(-50% + var(--tooltip-offset-x))) translateY(-10px) scale(0.95);
  width: min(560px, 90vw);
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  z-index: 60;
}

.guide-tooltip.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(calc(-50% + var(--tooltip-offset-x))) translateY(0) scale(1);
  pointer-events: auto;
}

.guide-tooltip-frame {
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 14px;
  padding: 8px;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.32),
    0 2px 8px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.guide-tooltip-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

.guide-tooltip-arrow {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid rgba(255, 255, 255, 0.22);
  filter: drop-shadow(0 -1px 2px rgba(0, 0, 0, 0.1));
}

@media (max-width: 600px) {
  .guide-tooltip {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    --tooltip-offset-x: 0px;
    transform: translateY(100%);
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .guide-tooltip-frame {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border: 1px solid rgba(245, 237, 224, 0.28);
    border-radius: 12px;
  }

  .guide-tooltip.is-open {
    transform: translateY(0);
  }

  .guide-tooltip-arrow {
    display: none;
  }
}

.desk-close {
  position: relative;
  top: auto;
  right: auto;
  justify-self: end;
  pointer-events: auto;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  color: var(--cream);
  background: linear-gradient(180deg, rgba(70, 55, 42, 0.7), rgba(40, 30, 22, 0.65));
  border: 1px solid rgba(245, 237, 224, 0.3);
  box-shadow: var(--ui-shadow), var(--ui-inset);
}

/* 書き順サポート — 硯エンブレム上のスイッチ */
.stroke-order-toggle {
  position: absolute;
  top: 62%;
  left: 78%;
  transform: translate(-50%, -50%);
  z-index: 6;
  width: 56px;
  height: 32px;
  padding: 0;
  border-radius: 16px;
  background: rgba(20, 20, 25, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.5),
    0 1px 2px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: background 0.3s ease;
  pointer-events: auto;
  appearance: none;
}

.stroke-order-toggle .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(145deg, #8a8a92, #5a5a62);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.stroke-order-toggle.active {
  background: rgba(180, 150, 80, 0.5);
  border-color: rgba(232, 196, 104, 0.45);
}

.stroke-order-toggle.active .knob {
  transform: translateX(24px);
  background: linear-gradient(145deg, #e8c468, #c9a03a);
}

.stroke-order-toggle::after {
  content: "書き順サポート";
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #f5f0e8;
  font-family: "Outfit", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.stroke-order-toggle:hover::after,
.stroke-order-toggle:focus-visible::after {
  opacity: 1;
}

.stroke-order-toggle:focus-visible {
  outline: 2px solid rgba(232, 196, 104, 0.7);
  outline-offset: 3px;
}

.shodo-hud-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 22px;
  background: linear-gradient(0deg, rgba(28, 18, 10, 0.72), transparent);
  pointer-events: none;
}

.brush-carousel {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: auto;
  max-width: 920px;
}

.kanji-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: auto;
  max-width: 920px;
  margin-bottom: 4px;
}

.kanji-chip {
  appearance: none;
  min-width: 64px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(245, 237, 224, 0.28);
  background: linear-gradient(180deg, rgba(70, 55, 42, 0.55), rgba(40, 30, 22, 0.52));
  box-shadow: var(--ui-shadow), var(--ui-inset);
  color: var(--cream);
  cursor: pointer;
  font-family: "Outfit", sans-serif;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
}

.kanji-chip:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.kanji-chip.active {
  border-color: rgba(245, 237, 224, 0.6);
  background: linear-gradient(180deg, rgba(110, 90, 65, 0.72), rgba(55, 42, 30, 0.68));
  box-shadow:
    0 10px 24px rgba(40, 24, 12, 0.32),
    var(--ui-inset),
    0 0 14px rgba(245, 237, 224, 0.12);
}

.kanji-chip-glyph {
  display: block;
  font-family: "Yuji Mai", serif;
  font-size: 1.35rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.1;
}

.kanji-chip-en {
  display: block;
  margin-top: 2px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cream-muted);
}

.shodo-actions {
  display: flex;
  gap: 12px;
  width: min(520px, 100%);
  pointer-events: auto;
}

@media (max-width: 720px) {
  .shodo-brand { display: none; }
  .shodo-hud-top { grid-template-columns: auto 1fr auto; }
  .brush-chip { min-width: 0; flex: 1 1 42%; }
}

/* ---------- Submit ceremony ---------- */
.canvas-flash-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 48%, rgba(255, 252, 245, 0.95), rgba(255, 240, 210, 0.35) 42%, transparent 70%);
  opacity: 0;
}

.submit-flight-layer {
  position: fixed;
  inset: 0;
  z-index: 220;
  pointer-events: none;
  perspective: 1200px;
  display: none;
}

.submit-flight-layer.is-active {
  display: block;
  pointer-events: auto;
}

.submit-flight-stage {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.submit-flight-sprite {
  position: absolute;
  left: 0;
  top: 0;
  width: 220px;
  height: 220px;
  margin: 0;
  transform-style: preserve-3d;
  will-change: transform, filter, opacity;
  pointer-events: none;
}

.submit-flight-sprite img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.55)) drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.submit-flight-sprite::after {
  content: "";
  position: absolute;
  inset: -8%;
  border-radius: 12px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.35), transparent 68%);
  mix-blend-mode: screen;
  opacity: 0.75;
  pointer-events: none;
}

.submit-trail-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #1a1a1a;
  pointer-events: none;
  opacity: 0.85;
}

.submit-trail-dot.is-gold {
  background: #d4af37;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.8);
}

.gallery-card.locked {
  background: rgba(20, 20, 25, 0.4);
  backdrop-filter: blur(10px) saturate(80%);
  -webkit-backdrop-filter: blur(10px) saturate(80%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  filter: grayscale(0.85) brightness(0.72);
  cursor: pointer;
}

.gallery-card.locked .card-face {
  filter: brightness(0.35) contrast(0.9);
}

.gallery-card.locked .card-kanji,
.gallery-card.locked .card-emoji,
.gallery-card.locked .card-stroke {
  opacity: 0;
  visibility: hidden;
}

.gallery-card.locked .holo-layer,
.gallery-card.locked .sparkle-texture {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
}

.gallery-card.locked .card-caption {
  color: rgba(245, 240, 232, 0.35);
  letter-spacing: 0.28em;
}

.gallery-card .lock-icon {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(245, 240, 232, 0.62);
  pointer-events: none;
}

.gallery-card.unlocked .lock-icon,
.gallery-card .lock-icon[aria-hidden="true"] {
  display: none;
}

.gallery-card.locked .lock-icon {
  animation: lockPulse 2.4s ease-in-out infinite;
}

@keyframes lockPulse {
  0%, 100% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 0.85; }
}

.gallery-card .card-silhouette {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: "Yuji Mai", serif;
  font-size: clamp(3.4rem, 9vw, 4.8rem);
  color: rgba(8, 10, 14, 0.55);
  text-shadow: 0 0 24px rgba(0, 0, 0, 0.4);
  filter: blur(1.5px);
  pointer-events: none;
}

.gallery-card.locked .card-silhouette {
  display: flex;
}

.gallery-card.unlocked .card-silhouette,
.gallery-card .card-silhouette[aria-hidden="true"] {
  display: none;
}

.gallery-card.unlocked {
  filter: none;
}

.gallery-card.unlocking {
  z-index: 3;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.45), 0 16px 40px rgba(0, 0, 0, 0.4);
}

.gallery-card.is-written .card-face {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.16), transparent 55%),
    linear-gradient(160deg, #3a3228 0%, #1c1814 55%, #12100e 100%);
}

.gallery-card.is-written .card-stroke {
  position: absolute;
  inset: 18% 14% 28%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0.16;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
  z-index: 0;
}

.gallery-card.is-written .card-kanji {
  position: absolute;
  top: 8%;
  right: 8%;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  opacity: 0.72;
  z-index: 2;
}

.gallery-card.is-written .card-emoji {
  display: none;
}

.gallery-card.unlocked:not(.is-written) .card-kanji {
  position: absolute;
  top: 8%;
  right: 8%;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  opacity: 0.72;
}

.gallery-card.holo-burst .holo-layer {
  opacity: 0.85 !important;
  visibility: visible !important;
  transition: opacity 0.15s ease;
}

.gallery-card.holo-burst .sparkle-texture {
  opacity: 0.9 !important;
  visibility: visible !important;
}

#submit-canvas-btn.is-pressed {
  transform: scale(0.94);
}

#submit-canvas-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.writing-3d-overlay.submit-fading {
  transition: opacity 0.28s ease;
  opacity: 0;
  pointer-events: none;
}

.write-toast {
  position: absolute;
  left: 50%;
  bottom: clamp(7.5rem, 18vh, 9.5rem);
  transform: translateX(-50%) translateY(8px);
  z-index: 45;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  background: rgba(28, 18, 10, 0.82);
  border: 1px solid rgba(245, 237, 224, 0.28);
  color: #f5f0e8;
  font-family: "Outfit", sans-serif;
  font-size: clamp(0.78rem, 1.5vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: min(92vw, 420px);
  text-align: center;
}

.write-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes submit-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

#submit-canvas-btn.is-shake {
  animation: submit-shake 0.4s ease;
}
