:root {
  color-scheme: dark;
  --page: #080b12; --page-raised: #0c1019; --surface: #111621; --surface-hover: #161d2a;
  --border: #242c3a; --border-soft: rgba(147, 161, 184, 0.13); --text: #edf0f5;
  --muted: #a4adbb; --subtle: #717c8e; --accent: #8297f7; --danger: #ffb8bd;
  --content: 1180px; --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; scroll-padding-top: 100px; }
body {
  min-width: 320px; min-height: 100%; margin: 0; overflow-x: hidden;
  background: radial-gradient(circle at 50% 13%, rgba(71, 85, 157, 0.11), transparent 34rem), var(--page);
  color: var(--text); font-family: Inter, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  font-feature-settings: "palt" 1; line-height: 1.7; -webkit-font-smoothing: antialiased;
}
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 100; padding: 8px 14px; border-radius: 8px; background: var(--text); color: var(--page); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.intro-screen { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: #080b12; pointer-events: none; animation: intro-screen 2.05s var(--ease) forwards; }
.intro-logo { color: #f1f3f7; font-size: clamp(2rem, 4vw, 3.15rem); font-weight: 620; letter-spacing: -0.045em; opacity: 0; transform: scale(0.96); animation: intro-logo 1.45s var(--ease) 120ms both; }
.site-header, main, .site-footer { animation: page-enter 850ms var(--ease) 1.3s backwards; }
.site-header, .site-footer, .search-area, .recommendations { width: min(calc(100% - 64px), var(--content)); margin-inline: auto; }
.site-header { position: relative; z-index: 10; display: flex; align-items: center; min-height: 84px; }
.brand { color: #e8ebf2; font-size: 1.28rem; font-weight: 650; letter-spacing: -0.045em; transition: color 180ms ease, opacity 180ms ease; }
.brand:hover { color: #fff; }

.search-hero { position: relative; display: flex; min-height: calc(100svh - 84px); padding: clamp(68px, 11vh, 120px) max(32px, calc((100vw - var(--content)) / 2)) 60px; overflow: hidden; flex-direction: column; align-items: center; text-align: center; isolation: isolate; }
.scene-stream { position: absolute; top: clamp(150px, 22vh, 230px); right: 0; left: 0; z-index: -1; height: 360px; overflow: hidden; opacity: 0.42; filter: saturate(0.7) contrast(0.92); mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 76%, transparent); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 76%, transparent); }
.scene-stream::after { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8, 11, 18, 0.82), transparent 18%, transparent 82%, rgba(8, 11, 18, 0.82)), linear-gradient(rgba(8, 11, 18, 0.08), rgba(8, 11, 18, 0.34)); content: ""; }
.scene-track { display: flex; width: max-content; height: 100%; animation: scene-drift 42s linear infinite; will-change: transform; }
.scene-frame { display: block; width: max(1200px, 100vw); height: 100%; flex: 0 0 auto; background: url("/static/images/anime-scene-stream.png") center / cover no-repeat; }
.hero-copy, .search-form, .examples { position: relative; z-index: 1; }
.hero-copy { max-width: 760px; text-shadow: 0 2px 28px rgba(0, 0, 0, 0.75); }
h1, h2, p { text-wrap: pretty; }
h1 { margin: 0; font-size: clamp(2.8rem, 6.8vw, 5.5rem); font-weight: 580; letter-spacing: -0.065em; line-height: 1.12; }
.tagline { margin: 20px 0 0; color: #8f98a7; font-size: clamp(0.9rem, 1.4vw, 1rem); line-height: 1.8; }
.search-form { width: min(100%, 800px); margin-top: 44px; }
.search-field { position: relative; display: flex; min-height: 78px; align-items: flex-end; gap: 14px; padding: 17px 17px 17px 24px; border: 1px solid #30394b; border-radius: 25px; background: rgba(18, 23, 34, 0.94); box-shadow: 0 18px 70px rgba(0, 0, 0, 0.4), inset 0 1px rgba(255, 255, 255, 0.035); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); text-align: left; transition: border-color 360ms ease, box-shadow 500ms var(--ease), transform 500ms var(--ease), background 300ms ease; }
.search-field:focus-within { border-color: rgba(130, 151, 247, 0.7); background: #121824; box-shadow: 0 24px 90px rgba(0, 0, 0, 0.32), 0 0 0 4px rgba(130, 151, 247, 0.08), 0 0 34px rgba(103, 119, 211, 0.12); transform: scale(1.008); }
.search-field textarea { width: 100%; min-height: 42px; max-height: 148px; flex: 1 1 auto; resize: none; overflow-y: auto; border: 0; outline: 0; background: transparent; color: var(--text); font-size: clamp(0.98rem, 1.8vw, 1.08rem); line-height: 1.65; scrollbar-width: thin; }
.search-field textarea::placeholder { color: #6f798a; opacity: 1; }
.search-button { display: flex; width: 38px; min-width: 38px; height: 38px; margin-bottom: 2px; flex: 0 0 auto; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: #e9ebf2; color: #10131a; font-size: 0.98rem; font-weight: 760; transition: background 180ms ease, transform 220ms var(--ease), box-shadow 220ms ease; }
.search-button:hover:not(:disabled) { background: #f4f5ff; box-shadow: 0 8px 24px rgba(130, 151, 247, 0.2); transform: translateY(-2px); }
.search-button:active:not(:disabled) { transform: scale(0.96); }
.button-arrow { line-height: 1; transform: translateY(-1px); transition: transform 220ms var(--ease); }
.search-button:hover .button-arrow { transform: translateY(-3px); }
.button-loader { display: none; width: 16px; height: 16px; border: 2px solid rgba(16, 21, 34, 0.25); border-top-color: #101522; border-radius: 50%; animation: spin 700ms linear infinite; }
.search-button.is-loading { cursor: wait; }
.search-button.is-loading .button-arrow { display: none; }
.search-button.is-loading .button-loader { display: block; }
.examples { width: min(100%, 800px); margin-top: 22px; }
.chip-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.query-chip { border: 1px solid #252d3b; border-radius: 999px; background: rgba(16, 21, 31, 0.62); color: #98a2b2; padding: 7px 13px; font-size: 0.76rem; line-height: 1.4; transition: border-color 200ms ease, background 200ms ease, color 200ms ease, transform 220ms var(--ease); }
.query-chip:hover { border-color: #3b465b; background: var(--surface-hover); color: var(--text); transform: translateY(-2px); }

.search-area, .recommendations { padding: clamp(90px, 12vw, 150px) 0; }
.search-area[hidden] { display: none; }
.search-area { border-top: 1px solid var(--border-soft); scroll-margin-top: 30px; }
.section-heading { display: flex; margin-bottom: 36px; align-items: flex-end; justify-content: space-between; gap: 30px; }
.section-heading h2 { margin: 0; font-size: clamp(1.65rem, 3.5vw, 2.45rem); font-weight: 560; letter-spacing: -0.045em; line-height: 1.25; }
.section-heading > p, .result-summary { margin: 0; color: var(--subtle); font-size: 0.8rem; }
.status { display: flex; min-height: 76px; align-items: center; color: var(--muted); font-size: 0.86rem; }
.status:empty { display: none; }
.status.error { color: var(--danger); }
.loading-track { position: relative; width: 36px; height: 2px; margin-right: 14px; overflow: hidden; border-radius: 2px; background: #242c39; }
.loading-track::after { position: absolute; inset: 0; background: var(--accent); content: ""; transform: translateX(-100%); animation: loading-track 1.25s var(--ease) infinite; }
.results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.result-card { display: grid; min-height: 190px; grid-template-columns: 92px 1fr; gap: 22px; padding: 22px; overflow: hidden; border: 1px solid var(--border-soft); border-radius: 18px; background: rgba(16, 21, 31, 0.62); box-shadow: 0 12px 44px rgba(0, 0, 0, 0.08); cursor: pointer; opacity: 1; transform: none; animation: card-in 650ms var(--ease) backwards; transition: border-color 260ms ease, background 260ms ease, box-shadow 350ms ease, transform 350ms var(--ease); }
.result-card:hover { border-color: rgba(130, 151, 247, 0.28); background: rgba(20, 27, 40, 0.9); box-shadow: 0 22px 48px rgba(0, 0, 0, 0.22); transform: translateY(-4px); }
.result-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.result-visual { position: relative; display: grid; min-height: 140px; overflow: hidden; place-items: center; border-radius: 12px; background: radial-gradient(circle at 35% 24%, rgba(148, 166, 255, 0.2), transparent 33%), linear-gradient(145deg, #20283b, #121722 68%); color: rgba(232, 236, 255, 0.55); font-family: Georgia, "Yu Mincho", serif; font-size: 1.8rem; }
.result-visual::after { position: absolute; right: 12px; bottom: 10px; color: rgba(220, 226, 247, 0.24); content: "AN"; font-family: Inter, sans-serif; font-size: 0.54rem; font-weight: 700; letter-spacing: 0.15em; }
.result-copy { min-width: 0; }
.result-rank { display: block; margin-bottom: 10px; color: #7f8baa; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.14em; }
.result-title { margin: 0; color: var(--text); font-size: 1.08rem; font-weight: 620; line-height: 1.45; }
.result-reason { margin: 11px 0 0; display: -webkit-box; overflow: hidden; color: #909aa9; font-size: 0.8rem; line-height: 1.75; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.result-match { display: block; margin-top: 14px; color: #68758a; font-size: 0.65rem; }
.empty-results { grid-column: 1 / -1; margin: 0; padding: 44px; border: 1px solid var(--border-soft); border-radius: 18px; color: var(--muted); text-align: center; }

.recommendations { border-top: 1px solid var(--border-soft); }
.recommendation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.anime-card { min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--border-soft); border-radius: 18px; background: var(--page-raised); color: inherit; text-align: left; box-shadow: 0 16px 45px rgba(0, 0, 0, 0.08); transition: border-color 260ms ease, box-shadow 350ms ease, transform 350ms var(--ease); }
.anime-card:hover { border-color: rgba(130, 151, 247, 0.25); box-shadow: 0 25px 60px rgba(0, 0, 0, 0.28); transform: translateY(-6px); }
.poster { position: relative; display: grid; height: 250px; overflow: hidden; place-items: center; background-color: #141a25; transition: transform 650ms var(--ease), filter 450ms ease; }
.poster::before, .poster::after { position: absolute; content: ""; }
.poster::before { width: 190px; height: 190px; border: 1px solid rgba(226, 231, 255, 0.11); border-radius: 50%; box-shadow: 0 0 60px rgba(130, 151, 247, 0.08); }
.poster::after { inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(4, 7, 12, 0.38)); }
.anime-card:hover .poster { transform: scale(1.025); filter: saturate(1.08); }
.poster-mushi { background: radial-gradient(circle at 62% 32%, rgba(147, 186, 152, 0.21), transparent 31%), linear-gradient(145deg, #1d2a28, #101718); }
.poster-shinsekai { background: radial-gradient(circle at 35% 22%, rgba(198, 135, 116, 0.22), transparent 32%), linear-gradient(150deg, #30252c, #13151e 72%); }
.poster-houseki { background: radial-gradient(circle at 68% 25%, rgba(103, 192, 191, 0.24), transparent 32%), linear-gradient(145deg, #173034, #111723 70%); }
.poster-letter { position: relative; z-index: 1; color: rgba(236, 239, 247, 0.7); font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 3rem; font-weight: 400; }
.poster-fallback { position: absolute; right: 15px; bottom: 12px; z-index: 2; color: rgba(226, 231, 255, 0.3); font-size: 0.52rem; font-weight: 700; letter-spacing: 0.15em; }
.card-body { display: block; padding: 22px 22px 24px; }
.card-meta { display: flex; gap: 8px; color: #6e7a8d; font-size: 0.65rem; }
.card-meta span + span::before { margin-right: 8px; color: #3b4554; content: "/"; }
.card-title { display: block; margin-top: 9px; font-size: 1.08rem; font-weight: 620; }
.card-description { display: block; min-height: 3.4em; margin-top: 8px; color: #8994a5; font-size: 0.78rem; line-height: 1.7; }
.card-action { display: block; max-height: 0; margin-top: 0; overflow: hidden; color: #a8b4f2; font-size: 0.72rem; opacity: 0; transform: translateY(5px); transition: max-height 300ms var(--ease), margin 300ms var(--ease), opacity 300ms ease, transform 300ms var(--ease); }
.anime-card:hover .card-action, .anime-card:focus-visible .card-action { max-height: 30px; margin-top: 15px; opacity: 1; transform: translateY(0); }
.anime-modal { width: min(calc(100% - 40px), 1040px); max-height: 92svh; padding: 0; overflow: hidden auto; border: 1px solid rgba(174, 186, 210, 0.2); border-radius: 26px; background: #0d121b; color: var(--text); box-shadow: 0 36px 120px rgba(0, 0, 0, 0.72); opacity: 0; transform: translateY(24px) scale(0.985); transition: opacity 300ms ease, transform 420ms var(--ease), overlay 420ms allow-discrete, display 420ms allow-discrete; }
.anime-modal[open] { opacity: 1; transform: translateY(0) scale(1); }
.anime-modal::backdrop { background: rgba(2, 4, 8, 0.78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); opacity: 0; transition: opacity 320ms ease, overlay 420ms allow-discrete, display 420ms allow-discrete; }
.anime-modal[open]::backdrop { opacity: 1; }
@starting-style { .anime-modal[open] { opacity: 0; transform: translateY(24px) scale(0.985); } .anime-modal[open]::backdrop { opacity: 0; } }
.modal-hero { position: relative; display: grid; height: 350px; overflow: hidden; place-items: center; background: linear-gradient(180deg, rgba(7, 10, 16, 0.12), #0d121b 100%), url("/static/images/anime-scene-stream.png") center / cover no-repeat; }
.modal-hero::after { position: absolute; inset: 0; background: radial-gradient(circle at center, transparent, rgba(5, 8, 13, 0.35)); content: ""; }
.modal-initial { position: relative; z-index: 1; color: rgba(241, 244, 252, 0.88); font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(3.8rem, 10vw, 6.5rem); font-weight: 400; text-shadow: 0 8px 38px rgba(0, 0, 0, 0.55); }
.modal-close { position: absolute; top: 18px; right: 18px; z-index: 2; display: grid; width: 38px; height: 38px; padding: 0 0 2px; place-items: center; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 50%; background: rgba(5, 8, 13, 0.66); color: #f1f3f7; font-size: 1.25rem; line-height: 1; backdrop-filter: blur(10px); transition: background 180ms ease, transform 180ms ease; }
.modal-close:hover { background: rgba(27, 33, 45, 0.94); transform: scale(1.05); }
.modal-content { padding: 4px clamp(28px, 6vw, 68px) clamp(40px, 7vw, 72px); }
.modal-meta { min-height: 1em; margin: 0 0 9px; color: #8994a8; font-size: 0.72rem; letter-spacing: 0.06em; }
.modal-content h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 600; letter-spacing: -0.045em; line-height: 1.3; }
.modal-synopsis { margin: 22px 0 0; color: #abb3c0; font-size: 0.92rem; line-height: 2; }
.modal-match { margin: 24px 0 0; color: #74819a; font-size: 0.72rem; }
.modal-loading { display: flex; margin-top: 32px; align-items: center; gap: 12px; color: #778397; font-size: 0.76rem; }
.modal-loading[hidden] { display: none; }
.modal-loading span { width: 15px; height: 15px; border: 2px solid #323b4b; border-top-color: #9aa8f4; border-radius: 50%; animation: spin 700ms linear infinite; }
.modal-facts { display: grid; margin: 34px 0 0; padding: 26px 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 28px; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.modal-facts:empty { display: none; }
.modal-fact { min-width: 0; }
.modal-fact dt { margin: 0 0 5px; color: #69768a; font-size: 0.64rem; letter-spacing: 0.06em; }
.modal-fact dd { margin: 0; overflow-wrap: anywhere; color: #d4d8e0; font-size: 0.82rem; line-height: 1.65; }
.modal-sections { display: grid; gap: 30px; margin-top: 36px; }
.modal-sections:empty { display: none; }
.detail-section h3, .modal-editions > h3 { margin: 0 0 12px; color: #eef0f5; font-size: 1rem; font-weight: 600; }
.detail-section p { max-width: 800px; margin: 0; color: #9ba5b5; font-size: 0.84rem; line-height: 1.95; white-space: pre-line; }
.modal-editions { margin-top: 38px; }
.modal-editions:empty { display: none; }
.edition-list { display: grid; gap: 12px; }
.edition-card { padding: 20px 22px; border: 1px solid var(--border-soft); border-radius: 15px; background: rgba(17, 23, 34, 0.7); }
.edition-heading { display: flex; margin-bottom: 15px; align-items: baseline; justify-content: space-between; gap: 18px; }
.edition-heading h4 { margin: 0; font-size: 0.92rem; font-weight: 600; }
.edition-heading span { color: #6f7b8e; font-size: 0.67rem; }
.edition-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.edition-fact { display: grid; grid-template-columns: 92px 1fr; gap: 8px; color: #a2abba; font-size: 0.75rem; line-height: 1.65; }
.edition-fact span:first-child { color: #657185; }
.modal-source { display: inline-flex; margin-top: 36px; align-items: center; gap: 8px; color: #aeb9f2; font-size: 0.78rem; transition: color 180ms ease; }
.modal-source:hover { color: #e2e6ff; }
body.modal-open { overflow: hidden; }
.site-footer { display: flex; min-height: 150px; align-items: center; border-top: 1px solid var(--border-soft); color: #5d6878; font-size: 0.72rem; }
.footer-brand { color: #8892a1; font-size: 0.96rem; }
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 800ms var(--ease), transform 800ms var(--ease); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.search-form.reveal { transition-delay: 80ms; }
.examples.reveal { transition-delay: 150ms; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes intro-logo { 0% { opacity: 0; letter-spacing: 0.02em; transform: scale(0.96); filter: blur(5px); } 55% { opacity: 1; filter: blur(0); } 100% { opacity: 1; letter-spacing: -0.035em; transform: scale(1); } }
@keyframes intro-screen { 0%, 70% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } }
@keyframes page-enter { from { opacity: 0; transform: translateY(8px); } }
@keyframes scene-drift { to { transform: translateX(-50%); } }
@keyframes loading-track { 0% { transform: translateX(-100%); } 55%, 100% { transform: translateX(100%); } }
@keyframes card-in { from { opacity: 0; transform: translateY(18px); } }

@media (max-width: 820px) {
  .site-header, .site-footer, .search-area, .recommendations { width: min(calc(100% - 36px), var(--content)); }
  .search-hero { padding-inline: 18px; }
  .results { grid-template-columns: 1fr; }
  .recommendation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .anime-card:last-child { display: none; }
}
@media (max-width: 560px) {
  body { background: radial-gradient(circle at 50% 12%, rgba(71, 85, 157, 0.1), transparent 25rem), var(--page); }
  .site-header { min-height: 70px; }
  .search-hero { min-height: calc(100svh - 70px); padding-top: clamp(56px, 10vh, 88px); padding-bottom: 36px; }
  h1 { font-size: clamp(2.45rem, 12vw, 3.5rem); letter-spacing: -0.07em; }
  .tagline { margin-top: 19px; font-size: 0.88rem; }
  .search-form { margin-top: 37px; }
  .scene-stream { top: 125px; height: 340px; opacity: 0.36; }
  .scene-frame { width: 1120px; }
  .search-field { min-height: 70px; padding: 15px 15px 15px 18px; border-radius: 21px; }
  .search-field textarea { min-height: 42px; font-size: 0.94rem; }
  .search-button { width: 36px; min-width: 36px; height: 36px; font-size: 0.92rem; }
  .examples { margin-top: 20px; }
  .chip-list { max-height: 75px; overflow: hidden; }
  .query-chip { padding: 7px 12px; }
  .search-area, .recommendations { padding-block: 86px; }
  .section-heading { margin-bottom: 26px; align-items: flex-start; flex-direction: column; gap: 10px; }
  .section-heading > p { display: none; }
  .result-card { min-height: 172px; grid-template-columns: 72px 1fr; gap: 17px; padding: 16px; }
  .result-visual { min-height: 135px; }
  .result-title { font-size: 0.98rem; }
  .result-reason { font-size: 0.75rem; -webkit-line-clamp: 3; }
  .recommendation-grid { grid-template-columns: 1fr; gap: 14px; }
  .anime-card { display: grid; grid-template-columns: 112px 1fr; }
  .anime-card:last-child { display: grid; }
  .poster { height: 100%; min-height: 192px; }
  .poster::before { width: 90px; height: 90px; }
  .poster-letter { font-size: 2rem; }
  .card-body { padding: 19px 17px; align-self: center; }
  .card-description { min-height: 0; }
  .card-action { display: none; }
  .anime-modal { width: calc(100% - 16px); max-height: 92svh; border-radius: 20px; }
  .modal-hero { height: 250px; }
  .modal-close { top: 13px; right: 13px; }
  .modal-content { padding: 0 23px 34px; }
  .modal-synopsis { margin-top: 17px; font-size: 0.86rem; line-height: 1.9; }
  .modal-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
  .edition-facts { grid-template-columns: 1fr; }
  .edition-fact { grid-template-columns: 82px 1fr; }
  .site-footer { min-height: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .intro-screen { display: none; }
  .scene-track { animation: none; transform: translateX(-18%); }
  .reveal, .result-card { opacity: 1; transform: none; }
}
