/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sky: #0EA5E9;
  --sky-dark: #0369A1;
  --sky-light: #BAE6FD;
  --silver: #94A3B8;
  --storm: #334155;
  --white: #F0F9FF;
  --ink: #1a1a1a;
  --panel-bg: #F0F9FF;
  --border: 3px solid var(--ink);
  --border-fat: 5px solid var(--ink);
  --accent: #38BDF8;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Comic Neue', 'Comic Sans MS', cursive;
  background: var(--sky-light);
  background-image:
    radial-gradient(ellipse 60px 30px at 15% 20%, rgba(255,255,255,.7) 0%, transparent 100%),
    radial-gradient(ellipse 80px 40px at 70% 10%, rgba(255,255,255,.5) 0%, transparent 100%),
    radial-gradient(ellipse 50px 25px at 40% 35%, rgba(255,255,255,.4) 0%, transparent 100%),
    radial-gradient(ellipse 90px 35px at 85% 25%, rgba(255,255,255,.6) 0%, transparent 100%),
    linear-gradient(180deg, #BAE6FD 0%, #E0F2FE 60%, #F0F9FF 100%);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
}

/* ===== HEADER ===== */
header {
  background: var(--sky-dark);
  border-bottom: var(--border-fat);
  box-shadow: 0 6px 0 var(--ink);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 960px;
  margin: auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.logo-wrap { display: flex; align-items: center; gap: 14px; }

.wind-icon {
  font-size: 2.6rem;
  animation: windBlow 2s ease-in-out infinite;
  line-height: 1;
  filter: drop-shadow(0 0 10px #38BDF8);
}

@keyframes windBlow {
  0%   { transform: translateX(0) rotate(0deg); }
  30%  { transform: translateX(6px) rotate(-5deg); }
  60%  { transform: translateX(-4px) rotate(3deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

.site-title {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: clamp(1.4rem, 4.5vw, 2.6rem);
  color: var(--sky-light);
  letter-spacing: 3px;
  text-shadow: 3px 3px 0 var(--ink), -1px -1px 0 var(--ink);
  line-height: 1;
}

.site-sub {
  color: rgba(255,255,255,.7);
  font-size: .8rem;
  margin-top: 3px;
}

.header-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.char-btn {
  background: var(--sky-light);
  border: var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  font-family: 'Bangers', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s, box-shadow .1s;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
}
.char-btn:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--ink); }
.char-btn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--ink); }

.universe-btn {
  background: #FCD34D;
  border: var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-family: 'Bangers', sans-serif;
  font-size: 1rem;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s, box-shadow .1s;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
}
.universe-btn:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--ink); }

/* ===== CHARACTER CARD ===== */
.char-card {
  display: none;
  background: white;
  border-bottom: var(--border-fat);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.1);
}

.char-card.open { display: block; }

.char-card-inner {
  max-width: 900px;
  margin: auto;
  padding: 28px 20px;
  display: flex;
  gap: 28px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.char-portrait {
  width: 180px;
  height: 240px;
  object-fit: cover;
  border: var(--border-fat);
  border-radius: 12px;
  box-shadow: 6px 6px 0 var(--ink);
  flex-shrink: 0;
  background: #e0f2fe;
}

.char-name {
  font-family: 'Bangers', sans-serif;
  font-size: 2rem;
  letter-spacing: 2px;
  color: var(--sky-dark);
  text-shadow: 2px 2px 0 var(--ink);
}

.char-tagline {
  font-style: italic;
  color: var(--sky);
  font-weight: 700;
  font-size: 1.05rem;
  margin: 6px 0 10px;
  border-left: 4px solid var(--sky);
  padding-left: 10px;
}

.origin-badge {
  display: inline-block;
  background: #FEF3C7;
  border: 2px solid #F59E0B;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: .8rem;
  font-weight: 700;
  color: #92400E;
  margin-bottom: 14px;
  letter-spacing: .5px;
}

.char-traits {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.char-traits li { font-size: .95rem; }

.char-origin {
  font-size: .9rem;
  color: #444;
  line-height: 1.6;
  max-width: 540px;
  border-left: 3px solid var(--sky-light);
  padding-left: 12px;
  font-style: italic;
}

/* ===== ORIGIN BANNER ===== */
.origin-banner {
  background: linear-gradient(90deg, #FEF3C7, #FDE68A, #FEF3C7);
  border-bottom: 3px solid #F59E0B;
  padding: 10px 20px;
}

.origin-banner-inner {
  max-width: 960px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .9rem;
  font-weight: 700;
  color: #78350F;
}

.origin-icon { font-size: 1.4rem; }

/* ===== MAIN ===== */
main {
  max-width: 960px;
  margin: 30px auto;
  padding: 0 16px;
}

/* ===== DATE NAV ===== */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.nav-btn {
  background: var(--sky-dark);
  color: white;
  border: var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-family: 'Bangers', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .1s, box-shadow .1s;
  flex-shrink: 0;
}
.nav-btn:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--ink); }
.nav-btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.nav-btn:disabled { opacity: .4; cursor: default; transform: none; box-shadow: 4px 4px 0 var(--ink); }

.date-display {
  text-align: center;
  background: white;
  border: var(--border-fat);
  border-radius: 12px;
  padding: 10px 24px;
  box-shadow: 4px 4px 0 var(--ink);
  flex: 1;
  max-width: 320px;
  margin: 0 auto;
}

.episode-label {
  font-family: 'Bangers', sans-serif;
  font-size: .8rem;
  letter-spacing: 3px;
  color: #888;
}

.episode-num {
  font-family: 'Bangers', sans-serif;
  font-size: 2rem;
  color: var(--sky-dark);
  line-height: 1;
}

.date-label {
  font-size: .85rem;
  color: #555;
  margin-top: 2px;
}

/* ===== ORIGIN TAG ===== */
.origin-tag {
  text-align: center;
  background: #F59E0B;
  color: white;
  font-family: 'Bangers', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 2px;
  padding: 8px 20px;
  border: var(--border);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--ink);
  margin-bottom: 14px;
  animation: pulseTag 2s ease-in-out infinite;
}

@keyframes pulseTag {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.02); }
}

/* ===== COMIC TITLE ===== */
.comic-title-wrap {
  text-align: center;
  margin-bottom: 24px;
  background: var(--sky);
  border: var(--border-fat);
  border-radius: 12px;
  padding: 16px 24px;
  box-shadow: 6px 6px 0 var(--ink);
  position: relative;
  overflow: hidden;
}

.comic-title-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 40px 20px at 20% 30%, rgba(255,255,255,.25) 0%, transparent 100%),
    radial-gradient(ellipse 60px 25px at 75% 60%, rgba(255,255,255,.2) 0%, transparent 100%);
  pointer-events: none;
}

/* Wind lines animation */
.comic-title-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -15deg,
    transparent,
    transparent 18px,
    rgba(255,255,255,.06) 18px,
    rgba(255,255,255,.06) 19px
  );
  pointer-events: none;
}

.comic-title {
  font-family: 'Bangers', sans-serif;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  color: white;
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 var(--ink);
  position: relative;
  z-index: 1;
}

.comic-setting {
  font-size: .95rem;
  color: rgba(255,255,255,.9);
  margin-top: 6px;
  font-style: italic;
  position: relative;
  z-index: 1;
}

/* ===== PANELS GRID ===== */
.panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 580px) {
  .panels-grid { grid-template-columns: 1fr; }
}

/* ===== PANEL ===== */
.panel {
  background: var(--panel-bg);
  border: var(--border-fat);
  border-radius: 10px;
  box-shadow: 6px 6px 0 var(--ink);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: swoopIn .45s cubic-bezier(.175,.885,.32,1.275) both;
  position: relative;
}

.panel:nth-child(1) { animation-delay: .05s; }
.panel:nth-child(2) { animation-delay: .12s; }
.panel:nth-child(3) { animation-delay: .19s; }
.panel:nth-child(4) { animation-delay: .26s; }

@keyframes swoopIn {
  from { opacity: 0; transform: translateX(-20px) scale(.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

.panel-num {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--sky-dark);
  color: white;
  font-family: 'Bangers', sans-serif;
  font-size: .9rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  letter-spacing: 0;
  border: 2px solid var(--ink);
}

.panel-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #BAE6FD 0%, #E0F2FE 100%);
  overflow: hidden;
  flex-shrink: 0;
}

.panel-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity .5s;
}

.panel-img.loading { opacity: 0; }
.panel-img.loaded  { opacity: 1; }

.panel-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #BAE6FD 0%, #E0F2FE 100%);
  transition: opacity .4s;
  z-index: 1;
}

.panel-loader.hidden { opacity: 0; pointer-events: none; }

.loader-wind {
  font-size: 2.5rem;
  animation: windSpin 1s ease-in-out infinite;
}

@keyframes windSpin {
  0%   { transform: translateX(-8px) rotate(-10deg); opacity: .6; }
  50%  { transform: translateX(8px) rotate(10deg); opacity: 1; }
  100% { transform: translateX(-8px) rotate(-10deg); opacity: .6; }
}

.loader-text {
  font-family: 'Comic Neue', cursive;
  font-size: .8rem;
  color: var(--sky-dark);
  font-weight: 700;
}

/* ===== SPEECH BUBBLE ===== */
.speech-bubble {
  position: absolute;
  bottom: 10px;
  right: 10px;
  max-width: 62%;
  background: white;
  border: 2.5px solid var(--ink);
  border-radius: 14px 14px 4px 14px;
  padding: 6px 10px;
  font-size: clamp(.65rem, 1.5vw, .8rem);
  font-weight: 700;
  line-height: 1.3;
  box-shadow: 2px 2px 0 var(--ink);
  z-index: 3;
}

.speech-bubble.kael {
  border-color: var(--sky-dark);
  background: #e0f2fe;
  border-radius: 14px 14px 14px 4px;
  left: 10px;
  right: auto;
}

.bubble-speaker {
  font-size: .6rem;
  color: var(--sky-dark);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  display: block;
  margin-bottom: 2px;
}

/* ===== PANEL CAPTION ===== */
.panel-caption {
  padding: 10px 12px;
  font-size: clamp(.75rem, 1.8vw, .9rem);
  font-style: italic;
  color: #333;
  border-top: 2px solid var(--ink);
  background: var(--panel-bg);
  line-height: 1.4;
  flex: 1;
}

/* ===== SHARING BAR ===== */
.sharing-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 16px;
  background: white;
  border: var(--border-fat);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 700;
  font-size: .9rem;
}

.share-btn {
  background: var(--sky-dark);
  color: white;
  border: var(--border);
  border-radius: 6px;
  padding: 8px 16px;
  font-family: 'Comic Neue', cursive;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s, box-shadow .1s;
  font-size: .9rem;
  text-decoration: none;
  display: inline-block;
}
.share-btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }

.universe-link {
  background: #F59E0B;
  color: white;
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 24px 16px;
  background: var(--storm);
  color: rgba(255,255,255,.7);
  font-size: .85rem;
  margin-top: 40px;
  border-top: var(--border-fat);
}

footer a { color: var(--sky-light); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--storm);
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 700;
  font-size: .9rem;
  opacity: 0;
  transition: transform .3s, opacity .3s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}

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