/* Home page ("별밤 모험" canvas: 홈). The hero is the starry lake village (night-bg) with the moon glow, twinkling and
   shooting stars, fireflies and the characters; the cards below rise over its lower edge. All motion can be paused.
   /?theme=day swaps in the day village (design A) behind the same layout. Shared pieces live in base.css. */
:root { --mx: 0px; --my: 0px; --sy: 0px; }
h1, h2, h3, p, figure { margin: 0; }

/* Hero ------------------------------------------------------------------------------------ */
/* clip-path also clips the moving (composited) backdrop, which overflow alone lets bleed one pixel at the bottom edge */
.hero { position: relative; overflow: hidden; clip-path: inset(0 0 1px 0); isolation: isolate; min-height: 860px; }
/* the lower edge melts into the sky shared by the whole page (stars and side moonlight) instead of ending on a flat colour */
.hero { -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 110px), #0000 100%); mask-image: linear-gradient(180deg, #000 calc(100% - 110px), #0000 100%); }
.scene-backdrop, .scene-tint, .sky-fx, .moon-glow { position: absolute; inset: 0; pointer-events: none; }
/* The backdrop reaches below the hero so the scroll parallax never uncovers its bottom edge.
   The moon glow is a same-size picture laid out exactly like the backdrop, so it stays on the moon at every width. */
.scene-backdrop, .moon-glow { inset: -20px 0 -120px; transform: translate3d(calc(var(--mx) * -0.4), calc(var(--my) * -0.4 + var(--sy) * -0.22), 0) scale(1.04); }
.scene-backdrop { z-index: -5; background: url("img/night-bg.webp") center 32% / cover no-repeat; animation: kenBurns 24s ease-in-out infinite alternate; }
.moon-glow { z-index: -4; background: url("img/moon-glow.svg") center 32% / cover no-repeat; animation: kenBurns 24s ease-in-out infinite alternate, moonGlow 6s ease-in-out infinite alternate; }
.scene-tint { z-index: -2; bottom: -2px; background: linear-gradient(90deg, #091230e6 0%, #09123094 32%, #09123000 60%), linear-gradient(0deg, #091230 0%, #091230b3 13%, #09123000 34%); }
.sky-fx { z-index: -3; transform: translate3d(calc(var(--mx) * -0.4), calc(var(--my) * -0.4 + var(--sy) * -0.22), 0); }
.hero-layout { position: relative; z-index: 3; max-width: calc(var(--wrap) + 48px); min-height: 860px; margin: auto; padding: 150px 24px 156px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px; }
.hero-copy { flex: 0 1 560px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 18px; padding-bottom: 36px; }
.hero-logo { display: block; width: 400px; max-width: 100%; height: auto; margin-left: -10px; filter: drop-shadow(0 14px 26px #03081a8c); }
.copy-details { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.copy-details h1 { font-family: var(--display); font-weight: 400; font-size: 42px; line-height: 1.22; letter-spacing: -0.01em; color: #fff; text-shadow: 0 2px 20px #03081aa6; white-space: pre-line; text-wrap: pretty; }
.hero-sub { font-size: 18px; color: #d5dcf5; text-shadow: 0 1px 12px #03081a99; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.play-cta::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 42%; background: linear-gradient(100deg, #fff0 0%, #ffffff8c 50%, #fff0 100%); transform: skewX(-18deg); pointer-events: none; animation: sheen 5.5s ease-in-out 1.5s infinite; }
.server-status { display: inline-flex; align-items: center; gap: 10px; margin-top: 4px; padding: 8px 16px 8px 12px; border-radius: 999px; background: #091230bd; border: 1px solid #95aaff47; font-size: 15px; color: #dde4ff; }
.server-status > i { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--mint); box-shadow: 0 0 0 4px #6ee7b733; animation: pulseDot 2.4s ease-in-out infinite; }
.server-status.bad > i { background: var(--rose); box-shadow: 0 0 0 4px #ff8fa333; animation: none; }
.server-status.wait > i { background: var(--text-3); box-shadow: none; animation: none; }
.character-stage { flex: 1 1 560px; max-width: 780px; margin: 0 -24px 0 auto; pointer-events: none; transform: translate3d(var(--mx), calc(var(--my) + var(--sy) * -0.08), 0); }
.character-motion img { display: block; width: 100%; height: auto; filter: drop-shadow(0 20px 26px #03081a99); }
.foreground-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; transform: translate3d(calc(var(--mx) * -1.5), calc(var(--my) * -1.5), 0); }
.foreground-layer > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-bottom { position: absolute; right: max(24px, calc((100% - var(--wrap)) / 2)); bottom: 118px; z-index: 6; }

/* Stars and shooting stars sit in .sky-fx (looks in base.css); fireflies are home-only */
.firefly-fx { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.firefly { position: absolute; left: var(--x); top: var(--y); width: 6px; height: 6px; border-radius: 50%; background: #ffe58a; box-shadow: 0 0 10px 3px #ffd75e99, 0 0 22px 8px #ffcf4433; opacity: 0; animation: fireflyDrift var(--d, 9s) ease-in-out var(--delay, 0s) infinite alternate, fireflyBlink var(--b, 3.2s) ease-in-out var(--delay, 0s) infinite; }

/* Day village (/?theme=day): same layout, the text keeps its dark backing */
.theme-day .scene-backdrop { background-image: url("img/home-bg.webp"); background-position: center 62%; }
.theme-day .moon-glow { display: none; }
.theme-day .scene-tint { background: linear-gradient(90deg, #091230cc 0%, #09123073 34%, #09123000 60%), linear-gradient(0deg, #091230 0%, #09123000 30%); }

/* Content below the hero ---------------------------------------------------------------- */
.content-wrap { position: relative; z-index: 7; width: min(var(--wrap), calc(100% - 48px)); margin: -96px auto 0; padding-bottom: 104px; display: flex; flex-direction: column; gap: 76px; }
.dashboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr)); gap: 24px; }
.surface { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 28px 64px #03081a8c, inset 0 1px 0 #ffffff0d; }
.news-panel, .ranking-panel { padding: 28px 28px 20px; display: flex; flex-direction: column; gap: 18px; }
.panel-heading { display: flex; align-items: center; gap: 14px; }
.panel-heading h2, .section-head h2 { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.15; }
.panel-heading h2 .chip { font-size: 12px; }
.text-link { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--text-2); font-size: 15px; font-weight: 700; white-space: nowrap; }
.text-link:hover { color: var(--gold-text); }
.text-link .icon { width: 18px; height: 18px; }
.news-list { list-style: none; padding: 0; margin: 0; min-height: 280px; }
.news-list li { min-height: 56px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line-soft); }
.news-list li:last-child { border: 0; }
.news-list li.empty { color: var(--text-2); justify-content: center; border: 0; }
.news-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.news-title:hover { color: var(--gold-text); text-decoration: underline; text-underline-offset: 4px; }
.news-list time { flex: none; font-size: 14px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rank-list { min-height: 340px; }
.rank-row { display: flex; align-items: center; gap: 14px; padding: 8px 2px; border-bottom: 1px solid var(--line-soft); }
.rank-row:last-child { border: 0; }
.rank-row.empty { color: var(--text-2); justify-content: center; border: 0; min-height: 120px; }
.rank-row .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.rank-row .who b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-meta { color: var(--text-3); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-value { flex: none; font-family: var(--display); font-size: 21px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-row:first-child .rank-value { color: #ffe3a0; }
.rank-rule { font-size: 14px; color: var(--text-3); }
.rank-rule a { color: var(--gold-text); font-weight: 700; }

/* Event */
.event-panel { position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px 32px; align-items: center; padding: 44px 48px; border-radius: 28px; border: 1px solid #2b3d75; background: #0c1739 url("img/night-bg.webp") center 82% / cover no-repeat; box-shadow: var(--shadow); }
.event-panel::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #091230f2 0%, #091230d1 46%, #09123099 100%); }
.event-heading { grid-column: 1; grid-row: 1; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.14em; color: var(--gold-text); }
.eyebrow img { width: 40px; height: 40px; margin: -10px -4px -10px -6px; }
.eyebrow .chip { margin-left: 0; background: #ffffff1a; color: #dde4ff; letter-spacing: 0; }
.event-heading h2 { margin-top: 10px; font-family: var(--display); font-weight: 400; font-size: 46px; line-height: 1.12; }
.event-heading p { margin-top: 10px; font-size: 18px; color: #d5dcf5; }
.buffs { grid-column: 2; grid-row: 1 / span 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.buff { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 20px; border-radius: 20px; background: #111c40db; border: 1px solid #33437e; transition: transform 0.2s, border-color 0.2s; }
.buff:hover { transform: translateY(-3px); border-color: #4a5c9c; }
.buff img { width: 80px; height: 80px; margin: -8px 0 -4px -8px; }
.buff span { display: block; font-size: 14px; color: var(--text-2); }
.buff strong { display: block; font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.15; color: var(--gold-text); white-space: nowrap; }
.event-meta { grid-column: 1; grid-row: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 15px; color: var(--text-2); }
.event-meta .icon { width: 18px; height: 18px; color: var(--moon); }

/* Quick links and features */
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.section-head .title-icon { width: 40px; height: 40px; }
.section-head h2 { font-size: 32px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 18px; }
.quick-card { display: flex; align-items: center; gap: 18px; padding: 22px 24px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); transition: transform 0.2s, border-color 0.2s; }
.quick-card:hover { transform: translateY(-3px); border-color: #3a4f8f; }
.quick-card strong { display: block; font-size: 18px; }
.quick-card span span { display: block; margin-top: 2px; font-size: 14px; color: var(--text-3); }
.quick-card > .icon:last-child { margin-left: auto; width: 22px; height: 22px; color: var(--moon); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 18px; }
.feature-card { display: flex; flex-direction: column; gap: 10px; padding: 26px; border-radius: 22px; box-shadow: none; transition: transform 0.2s, border-color 0.2s; }
.feature-card:hover { transform: translateY(-4px); border-color: #3a4f8f; }
.feature-card h3 { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; font-family: var(--display); font-weight: 400; font-size: 23px; line-height: 1.25; }
.feature-card p { color: var(--text-2); }
/* game-icon tiles inside dark cards turn into dark tinted squares; the quick links carry plain line glyphs */
.quick-card .game-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--dark); border: 1px solid var(--dark-line); box-shadow: none; }
/* the feature tiles show the item art at its full 80px, lit from inside */
.feature-card .game-icon { width: 96px; height: 96px; border-radius: 26px; background: radial-gradient(circle at 50% 42%, var(--dark-line) 0%, var(--dark) 72%); border: 1px solid var(--dark-line); box-shadow: none; }
.feature-card .game-icon > .pix { width: 80px; height: 80px; }
.quick-card:hover .game-icon, .feature-card:hover .game-icon { transform: rotate(-5deg); }
.sprite-tile { position: relative; overflow: hidden; }
.sprite-tile > .sprite { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); }
.section-head .tile { border-radius: 16px; }

/* Motion (kenBurns, moonGlow, twinkle and meteor keyframes and the general motion-off rule are in base.css) */
@keyframes floatArt { from { translate: 0 0; } to { translate: 0 -10px; } }
@keyframes starPulse { from { opacity: 0.25; } to { opacity: 0.9; } }
@keyframes fireflyDrift { from { translate: 0 0; } to { translate: var(--fx, 30px) var(--fy, -40px); } }
@keyframes fireflyBlink { 0%, 100% { opacity: 0.1; } 40%, 60% { opacity: 1; } }
@keyframes sheen { 0% { left: -60%; } 30%, 100% { left: 130%; } }
@keyframes pulseDot { 0%, 100% { box-shadow: 0 0 0 3px #6ee7b733; } 50% { box-shadow: 0 0 0 7px #6ee7b714; } }
.effect-float .character-motion { animation: floatArt 6s ease-in-out infinite alternate; }
.effect-stars .foreground-layer > img { animation: starPulse 4.8s ease-in-out infinite alternate; }
.motion-off .character-stage, .motion-off .foreground-layer, .motion-off .scene-backdrop, .motion-off .moon-glow, .motion-off .sky-fx { transform: none !important; }
.motion-off .firefly, .motion-off .play-cta::after { display: none; }

/* Big screens: the hero grows with the wider content */
@media (min-width: 2200px) {
  .hero-logo { width: 440px; }
  .copy-details h1 { font-size: 46px; }
  .character-stage { max-width: 860px; }
}
@media (max-width: 1200px) and (min-width: 701px) {
  .hero-copy { flex-basis: 480px; }
  .hero-logo { width: 340px; }
  .copy-details h1 { font-size: 36px; }
  .character-stage { flex-basis: 420px; }
  .event-panel { grid-template-columns: minmax(0, 1fr); padding: 36px; }
  .event-heading, .buffs, .event-meta { grid-column: 1; grid-row: auto; }
}
@media (max-width: 900px) and (min-width: 701px) {
  .hero-layout { align-items: center; }
  .character-stage { order: -1; margin: 0 auto; flex-basis: 100%; max-width: 620px; }
  .hero-copy { flex-basis: 100%; align-items: center; text-align: center; padding-bottom: 0; }
  .copy-details { align-items: center; }
  .hero-logo { margin: -40px auto 0; }
}
@media (max-width: 700px) {
  .hero { min-height: 0; -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 30px), #0000 100%); mask-image: linear-gradient(180deg, #000 calc(100% - 30px), #0000 100%); }
  .hero-layout { min-height: 0; flex-direction: column; flex-wrap: nowrap; align-items: center; gap: 0; padding: calc(var(--header) + 4px) 16px 36px; text-align: center; }
  .character-stage { order: -1; flex: none; width: 100%; max-width: 420px; margin: 0 auto; transform: none; }
  .hero-copy { flex: none; width: 100%; align-items: center; gap: 14px; padding-bottom: 0; }
  .hero-logo { width: 270px; margin: -34px auto 0; }
  .copy-details { width: 100%; align-items: center; gap: 14px; }
  .copy-details h1 { font-size: 29px; line-height: 1.25; }
  .hero-sub { font-size: 15px; }
  .hero-actions { width: 100%; flex-direction: column; gap: 10px; margin-top: 4px; }
  .hero-actions > .button { width: 100%; min-height: 56px; font-size: 18px; }
  .server-status { font-size: 14px; }
  .scene-backdrop, .moon-glow { background-size: auto 100%; background-position: 62% 30%; }
  .scene-tint { background: linear-gradient(180deg, #09123059 0%, #09123026 35%, #091230cc 62%, #091230 100%); }
  .hero-bottom { top: calc(var(--header) + 8px); right: 12px; bottom: auto; }
  .hero-bottom .motion-toggle { min-height: 36px; padding: 0 12px; font-size: 13px; }
  .content-wrap { width: calc(100% - 32px); margin-top: 4px; padding-bottom: 48px; gap: 22px; }
  .dashboard { gap: 22px; }
  .news-panel, .ranking-panel { padding: 20px 18px 12px; gap: 12px; border-radius: 22px; }
  .panel-heading { gap: 12px; }
  .panel-heading .tile { width: 46px; height: 46px; border-radius: 14px; }
  .panel-heading .kicker { display: none; }
  .panel-heading h2, .section-head h2 { font-size: 25px; }
  .text-link { font-size: 14px; }
  .text-link .icon { display: none; }
  .tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
  .tabs button { padding: 0 6px; }
  .news-list { min-height: 0; }
  .news-list li { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; padding: 12px 0; align-items: center; }
  .news-list .category { width: auto; padding: 2px 8px; font-size: 12px; justify-self: start; }
  .news-list time { grid-column: 2; grid-row: 1; font-size: 13px; }
  .news-title { grid-column: 1 / -1; white-space: normal; }
  .rank-list { min-height: 0; }
  .rank-row { gap: 12px; }
  .rank-row .avatar { width: 46px; height: 46px; border-radius: 14px; }
  .rank-value { font-size: 18px; }
  .medal { width: 30px; height: 30px; border-radius: 10px; font-size: 16px; }
  .event-panel { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 22px 18px; border-radius: 24px; }
  .event-panel::before { background: linear-gradient(180deg, #091230f0 0%, #091230cc 100%); }
  .event-heading h2 { font-size: 32px; margin-top: 6px; }
  .event-heading p { font-size: 15px; margin-top: 6px; }
  .buffs { order: 2; gap: 8px; margin-top: 6px; }
  .buff { align-items: center; padding: 12px 6px; gap: 2px; text-align: center; border-radius: 16px; }
  .buff img { width: 40px; height: 40px; margin: 0; }
  .buff span { font-size: 12px; }
  .buff strong { font-size: 19px; }
  .event-meta { order: 3; font-size: 13px; }
  .section-head { margin-bottom: 12px; gap: 10px; }
  .section-head .kicker { display: none; }
  .quick-grid { gap: 10px; }
  .quick-card { padding: 16px; gap: 14px; border-radius: 18px; }
  .quick-card .game-icon { width: 52px; height: 52px; border-radius: 16px; }
  .quick-card strong { font-size: 16px; }
  .quick-card span span { font-size: 13px; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .feature-card { padding: 16px; gap: 6px; border-radius: 18px; }
  .feature-card .game-icon { width: 52px; height: 52px; border-radius: 16px; }
  .feature-card .game-icon > .pix { width: 40px; height: 40px; }
  .feature-card .sprite-tile > .sprite { top: -15px; scale: 0.5; }  /* exactly half: the game's own pixels */
  .section-head .tile { width: 46px; height: 46px; border-radius: 14px; }
  .feature-card h3 { font-size: 18px; margin-top: 2px; }
  .feature-card p { font-size: 13px; }
  .feature-card .chip { margin-left: 0; }
}
