@font-face {
  font-family: 'Nunito';
  src: url('/assets/fonts/nunito-var.woff2') format('woff2-variations');
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --ink: #333f5c;
  --muted: #8a93a8;
  --accent: #e25c5c;
  --teal: #1fae99;
  --tint: #fdf2f0;
  --line: #dee4ef;
  --shadow: #333f5c;
  --sans: 'Nunito', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
  --err: #e25c5c;
  --success: #1fae99;
}

[data-theme="dark"] {
  --bg: #1d2331;
  --card: #262e42;
  --ink: #e9edf6;
  --muted: #939db4;
  --accent: #f0837c;
  --teal: #3cc9b3;
  --tint: #332b36;
  --line: #3a4460;
  --shadow: #10141f;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: #fff;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

a:hover {
  text-decoration-style: wavy;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-line: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shell {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.2rem 3.5rem;
  position: relative;
  z-index: 1;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 0;
  border-bottom: 2px dashed var(--line);
  margin-bottom: 2rem;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-text {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.logo-text span {
  color: var(--ink);
}

.toggles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tt {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .85em;
  font-weight: 700;
  cursor: pointer;
  padding: .3rem .5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.tt:hover {
  color: var(--accent);
  background: var(--tint);
}

/* Hero Section */
.hero {
  text-align: center;
  margin: 2rem auto 2.5rem;
  max-width: 600px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--ink);
}

.squig {
  display: block;
  width: clamp(140px, 35vw, 210px);
  height: 14px;
  margin: .4rem auto 0;
  color: var(--accent);
}

.hero p {
  margin: .9rem auto 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 1.1rem;
}

/* Card Styles */
.card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--shadow);
  padding: 1.5rem;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.card.interactive:hover {
  transform: translate(-3px, -3px);
  box-shadow: 8px 8px 0 var(--shadow);
}

/* Direct ID Lookup Box */
.lookup-box {
  max-width: 600px;
  margin: 0 auto 2.5rem;
}

.lookup-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 1rem;
  text-align: center;
}

.lookup-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.input-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.input-group {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-label {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.txt-input {
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 0.8rem;
  width: 100%;
}

.txt-input:focus {
  outline: 0;
  border-color: var(--accent);
}

.pills-group {
  display: flex;
  gap: 0.3rem;
  background: var(--bg);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 0.25rem;
}

.pill-opt {
  flex: 1;
  border: 0;
  background: none;
  font: inherit;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9em;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  text-align: center;
  transition: all 0.1s ease;
}

.pill-opt:hover {
  color: var(--ink);
}

.pill-opt.active {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary {
  border: 2px solid var(--ink);
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 900;
  font-size: 1.05rem;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--shadow);
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  width: 100%;
}

.btn-primary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--shadow);
}

.btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.btn-secondary {
  border: 2px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  font-size: 0.9em;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--shadow);
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-secondary:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--shadow);
  color: var(--accent);
}

.btn-secondary:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--shadow);
}

/* Search Box styling */
.search-section {
  margin-bottom: 2.5rem;
}

.search-bar-container {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 1.15rem;
  padding: 0.9rem 1.2rem 0.9rem 3.2rem;
  box-shadow: 4px 4px 0 var(--shadow);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.search-input:focus {
  outline: 0;
  border-color: var(--accent);
}

.search-icon-svg {
  position: absolute;
  left: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--muted);
  pointer-events: none;
}

/* Grid & Layout Sections */
.section-title {
  font-size: 1.4rem;
  font-weight: 900;
  margin: 2rem 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--line);
  padding-bottom: 0.4rem;
}

.section-title h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--ink);
}

.section-title-line {
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  width: 60px;
  margin-top: 0.3rem;
}

.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2.5rem;
}

/* Anime Card Item */
.anime-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  cursor: pointer;
}

.anime-poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--line);
}

.anime-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.anime-card:hover .anime-poster {
  transform: scale(1.05);
}

.score-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 2.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--shadow);
  z-index: 2;
}

.type-badge {
  position: absolute;
  bottom: 0.6rem;
  left: 0.6rem;
  background: var(--card);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--shadow);
  z-index: 2;
}

.anime-info {
  padding: 0.6rem 0.2rem 0.2rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.anime-title {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 2.6rem;
}

.anime-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}

/* History / Recent Grid */
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2.5rem;
}

.recent-card {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.recent-thumb {
  width: 75px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}

.recent-details {
  flex-grow: 1;
  min-width: 0;
}

.recent-title {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-ep {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.recent-time {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.recent-progress {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border: 2px solid var(--ink);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.recent-progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 99px;
}

/* Watch Page Layout */
.watch-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.8rem;
  align-items: start;
}

@media (max-width: 900px) {
  .watch-container {
    grid-template-columns: 1fr;
  }
}

/* Player Column */
.player-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 var(--shadow);
}

.player-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Selectors row */
.selector-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.selector-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.selector-label {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--muted);
}

.select-dropdown {
  border: 2px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.85em;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
}

.select-dropdown:focus {
  border-color: var(--accent);
}

/* Episodes Panel */
.episodes-panel {
  display: flex;
  flex-direction: column;
  max-height: 480px;
}

.episodes-header {
  font-weight: 900;
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  border-bottom: 2px solid var(--line);
  padding-bottom: 0.3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.episodes-count {
  font-size: 0.8em;
  color: var(--muted);
}

.ep-grid-container {
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 0.2rem;
}

/* Scrollbar styling */
.ep-grid-container::-webkit-scrollbar {
  width: 8px;
}
.ep-grid-container::-webkit-scrollbar-track {
  background: var(--bg);
  border: 2px solid var(--ink);
  border-radius: 4px;
}
.ep-grid-container::-webkit-scrollbar-thumb {
  background: var(--ink);
  border-radius: 4px;
}

.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 0.5rem;
}

.ep-btn {
  border: 2px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  font-size: 0.9em;
  padding: 0.4rem 0.2rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.1s ease;
}

.ep-btn:hover {
  border-color: var(--accent);
  background: var(--tint);
  color: var(--accent);
}

.ep-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--ink);
}

/* Detail Info Box */
.details-box {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.details-header {
  display: flex;
  gap: 1rem;
}

.details-poster {
  width: 100px;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--ink);
  flex-shrink: 0;
  box-shadow: 3px 3px 0 var(--shadow);
}

.details-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.details-title-romaji {
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1.2;
  margin: 0;
  word-wrap: break-word;
}

.details-title-english {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
  margin: 0;
}

.badge-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.meta-badge {
  background: var(--tint);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  border: 1.5px solid var(--line);
}

.genre-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.genre-tag {
  background: var(--bg);
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.synopsis {
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.5;
  border-top: 2.5px dashed var(--line);
  padding-top: 0.8rem;
  margin: 0;
}

.synopsis-title {
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
  color: var(--ink);
}

.details-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  font-size: 0.85rem;
  border-top: 2.5px dashed var(--line);
  padding-top: 0.8rem;
}

.info-item {
  display: flex;
  flex-direction: column;
}

.info-item-label {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8em;
  text-transform: uppercase;
}

.info-item-value {
  font-weight: 800;
}

/* Sidebar Info (Watch Page) */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}



/* ============================================
   Floating Animated Sticker Card
   ============================================ */
@keyframes stickerFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.sticker-card {
  position: fixed;
  right: 24px;
  bottom: 160px;
  width: 85px;
  background: var(--card);
  border: 2.5px solid var(--ink);
  box-shadow: 5px 5px 0 var(--shadow);
  border-radius: 18px;
  padding: 7px 7px 5px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  animation: stickerFloat 3s ease-in-out infinite;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  user-select: none;
}

.sticker-card:hover {
  box-shadow: 7px 7px 0 var(--shadow);
  transform: translateY(-10px) scale(1.04) !important;
}

.sticker-card img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 10px;
  display: block;
}

.sticker-label {
  font-family: var(--font-body, 'Nunito', sans-serif);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

@media (max-width: 780px) {
  .sticker-card { display: none !important; }
}



/* Chibi idle keyframes */
@keyframes chibiIdleBob {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-6px); }
}
@keyframes chibiBreath {
  0%, 100% { transform: scaleY(1); }
  50%       { transform: scaleY(1.03); }
}
@keyframes chibiHairSway {
  0%, 100% { transform: rotate(0deg); }
  30%       { transform: rotate(-4deg); }
  70%       { transform: rotate(4deg); }
}
@keyframes chibiStrandSway {
  0%, 100% { transform: rotate(0deg) skewX(0deg); }
  50%       { transform: rotate(5deg) skewX(3deg); }
}
@keyframes chibiBlink {
  0%, 90%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(0.05); }
}
@keyframes chibiArmSwingL {
  0%, 100% { transform: rotate(0deg); }
  50%       { transform: rotate(-8deg); }
}
@keyframes chibiArmSwingR {
  0%, 100% { transform: rotate(0deg); }
  50%       { transform: rotate(8deg); }
}
@keyframes chibiTailWag {
  0%, 100% { transform: rotate(-10deg); }
  50%       { transform: rotate(25deg); }
}
@keyframes chibiShadowPulse {
  0%, 100% { transform: scaleX(1); opacity: 0.18; }
  50%       { transform: scaleX(0.82); opacity: 0.10; }
}
@keyframes chibiBowBob {
  0%, 100% { transform: rotate(0deg); }
  50%       { transform: rotate(-6deg); }
}
@keyframes chibiLegBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-2px); }
}

/* Container — fixed bottom-right */
.css-chibi {
  position: fixed;
  right: 28px;
  bottom: 0;
  width: 110px;
  height: 180px;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
}

@media (max-width: 780px) {
  .css-chibi { display: none !important; }
}

/* Whole character bobs up and down */
.chibi-body-group {
  position: relative;
  width: 100%;
  height: 100%;
  animation: chibiIdleBob 2.4s ease-in-out infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Ground shadow */
.chibi-body-group::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  translate: -50% 0;
  width: 54px;
  height: 10px;
  background: var(--shadow);
  border-radius: 50%;
  animation: chibiShadowPulse 2.4s ease-in-out infinite;
}

/* ---- HAIR BACK ---- */
.chibi-hair-back {
  position: absolute;
  top: 14px;
  width: 62px;
  display: flex;
  justify-content: space-between;
  z-index: 1;
  animation: chibiHairSway 3s ease-in-out infinite;
  transform-origin: center top;
}
.chibi-hair-strand {
  width: 13px;
  height: 46px;
  background: #7e5bef;
  border-radius: 0 0 8px 8px;
  animation: chibiStrandSway 3s ease-in-out infinite;
}
.strand-l { transform-origin: top center; border-radius: 8px 0 8px 8px; }
.strand-r { transform-origin: top center; border-radius: 0 8px 8px 8px; animation-delay: 0.3s; }

/* ---- HEAD ---- */
.chibi-head {
  position: relative;
  width: 62px;
  height: 58px;
  background: #fddcb5;
  border-radius: 50% 50% 44% 44%;
  border: 2px solid #c8845a;
  z-index: 3;
  margin-top: 4px;
  flex-shrink: 0;
}

/* ---- FACE ---- */
.chibi-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Eyes */
.chibi-eye {
  position: absolute;
  top: 22px;
  width: 13px;
  height: 14px;
  background: #2c1f3e;
  border-radius: 50% 50% 40% 40%;
  overflow: hidden;
  animation: chibiBlink 4s ease-in-out infinite;
  transform-origin: center;
}
.eye-l { left: 9px; }
.eye-r { right: 9px; animation-delay: 0.1s; }
.chibi-pupil {
  position: absolute;
  bottom: 2px;
  left: 3px;
  width: 7px;
  height: 7px;
  background: #7e5bef;
  border-radius: 50%;
}
.chibi-shine {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
}

/* Blush */
.chibi-blush {
  position: absolute;
  top: 33px;
  width: 11px;
  height: 6px;
  background: #ffaabb;
  border-radius: 50%;
  opacity: 0.7;
}
.blush-l { left: 4px; }
.blush-r { right: 4px; }

/* Mouth */
.chibi-mouth {
  position: absolute;
  top: 40px;
  left: 50%;
  translate: -50% 0;
  width: 10px;
  height: 5px;
  border-bottom: 2px solid #c8845a;
  border-radius: 0 0 50% 50%;
}

/* ---- HAIR FRONT ---- */
.chibi-hair-front {
  position: absolute;
  top: -2px;
  left: -3px;
  right: -3px;
  display: flex;
  justify-content: space-between;
  z-index: 4;
}
.chibi-bang {
  background: #7e5bef;
  border: 1.5px solid #5b3dbf;
}
.bang-c {
  width: 22px;
  height: 20px;
  border-radius: 0 0 12px 12px;
  margin: 0 auto;
  position: absolute;
  left: 50%;
  translate: -50% 0;
}
.bang-l {
  width: 14px;
  height: 22px;
  border-radius: 0 0 10px 10px;
  transform: rotate(-10deg);
  transform-origin: top right;
}
.bang-r {
  width: 14px;
  height: 22px;
  border-radius: 0 0 10px 10px;
  transform: rotate(10deg);
  transform-origin: top left;
}

/* ---- BOW ---- */
.chibi-bow {
  position: absolute;
  top: -10px;
  right: -4px;
  display: flex;
  align-items: center;
  gap: 1px;
  z-index: 5;
  animation: chibiBowBob 2.4s ease-in-out infinite;
  transform-origin: center bottom;
}
.bow-l, .bow-r {
  width: 12px;
  height: 9px;
  background: #ff6b9d;
  border: 1.5px solid #cc3370;
  border-radius: 50%;
}
.bow-l { transform: rotate(-30deg); }
.bow-r { transform: rotate(30deg); }
.bow-knot {
  width: 7px;
  height: 7px;
  background: #ff6b9d;
  border: 1.5px solid #cc3370;
  border-radius: 50%;
  z-index: 1;
}

/* ---- TORSO ---- */
.chibi-torso {
  position: relative;
  width: 52px;
  height: 38px;
  background: #7e5bef;
  border: 2px solid #5b3dbf;
  border-radius: 8px 8px 4px 4px;
  z-index: 2;
  margin-top: -2px;
  flex-shrink: 0;
  animation: chibiBreath 2.4s ease-in-out infinite;
  transform-origin: center top;
}

/* Collar */
.chibi-collar {
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% 0;
  width: 18px;
  height: 10px;
  background: white;
  border-radius: 0 0 8px 8px;
  border: 1.5px solid #ddd;
  border-top: none;
}

/* Arms */
.chibi-arm {
  position: absolute;
  top: 4px;
  width: 11px;
  height: 26px;
  background: #7e5bef;
  border: 2px solid #5b3dbf;
  border-radius: 6px;
}
.arm-l {
  left: -12px;
  transform-origin: top center;
  animation: chibiArmSwingL 2.4s ease-in-out infinite;
}
.arm-r {
  right: -12px;
  transform-origin: top center;
  animation: chibiArmSwingR 2.4s ease-in-out infinite;
}

/* Skin on arms */
.chibi-arm::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  translate: -50% 0;
  width: 9px;
  height: 9px;
  background: #fddcb5;
  border-radius: 50%;
  border: 1.5px solid #c8845a;
}

/* Skirt */
.chibi-skirt {
  position: absolute;
  bottom: -14px;
  left: -6px;
  right: -6px;
  height: 18px;
  background: #ff6b9d;
  border: 2px solid #cc3370;
  border-radius: 4px 4px 10px 10px;
}

/* ---- LEGS ---- */
.chibi-legs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  z-index: 2;
  flex-shrink: 0;
}
.chibi-leg {
  width: 13px;
  height: 20px;
  background: #fddcb5;
  border: 2px solid #c8845a;
  border-radius: 4px 4px 0 0;
  position: relative;
}
.leg-l { animation: chibiLegBounce 2.4s ease-in-out infinite; }
.leg-r { animation: chibiLegBounce 2.4s ease-in-out infinite 0.12s; }

/* Shoes */
.chibi-shoe {
  position: absolute;
  bottom: -7px;
  left: -2px;
  width: 17px;
  height: 8px;
  background: #2c1f3e;
  border-radius: 4px 6px 4px 4px;
  border: 1.5px solid #111;
}

/* ---- TAIL ---- */
.chibi-tail {
  position: absolute;
  bottom: 30px;
  right: 8px;
  width: 10px;
  height: 38px;
  background: #7e5bef;
  border: 2px solid #5b3dbf;
  border-radius: 0 10px 10px 0;
  transform-origin: top center;
  animation: chibiTailWag 1.4s ease-in-out infinite;
}
.chibi-tail::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: -2px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  border: 2px solid #5b3dbf;
}

@media (max-width: 780px) {
  .mascot-container { display: none !important; }
}


/* Notice/Banners */
.banner {
  background: var(--tint);
  border: 2px solid var(--accent);
  color: var(--accent);
  border-radius: 14px;
  padding: .65rem 1rem;
  font-weight: 700;
  font-size: .92em;
  text-align: center;
  margin-bottom: 1.5rem;
}

.error-banner {
  background: var(--tint);
  border: 2px solid var(--err);
  color: var(--err);
  border-radius: 14px;
  padding: .65rem 1rem;
  font-weight: 700;
  font-size: .92em;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--muted);
  font-weight: 600;
}

/* Footer */
footer {
  max-width: 1000px;
  margin: clamp(2.4rem, 8vh, 3.8rem) auto 0;
  padding: 1.4rem 1.2rem 3.2rem;
  border-top: 2px dashed var(--line);
  text-align: center;
  font-size: .92em;
  position: relative;
  z-index: 1;
}

.fnav a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
  margin: 0 .55rem;
  white-space: nowrap;
}

.fnav a:hover {
  text-decoration: underline wavy;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.sig {
  color: var(--muted);
  font-size: .8em;
  font-weight: 600;
  margin-top: 1.1rem;
  opacity: .85;
}

.footer-stats {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.84em;
  font-weight: 600;
}

.onion-tag {
  color: var(--teal);
  font-weight: 800;
}

.onion-addr {
  font-family: var(--mono);
  word-break: break-all;
}

/* Loading animations */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0,0,0,0.1);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  width: 100%;
}

/* Shelves and Carousel styling */
.shelf-container {
  display: flex;
  overflow-x: auto;
  gap: 1.2rem;
  padding-bottom: 0.5rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;  /* Firefox */
  -ms-overflow-style: none;  /* IE/Edge */
}

.shelf-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

.shelf-container .anime-card {
  flex: 0 0 160px;
  scroll-snap-align: start;
}

/* Category Browser Navigation Tabs */
.tab-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--line);
  padding-bottom: 0.2rem;
}

.tab-btn {
  border: 0;
  background: none;
  font: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--ink);
  background: var(--line);
}

.tab-btn.active {
  color: var(--accent);
  text-decoration: underline wavy;
  text-decoration-thickness: 2.5px;
  text-underline-offset: 6px;
  font-weight: 900;
}

/* Filters & Tags Explorer layout */
.filter-card {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-bottom: 2.5rem;
}

.filter-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-section-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-tag-btn {
  border: 2px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.filter-tag-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-tag-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--ink);
  box-shadow: 2px 2px 0 var(--shadow);
}


/* Mascot Keyframe Animations */
@keyframes mascotBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-30px); }
}
.mascot-bounce { animation: mascotBounce 0.8s ease; }

@keyframes mascotFlip {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.mascot-flip { animation: mascotFlip 0.8s ease; }

@keyframes mascotPeek {
  0%, 100% { transform: translateY(0); }
  30%, 70% { transform: translateY(100px); }
}
.mascot-peek { animation: mascotPeek 1.5s ease; }

@keyframes mascotWiggle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-15px); }
  75% { transform: translateX(15px); }
}
.mascot-wiggle { animation: mascotWiggle 0.6s ease; }

@keyframes mascotPop {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(0.8, 1.2); }
  60% { transform: scale(1.2, 0.8); }
}
.mascot-pop { animation: mascotPop 0.6s ease; }

@keyframes mascotTilt {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-15deg); }
  75% { transform: rotate(15deg); }
}
.mascot-tilt { animation: mascotTilt 0.8s ease; }

@keyframes mascotWave {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  20% { transform: translateY(-20px) rotate(-10deg); }
  40% { transform: translateY(-20px) rotate(10deg); }
  60% { transform: translateY(-20px) rotate(-10deg); }
  80% { transform: translateY(-20px) rotate(10deg); }
}
.mascot-wave { animation: mascotWave 1.2s ease; }

@keyframes mascotSlide {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-80px); }
}
.mascot-slide { animation: mascotSlide 1.2s ease; }

@keyframes mascotFade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.mascot-fade { animation: mascotFade 1s ease; }

@keyframes mascotStretch {
  0%, 100% { transform: scaleX(1) scaleY(1); }
  50% { transform: scaleX(1.3) scaleY(0.7); }
}
.mascot-stretch { animation: mascotStretch 0.8s ease; }

@keyframes mascotDizzy {
  0%, 100% { transform: rotate(0deg); }
  20%, 60% { transform: rotate(-30deg) scale(1.1); }
  40%, 80% { transform: rotate(30deg) scale(1.1); }
}
.mascot-dizzy { animation: mascotDizzy 1.2s ease; }

@keyframes mascotDoubleJump {
  0%, 50%, 100% { transform: translateY(0); }
  25% { transform: translateY(-25px); }
  75% { transform: translateY(-40px); }
}
.mascot-doublejump { animation: mascotDoubleJump 1.2s ease; }

@keyframes mascotHide {
  0%, 100% { transform: translateY(0); }
  15%, 85% { transform: translateY(120px); }
}
.mascot-hide { animation: mascotHide 2.0s ease; }

@keyframes mascotGlance {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(-8deg); }
}
.mascot-glance { animation: mascotGlance 0.8s ease; }

@keyframes mascotSlideUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-80px); }
}
.mascot-slideup { animation: mascotSlideUp 1.2s ease; }

@keyframes mascotWobbleBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-20px) scaleX(0.9) scaleY(1.1); }
  50% { transform: translateY(0) scaleX(1.2) scaleY(0.8); }
  70% { transform: translateY(-10px) scaleX(0.95) scaleY(1.05); }
}
.mascot-wobblebounce { animation: mascotWobbleBounce 1.4s ease; }

@keyframes mascotRoll {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  50% { transform: translateX(-60px) rotate(15deg); }
}
.mascot-roll { animation: mascotRoll 1s ease; }

@keyframes mascotGiggle {
  0%, 100% { transform: translateY(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateY(-5px); }
  20%, 40%, 60%, 80% { transform: translateY(5px); }
}
.mascot-giggle { animation: mascotGiggle 0.8s ease; }

@keyframes mascotSwivel {
  0%, 100% { transform-origin: bottom right; transform: rotate(0deg); }
  25% { transform-origin: bottom right; transform: rotate(-10deg); }
  75% { transform-origin: bottom right; transform: rotate(10deg); }
}
.mascot-swivel { animation: mascotSwivel 1s ease; }

@keyframes mascotNod {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  40% { transform: translateY(10px) rotate(5deg); }
  80% { transform: translateY(0) rotate(-2deg); }
}
.mascot-nod { animation: mascotNod 1s ease; }


/* Live2D Overrides to disable Chinese text bubbles */
#waifu-tips {
  display: none !important;
}
#waifu {
  z-index: 999;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ============================================
   MOBILE SPECIFIC LAYOUT OPTIMIZATIONS
   ============================================ */

body {
  padding-bottom: 75px !important;
  font-size: 14.5px !important;
}

.shell {
  padding: 0.5rem !important;
  max-width: 100% !important;
}

header {
  padding: 0.6rem 0.4rem !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 0.4rem !important;
  margin-bottom: 1rem !important;
}

.brand-container {
  gap: 0.4rem !important;
}

.logo-text {
  font-size: 1.25rem !important;
}

.search-bar {
  flex-grow: 1 !important;
  max-width: 160px !important;
  margin: 0 !important;
}

.search-bar input {
  padding: 0.35rem 0.6rem !important;
  font-size: 0.82rem !important;
  height: auto !important;
}

.tab-row {
  gap: 0.5rem !important;
  margin-bottom: 1.2rem !important;
}

.tab-btn {
  font-size: 0.95rem !important;
  padding: 0.35rem 0.55rem !important;
}

/* Horizontal scrolling filter pills for mobile */
.filter-tags-grid {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  gap: 0.4rem !important;
  padding-bottom: 0.4rem !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  -webkit-overflow-scrolling: touch;
}

.filter-tags-grid::-webkit-scrollbar {
  display: none !important;
}

.filter-tag-btn {
  flex-shrink: 0 !important;
  padding: 0.25rem 0.55rem !important;
  font-size: 0.8rem !important;
}

.filter-card {
  gap: 0.8rem !important;
  margin-bottom: 1.5rem !important;
}

/* Anime Card Mobile resizing (3 Columns, Small Sized) */
.anime-grid {
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 0.45rem !important;
}

.anime-card-cover {
  height: 120px !important;
  border-radius: 8px !important;
}

.anime-card-title {
  font-size: 0.72rem !important;
  line-height: 1.25 !important;
  margin-top: 0.3rem !important;
  height: 2.1rem !important;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Mobile-First watch layout */
.watch-container {
  grid-template-columns: 1fr !important;
  gap: 1rem !important;
}

.player-wrapper {
  aspect-ratio: 16 / 9 !important;
  height: auto !important;
  padding-top: 0 !important;
}

.player-iframe {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
}

.details-header {
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  gap: 1rem !important;
}

.details-poster {
  width: 120px !important;
  height: 175px !important;
}

.details-meta {
  width: 100% !important;
}

.badge-row {
  justify-content: center !important;
  flex-wrap: wrap !important;
  gap: 0.4rem !important;
}

.meta-badge {
  font-size: 0.75rem !important;
  padding: 0.15rem 0.4rem !important;
}

.episodes-panel {
  padding: 0.75rem !important;
}

.ep-grid {
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 0.4rem !important;
}

.ep-btn {
  aspect-ratio: 1 / 1 !important;
  height: auto !important;
  padding: 0.4rem !important;
  font-size: 0.85rem !important;
}

/* Bottom Navigation Bar Styles */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--card);
  border-top: 2.5px solid var(--ink);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 10000;
  box-shadow: 0 -3px 8px rgba(0, 0, 0, 0.08);
}

.nav-item {
  background: none;
  border: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body, 'Nunito', sans-serif);
  font-size: 0.7rem;
  font-weight: 800;
  gap: 3px;
  cursor: pointer;
  width: 100%;
  height: 100%;
  transition: color 0.15s ease;
  text-decoration: none;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item svg {
  transition: transform 0.15s ease;
}

.nav-item.active svg {
  transform: scale(1.1);
  stroke: var(--accent);
}

/* Hide desktop elements */
.sticker-card, #waifu {
  display: none !important;
}
