:root {
  color-scheme: dark;
  --bg: #080916;
  --panel: rgba(18, 22, 46, 0.74);
  --panel-strong: rgba(31, 36, 72, 0.86);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f8f7ff;
  --muted: #b9b5d6;
  --pink: #ff5fbc;
  --cyan: #66e8ff;
  --gold: #ffd56a;
  --violet: #9b7cff;
  --green: #82f7b6;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 95, 188, 0.28), transparent 32rem),
    radial-gradient(circle at 86% 18%, rgba(102, 232, 255, 0.24), transparent 30rem),
    linear-gradient(145deg, #090a1a 0%, #111021 48%, #070812 100%);
}

.moon-intro {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 244, 203, 0.22), transparent 22rem),
    rgba(5, 6, 17, 0.88);
  animation: introFade 2.7s ease forwards;
}

.intro-moon,
.corner-moon {
  padding: 0;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 45% 22%, rgba(111, 104, 88, 0.2) 0 6%, transparent 7%),
    radial-gradient(circle at 28% 48%, rgba(117, 106, 86, 0.19) 0 12%, transparent 13%),
    radial-gradient(circle at 61% 42%, rgba(132, 122, 99, 0.18) 0 15%, transparent 16%),
    radial-gradient(circle at 42% 70%, rgba(126, 114, 90, 0.17) 0 13%, transparent 14%),
    radial-gradient(circle at 73% 72%, rgba(196, 184, 151, 0.2) 0 17%, transparent 18%),
    radial-gradient(circle at 30% 30%, rgba(255, 254, 235, 0.82) 0 8%, transparent 9%),
    radial-gradient(circle at 58% 58%, rgba(255, 251, 225, 0.56) 0 20%, transparent 21%),
    radial-gradient(circle at 40% 38%, #fff9de 0 22%, #eee5c6 46%, #d8ccb0 72%, #f9f0d3 100%);
  box-shadow:
    0 0 46px rgba(255, 244, 203, 0.82),
    0 0 120px rgba(255, 95, 188, 0.22),
    inset -24px -28px 48px rgba(99, 88, 70, 0.22),
    inset 18px 16px 42px rgba(255, 255, 245, 0.3);
}

.intro-moon {
  width: min(62vw, 540px);
  aspect-ratio: 1;
  animation: moonSummon 2.7s cubic-bezier(0.2, 0.86, 0.2, 1) forwards;
}

.intro-glitter {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(255, 95, 188, 0.9) 0 1.2px, transparent 2px),
    radial-gradient(circle, rgba(102, 232, 255, 0.9) 0 1px, transparent 1.8px);
  background-position: 20% 32%, 62% 28%, 76% 66%;
  background-size: 190px 190px, 260px 260px, 230px 230px;
  animation: glitterRush 2.4s ease forwards;
}

.moon-song {
  position: absolute;
  left: calc(50% + min(19vw, 176px));
  top: calc(50% - min(17vw, 150px));
  display: grid;
  gap: 8px;
  color: rgba(223, 250, 255, 0.88);
  font-weight: 900;
  text-shadow: 0 0 12px rgba(102, 232, 255, 0.72);
  animation: songDrift 2.4s ease forwards;
}

.moon-song::before,
.moon-song::after {
  content: "";
  position: absolute;
  left: -22px;
  top: 20px;
  width: 82px;
  height: 44px;
  border: 1px solid rgba(102, 232, 255, 0.34);
  border-left: 0;
  border-bottom: 0;
  border-radius: 50%;
  transform: rotate(-18deg);
  animation: songWave 1.8s ease infinite;
}

.moon-song::after {
  width: 118px;
  height: 64px;
  animation-delay: 0.3s;
}

.moon-song span {
  display: block;
  font-size: clamp(1rem, 2.2vw, 1.7rem);
  animation: noteFloat 1.8s ease-in-out infinite;
}

.moon-song span:nth-child(2) {
  color: rgba(255, 244, 203, 0.82);
  animation-delay: 0.22s;
}

.moon-song span:nth-child(3) {
  animation-delay: 0.44s;
}

.corner-moon {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 1;
  width: clamp(82px, 10vw, 142px);
  aspect-ratio: 1;
  opacity: 0.9;
  filter: saturate(1.04);
  cursor: pointer;
  pointer-events: auto;
  animation: cornerMoonIn 2.7s ease both;
}

.corner-moon:hover {
  filter: saturate(1.08) brightness(1.08);
}

.corner-moon:focus-visible {
  outline: 2px solid rgba(102, 232, 255, 0.78);
  outline-offset: 4px;
}

.corner-moon::after {
  content: "";
  position: absolute;
  inset: -16px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 244, 203, 0.16), transparent 68%);
}

.corner-song-effect {
  position: fixed;
  z-index: 70;
  width: 120px;
  height: 88px;
  pointer-events: none;
  color: rgba(223, 250, 255, 0.92);
  text-shadow: 0 0 12px rgba(102, 232, 255, 0.8);
  animation: cornerSongFade 1.5s ease forwards;
}

.corner-song-effect::before,
.corner-song-effect::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 26px;
  width: 78px;
  height: 36px;
  border: 1px solid rgba(102, 232, 255, 0.36);
  border-left: 0;
  border-bottom: 0;
  border-radius: 50%;
  transform: rotate(-18deg);
  animation: songWave 1.3s ease forwards;
}

.corner-song-effect::after {
  width: 112px;
  height: 56px;
  animation-delay: 0.16s;
}

.corner-song-effect span {
  position: absolute;
  font-weight: 900;
  animation: cornerNoteFloat 1.4s ease forwards;
}

.corner-song-effect span:nth-child(1) {
  left: 18px;
  top: 4px;
  font-size: 1.25rem;
}

.corner-song-effect span:nth-child(2) {
  left: 46px;
  top: 26px;
  color: rgba(255, 244, 203, 0.86);
  animation-delay: 0.12s;
}

.corner-song-effect span:nth-child(3) {
  left: 76px;
  top: 12px;
  font-size: 1.35rem;
  animation-delay: 0.24s;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.spark-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 213, 106, 0.8) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(102, 232, 255, 0.7) 0 1px, transparent 1.4px);
  background-position: 0 0, 60px 90px, 130px 20px;
  background-size: 180px 180px, 220px 220px, 260px 260px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.95), transparent 84%);
  animation: twinkle 7s linear infinite;
}

.app-shell {
  position: relative;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero-panel,
.gacha-stage,
.post-panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: end;
  min-height: 330px;
  padding: clamp(24px, 5vw, 56px);
  border-radius: 8px;
  overflow: hidden;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(110deg, rgba(255, 95, 188, 0.18), transparent 42%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 72px);
  pointer-events: none;
}

.brand-block,
.auth-card,
.notice-strip,
.stage-grid {
  position: relative;
}

.eyebrow,
.mini-label {
  margin: 0;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 14px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  display: grid;
  gap: 8px;
  max-width: 820px;
  margin-bottom: 18px;
  font-size: clamp(3rem, 7vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 0 26px rgba(255, 95, 188, 0.55), 0 0 40px rgba(102, 232, 255, 0.25);
}

h1 span {
  display: block;
  white-space: nowrap;
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  letter-spacing: 0;
}

.lead {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.8;
}

.auth-card {
  display: grid;
  gap: 12px;
  min-width: 230px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 10, 26, 0.58);
}

.auth-card strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.auth-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.notice-strip {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  margin: 16px 0;
  padding: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.notice-strip::-webkit-scrollbar {
  display: none;
}

.notice-strip span,
.notice-strip a {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid rgba(255, 213, 106, 0.32);
  border-radius: 999px;
  color: #fff4cb;
  background: rgba(255, 213, 106, 0.08);
  font-size: 0.78rem;
  text-decoration: none;
  white-space: nowrap;
}

.notice-strip a {
  border-color: rgba(102, 232, 255, 0.34);
  color: #dffaff;
  background: rgba(102, 232, 255, 0.08);
}

.stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

.gacha-stage,
.post-panel {
  position: relative;
  border-radius: 8px;
  padding: clamp(18px, 4vw, 28px);
}

.gacha-stage {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 213, 106, 0.14), transparent 18rem),
    linear-gradient(145deg, rgba(18, 22, 46, 0.8), rgba(11, 12, 28, 0.86));
}

.stage-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.rarity-badge {
  display: inline-flex;
  min-width: 76px;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
  font-weight: 900;
}

.rarity-n { color: #d8d9e8; }
.rarity-r { color: var(--green); box-shadow: 0 0 20px rgba(130, 247, 182, 0.2); }
.rarity-sr { color: var(--gold); box-shadow: 0 0 24px rgba(255, 213, 106, 0.3); }
.rarity-ssr,
.rarity-sss { color: #fff; background: linear-gradient(90deg, var(--pink), var(--gold), var(--cyan)); box-shadow: 0 0 34px rgba(255, 95, 188, 0.58); }

.frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: #050611;
  box-shadow: inset 0 0 42px rgba(102, 232, 255, 0.12), 0 0 32px rgba(255, 95, 188, 0.15);
}

.frame-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 28px rgba(255, 255, 255, 0.08);
}

.empty-frame {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.empty-frame span {
  display: block;
  color: var(--pink);
  font-size: clamp(4rem, 14vw, 8rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 30px rgba(255, 95, 188, 0.8);
}

.empty-frame p {
  max-width: 280px;
  margin: 8px auto 0;
  line-height: 1.7;
}

#youtube-frame,
.youtube-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

#youtube-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.scene-comment {
  min-height: 3.4em;
  margin-bottom: 12px;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 800;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.scene-meta {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
}

.tag {
  padding: 6px 10px;
  border: 1px solid rgba(102, 232, 255, 0.28);
  border-radius: 999px;
  color: #dffaff;
  background: rgba(102, 232, 255, 0.08);
  font-size: 0.82rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.primary-button,
.submit-button,
.ghost-button,
.icon-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
  transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.primary-button,
.submit-button {
  color: #100819;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  box-shadow: 0 0 24px rgba(255, 95, 188, 0.35);
}

.primary-button {
  flex: 1 1 180px;
  padding: 0 22px;
  font-size: 1.05rem;
}

.submit-button {
  width: 100%;
  padding: 0 18px;
}

.ghost-button,
.icon-link {
  padding: 0 14px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.primary-button:hover,
.submit-button:hover,
.ghost-button:hover,
.icon-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button:disabled,
.is-disabled {
  cursor: not-allowed;
  opacity: 0.52;
  pointer-events: none;
}

.panel-heading {
  margin-bottom: 12px;
}

.post-form {
  display: grid;
  gap: 14px;
}

.post-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.time-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.time-fields legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  padding: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.post-form input,
.post-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(5, 6, 17, 0.62);
  outline: none;
}

.post-form input {
  min-height: 46px;
  padding: 0 12px;
}

.post-form textarea {
  resize: vertical;
  min-height: 112px;
  padding: 12px;
}

.post-form input:focus,
.post-form textarea:focus {
  border-color: rgba(102, 232, 255, 0.76);
  box-shadow: 0 0 0 3px rgba(102, 232, 255, 0.12);
}

.form-message {
  min-height: 1.4em;
  margin: 0;
  color: var(--gold);
  font-size: 0.86rem;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(16, 18, 38, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.is-hidden {
  display: none !important;
}

.is-drawing .frame-wrap {
  animation: summon 1.1s ease both;
}

.rarity-burst {
  position: absolute;
  inset: -30%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background:
    conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.24), transparent, rgba(255, 95, 188, 0.3), transparent),
    radial-gradient(circle, rgba(255, 213, 106, 0.3), transparent 42%);
}

.ssr-active .rarity-burst {
  animation: ssrBurst 1.8s ease both;
}

@keyframes twinkle {
  from { transform: translateY(0); }
  to { transform: translateY(-80px); }
}

@keyframes moonSummon {
  0% {
    transform: translate(0, 0) scale(1.34);
    opacity: 0;
    filter: blur(10px) brightness(1.5);
  }
  26% {
    opacity: 1;
    filter: blur(0) brightness(1.08);
  }
  64% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(calc(50vw - 96px), calc(-50vh + 92px)) scale(0.18);
    opacity: 0;
  }
}

@keyframes introFade {
  0%, 72% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

@keyframes glitterRush {
  0% { opacity: 0; transform: scale(0.95); }
  32% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.18) rotate(4deg); }
}

@keyframes songDrift {
  0% { opacity: 0; transform: translate(-12px, 10px) scale(0.88); }
  24% { opacity: 1; }
  100% { opacity: 0; transform: translate(18px, -34px) scale(1.06); }
}

@keyframes songWave {
  0% { opacity: 0; transform: rotate(-18deg) scale(0.72); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: rotate(-18deg) scale(1.28); }
}

@keyframes noteFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes cornerSongFade {
  0% { opacity: 0; transform: translate(0, 8px) scale(0.86); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(18px, -30px) scale(1.04); }
}

@keyframes cornerNoteFloat {
  0% { opacity: 0; transform: translate(0, 8px) scale(0.85); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(18px, -32px) scale(1.08); }
}

@keyframes cornerMoonIn {
  0%, 74% { opacity: 0; transform: scale(0.82); }
  100% { opacity: 0.9; transform: scale(1); }
}

@keyframes summon {
  0% { transform: scale(0.96); filter: brightness(0.8) blur(2px); }
  45% { transform: scale(1.02); filter: brightness(1.8) blur(0); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes ssrBurst {
  0% { opacity: 0; transform: rotate(0deg) scale(0.7); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: rotate(180deg) scale(1.35); }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 18px, 620px);
    padding-top: 12px;
  }

  .intro-moon {
    width: min(88vw, 390px);
  }

  .corner-moon {
    top: 10px;
    right: 10px;
    width: 76px;
    opacity: 0.72;
  }

  .moon-song {
    left: calc(50% + 92px);
    top: calc(50% - 126px);
  }

  .hero-panel {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  h1 {
    font-size: clamp(2.65rem, 12vw, 4.15rem);
  }

  .notice-strip {
    justify-content: center;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .gacha-stage {
    padding-bottom: 18px;
  }

  .frame-wrap {
    margin-bottom: 14px;
  }

  .scene-comment {
    min-height: 0;
    margin-bottom: 8px;
  }

  .scene-meta {
    margin-top: 8px;
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .action-row {
    margin-top: 12px;
  }

  .auth-card {
    min-width: 0;
  }

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

  .action-row > * {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .moon-intro {
    display: none;
  }

  .corner-moon {
    animation: none;
  }
}
