/* =========================================================
   SakanaaNime Tracker — Stylesheet
   Theme: clean, elegant, light. Mono palette + subtle accents.
   ========================================================= */

:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-elev: #ffffff;
  --line: #ececec;
  --line-strong: #d8d8d8;
  --text: #0e0e0f;
  --text-mute: #6b6b71;
  --text-faint: #9a9aa1;
  --accent: #0e0e0f;
  --accent-soft: #f3f3f4;
  --ok: #1f8a4a;
  --warn: #b86a00;
  --bad: #c4302b;
  --ring: 0 0 0 3px rgba(0,0,0,.08);
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15,15,17,.04), 0 1px 1px rgba(15,15,17,.03);
  --shadow-md: 0 8px 24px rgba(15,15,17,.06), 0 2px 6px rgba(15,15,17,.04);
  --shadow-lg: 0 24px 48px rgba(15,15,17,.10), 0 4px 14px rgba(15,15,17,.05);
  --t-fast: 160ms cubic-bezier(.4,.0,.2,1);
  --t: 260ms cubic-bezier(.4,.0,.2,1);
  --t-slow: 480ms cubic-bezier(.4,.0,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: 'Josefin Sans', system-ui, sans-serif;
  font-weight: 400;
  font-feature-settings: "ss01", "ss02";
  letter-spacing: .005em;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; height: auto; display: block; }
em { font-style: normal; font-weight: 600; border-bottom: 2px solid var(--text); padding-bottom: 1px; }

/* ============ Header ============ */
.site-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 600; letter-spacing: .04em; font-size: 18px; }
.brand-tag {
  font-size: 11px; letter-spacing: .35em; text-transform: uppercase;
  color: var(--text-mute);
}
.site-nav { display: flex; gap: 22px; }
.nav-link {
  color: var(--text-mute); font-size: 14px; letter-spacing: .04em;
  transition: color var(--t-fast);
}
.nav-link:hover { color: var(--text); }
@media (max-width: 640px) { .site-nav { display: none; } }

/* ============ Layout ============ */
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 32px 22px 64px; flex: 1; }

.hero {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  margin: 24px auto 28px;
}
.hero-title {
  font-weight: 300; font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -.005em; line-height: 1.15;
  max-width: 720px; margin: 8px 0 12px;
}
.hero-sub {
  color: var(--text-mute); max-width: 580px; font-size: 16px;
  margin: 0 0 28px;
}

/* ============ Dropzone ============ */
.dropzone {
  position: relative;
  width: 100%; max-width: 720px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  padding: 40px 28px;
  cursor: pointer;
  transition: border-color var(--t), background var(--t), transform var(--t);
  outline: none;
}
.dropzone:hover { border-color: var(--text); background: var(--bg-soft); }
.dropzone:focus-visible { box-shadow: var(--ring); }
.dropzone.drag-over {
  border-color: var(--text); background: var(--bg-soft);
  transform: scale(1.005);
}

.drop-content { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.drop-illustration {
  width: 62px; height: 62px; display: grid; place-items: center;
  border-radius: 18px; border: 1px solid var(--line); background: var(--bg-soft);
  margin-bottom: 8px;
}
.drop-illustration svg { width: 28px; height: 28px; stroke-width: 1.5; color: var(--text); }
.drop-title { font-size: 18px; margin: 4px 0 0; font-weight: 500; }
.drop-sub { font-size: 13px; color: var(--text-mute); margin: 0; letter-spacing: .03em; }
.drop-or {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 280px;
  color: var(--text-faint); font-size: 12px; letter-spacing: .25em; text-transform: uppercase;
  margin: 12px 0 4px;
}
.drop-or::before, .drop-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.drop-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.url-row { display: flex; gap: 8px; width: 100%; max-width: 480px; margin-top: 16px; }
.url-row input {
  flex: 1;
  font-family: inherit; font-size: 14px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg);
  color: var(--text); outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.url-row input:focus { border-color: var(--text); box-shadow: var(--ring); }

/* preview */
.drop-preview { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.drop-preview img {
  max-height: 320px; border-radius: 14px; box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
}
.preview-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  letter-spacing: .03em;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; stroke-width: 1.8; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #222; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.legal {
  font-size: 12px; color: var(--text-faint); margin-top: 18px; letter-spacing: .04em;
}

/* ============ Workflow board ============ */
.workflow { margin: 36px auto 24px; max-width: 980px; }
.workflow-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.workflow-head h2 { font-weight: 500; font-size: 18px; letter-spacing: .02em; margin: 0; }

.board {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 28px 36px;
  min-height: 140px;
  overflow: hidden;
}
.wires {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
.wires path {
  fill: none; stroke: var(--line-strong); stroke-width: 1.6;
  stroke-dasharray: 4 5;
  opacity: 0;
  stroke-dashoffset: 200;
  transition: opacity var(--t), stroke var(--t);
}
.wires path.show {
  opacity: 1;
  animation: dash 1.6s linear infinite, fade-in .5s ease both;
}
.wires path.done {
  animation: none;
  stroke: var(--text);
  opacity: 1;
  stroke-dasharray: 0;
  stroke-dashoffset: 0;
}
.wires path.skip { stroke: var(--line); stroke-dasharray: 2 6; opacity: .8; animation: none; }
.wires path.fail { stroke: var(--bad); opacity: .7; animation: none; stroke-dasharray: 3 4; }

@keyframes dash {
  to { stroke-dashoffset: 0; }
}
@keyframes fade-in {
  from { opacity: 0; } to { opacity: 1; }
}

/* nodes */
.node {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 14px 12px;
  min-height: 92px;
  opacity: .55;
  transition: opacity var(--t), border-color var(--t), transform var(--t), box-shadow var(--t);
  z-index: 1;
}
.node.active {
  opacity: 1; border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text) inset, var(--shadow-sm);
  transform: translateY(-1px);
}
.node.ok { opacity: 1; border-color: var(--text); box-shadow: var(--shadow-sm); }
.node.skip { opacity: .45; }
.node.fail { opacity: .9; border-color: var(--bad); }
.node-head {
  display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px;
  letter-spacing: .04em;
}
.node-head svg { width: 16px; height: 16px; stroke-width: 1.8; flex-shrink: 0; }
.node-body { color: var(--text-mute); font-size: 12.5px; margin-top: 6px; min-height: 18px; }

.status {
  margin-left: auto; width: 10px; height: 10px; border-radius: 50%;
  background: #ddd; box-shadow: 0 0 0 0 rgba(0,0,0,0);
  transition: background var(--t), box-shadow var(--t);
}
.status[data-status="working"] {
  background: var(--text);
  animation: pulse 1.1s ease-in-out infinite;
}
.status[data-status="ok"]   { background: var(--ok); }
.status[data-status="skip"] { background: var(--text-faint); }
.status[data-status="fail"] { background: var(--bad); }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(14,14,15,.25); }
  50%     { box-shadow: 0 0 0 6px rgba(14,14,15,0); }
}

/* log */
.log {
  list-style: none; padding: 0; margin: 16px 0 0;
  font-size: 12.5px; color: var(--text-mute);
  display: grid; gap: 6px;
  max-height: 160px; overflow-y: auto;
}
.log li {
  display: flex; gap: 10px; align-items: baseline;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  letter-spacing: .015em;
  animation: slide-in .25s ease both;
}
.log li .lk { font-weight: 600; color: var(--text); min-width: 64px; }
.log li .ls { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-faint); }
@keyframes slide-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* responsive board: stack on small screens */
@media (max-width: 760px) {
  .board {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 20px;
  }
  .wires { display: none; }
  .node { min-height: 0; }
  .node-body { margin-top: 4px; }
}

/* ============ Result ============ */
.result { margin: 28px auto 0; max-width: 980px; }

.result-card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  animation: rise .55s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.result-banner {
  height: 220px;
  background: var(--bg-soft) center/cover no-repeat;
  position: relative;
}
.result-banner::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 30%, rgba(255,255,255,.9) 100%);
}

.result-head {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 22px;
  padding: 0 28px 24px;
  margin-top: -90px;
  position: relative; z-index: 1;
}
.result-cover {
  width: 180px; aspect-ratio: 2/3;
  border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.result-cover img { width: 100%; height: 100%; object-fit: cover; }
.result-meta { padding-top: 96px; }
.result-title-en { font-size: 13px; color: var(--text-mute); letter-spacing: .06em; text-transform: uppercase; }
.result-title { font-size: 28px; font-weight: 500; line-height: 1.15; margin: 4px 0 6px; letter-spacing: -.005em; }
.result-title-native { color: var(--text-mute); font-weight: 300; font-size: 18px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--text-mute);
  background: var(--bg);
}
.tag.solid { background: var(--text); color: #fff; border-color: var(--text); }

.stat-row { display: flex; flex-wrap: wrap; gap: 18px; margin: 14px 0 4px; }
.stat { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); }
.stat svg { width: 16px; height: 16px; stroke-width: 1.6; color: var(--text-mute); }
.stat .num { font-weight: 600; }

.result-body {
  padding: 0 28px 28px;
  display: grid; gap: 28px;
}
.section h3 {
  font-size: 12px; letter-spacing: .25em; text-transform: uppercase;
  color: var(--text-mute); margin: 0 0 12px; font-weight: 600;
}

.description { font-size: 15px; line-height: 1.7; color: var(--text); }
.description.collapsed { max-height: 8em; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%); mask-image: linear-gradient(to bottom, #000 70%, transparent 100%); }
.desc-toggle { background: transparent; border: 0; color: var(--text-mute); cursor: pointer; font-family: inherit; padding: 4px 0; letter-spacing: .06em; text-transform: uppercase; font-size: 11px; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 24px;
}
.info-grid .kv { font-size: 14px; }
.info-grid .k { color: var(--text-mute); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.info-grid .v { color: var(--text); margin-top: 2px; }

/* characters / cast */
.cast {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.cast-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px;
  transition: border-color var(--t), transform var(--t);
}
.cast-card:hover { border-color: var(--text); transform: translateY(-1px); }
.cast-img {
  width: 56px; height: 56px; flex-shrink: 0;
  border-radius: 10px; object-fit: cover;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.cast-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cast-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.cast-role { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-mute); }
.cast-va {
  display: flex; gap: 8px; align-items: center;
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line);
}
.cast-va img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); }
.cast-va-name { font-size: 12px; color: var(--text); }
.cast-va-lang { font-size: 10px; color: var(--text-faint); letter-spacing: .08em; }

/* media tiles */
.tile-row {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.tile {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--bg); display: flex; flex-direction: column;
  transition: border-color var(--t), transform var(--t);
}
.tile:hover { border-color: var(--text); transform: translateY(-2px); }
.tile-img { aspect-ratio: 2/3; background: var(--bg-soft) center/cover no-repeat; }
.tile-meta { padding: 8px 10px 10px; }
.tile-name { font-size: 13px; line-height: 1.3; font-weight: 500; }
.tile-sub { font-size: 11px; color: var(--text-mute); letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; }

/* external links */
.links {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.linkchip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg); color: var(--text);
  font-size: 13px; letter-spacing: .02em;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.linkchip:hover { border-color: var(--text); background: var(--bg-soft); }
.linkchip img { width: 16px; height: 16px; object-fit: contain; border-radius: 3px; }
.linkchip .type { color: var(--text-faint); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

/* trailer */
.trailer {
  position: relative;
  width: 100%; aspect-ratio: 16/9;
  border-radius: 12px; overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
}
.trailer iframe { width: 100%; height: 100%; border: 0; display: block; }
.trailer-cover {
  position: absolute; inset: 0; cursor: pointer;
  background-size: cover; background-position: center;
}
.trailer-cover::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(0,0,0,.3), rgba(0,0,0,.55));
}
.trailer-cover svg {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 56px; height: 56px; color: #fff;
}

/* trace.moe preview block */
.trace-preview {
  display: flex; gap: 14px; align-items: center;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; background: var(--bg);
}
.trace-preview video, .trace-preview img {
  width: 220px; aspect-ratio: 16/9; object-fit: cover;
  border-radius: 8px; background: #000;
}
.trace-preview .meta { font-size: 13px; color: var(--text-mute); }
.trace-preview .meta strong { color: var(--text); }

@media (max-width: 760px) {
  .result-head { grid-template-columns: 120px 1fr; gap: 14px; padding: 0 16px 16px; margin-top: -60px; }
  .result-cover { width: 120px; }
  .result-meta { padding-top: 56px; }
  .result-title { font-size: 22px; }
  .result-banner { height: 160px; }
  .result-body { padding: 0 16px 22px; }
  .trace-preview { flex-direction: column; align-items: stretch; }
  .trace-preview video, .trace-preview img { width: 100%; }
}

/* ============ How it works ============ */
.how { margin: 60px auto 24px; max-width: 720px; }
.how h2 { font-weight: 500; font-size: 18px; letter-spacing: .02em; margin: 0 0 12px; }
.steps { color: var(--text-mute); padding-left: 20px; line-height: 1.8; font-size: 15px; }
.steps strong { color: var(--text); font-weight: 600; }

/* ============ Footer ============ */
.site-footer {
  display: flex; justify-content: center; gap: 10px;
  padding: 24px; border-top: 1px solid var(--line);
  color: var(--text-faint); font-size: 12px; letter-spacing: .08em;
  margin-top: auto;
}
.dot { opacity: .5; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(10px);
  background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: 999px;
  font-size: 13px; letter-spacing: .02em;
  box-shadow: var(--shadow-lg);
  opacity: 0; transition: opacity var(--t), transform var(--t);
  z-index: 50;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Small utilities ============ */
.muted { color: var(--text-mute); }
.center { text-align: center; }
hr.sep { border: 0; height: 1px; background: var(--line); margin: 16px 0; }

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
