:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --paper: #fffdfa;
  --ink: #22211f;
  --muted: #6f6a62;
  --line: #ded7cc;
  --coral: #e75f4d;
  --teal: #007c78;
  --gold: #c99a2e;
  --plum: #7b496e;
  --green: #24745c;
  --shadow: 0 14px 40px rgba(42, 35, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.age-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(34, 33, 31, 0.92), rgba(45, 38, 34, 0.78)),
    radial-gradient(circle at 70% 20%, rgba(231, 95, 77, 0.35), transparent 38%);
}

.age-gate.is-hidden {
  display: none;
}

.age-panel {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.age-panel h1,
.app-header h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

.age-panel p {
  margin: 12px 0 0;
  color: var(--muted);
}

.age-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
}

.primary,
.restore-tools button,
.filter-chip,
.mode-tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  min-height: 40px;
  padding: 0 14px;
}

.primary {
  border-color: var(--coral);
  background: var(--coral);
  color: #fff;
  font-weight: 700;
}

.ghost-link {
  color: var(--muted);
  text-decoration: none;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px clamp(16px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 244, 239, 0.92);
  backdrop-filter: blur(16px);
}

.app-header h1 {
  font-size: clamp(24px, 3vw, 34px);
}

.top-nav {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.top-nav a {
  text-decoration: none;
}

main {
  padding: 22px clamp(16px, 4vw, 52px) 60px;
}

.control-band,
.ranking-band {
  max-width: 1240px;
  margin: 0 auto;
}

.control-band {
  display: grid;
  gap: 16px;
}

.diagnosis-head,
.ranking-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.eyebrow,
.small-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font-weight: 700;
}

.mode-tabs,
.ranking-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-tab.is-active,
.filter-chip.is-active {
  border-color: var(--teal);
  background: #e8f4f1;
  color: var(--teal);
  font-weight: 700;
}

.mode-panel {
  display: none;
}

.mode-panel.is-active {
  display: block;
}

.swipe-stage {
  display: grid;
  grid-template-columns: 104px minmax(0, 520px) 104px;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: 10px 0 4px;
}

.swipe-button {
  width: 104px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(42, 35, 29, 0.08);
}

.swipe-button.like {
  border-color: rgba(0, 124, 120, 0.38);
  background: #e8f4f1;
  color: var(--teal);
}

.swipe-button.dislike {
  border-color: rgba(231, 95, 77, 0.38);
  background: #fff0e6;
  color: var(--coral);
}

.swipe-card {
  display: grid;
  grid-template-columns: minmax(120px, 42%) 1fr;
  min-height: 280px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.cover-art {
  position: relative;
  display: grid;
  align-content: end;
  min-height: 100%;
  padding: 14px;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
}

.cover-art::before,
.cover-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
}

.cover-art::before {
  background: var(--cover);
}

.cover-art.real-cover::before {
  background: transparent;
}

.cover-image {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--cover);
}

.cover-art::after {
  background:
    linear-gradient(180deg, transparent 44%, rgba(0, 0, 0, 0.58)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0 2px, transparent 2px 16px);
  mix-blend-mode: soft-light;
}

.cover-art.real-cover::after {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), transparent 38%, rgba(0, 0, 0, 0.72)),
    linear-gradient(135deg, rgba(0, 0, 0, 0.22), transparent 42%);
  mix-blend-mode: normal;
}

.cover-mark {
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  margin-bottom: auto;
  background: rgba(255, 255, 255, 0.18);
}

.real-cover .cover-mark {
  opacity: 0;
}

.cover-title {
  font-weight: 800;
  font-size: clamp(18px, 2.4vw, 26px);
  line-height: 1.16;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.real-cover .cover-title {
  font-size: clamp(14px, 1.6vw, 18px);
}

.cover-type {
  width: fit-content;
  margin-top: 8px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 12px;
  font-weight: 700;
}

.swipe-info,
.item-body {
  padding: 18px;
}

.swipe-info h3,
.item-body h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.creator {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.meta-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f0ece4;
  color: #565047;
  font-size: 12px;
  font-weight: 700;
}

.meta.sale {
  background: #fff0e6;
  color: #bd4d2f;
}

.meta.new {
  background: #eaf4ea;
  color: var(--green);
}

.tag-row {
  margin-top: 12px;
}

.tag {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.cover-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.pick-cover {
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow: hidden;
  text-align: left;
}

.pick-cover .cover-art {
  aspect-ratio: 3 / 4;
  min-height: auto;
}

.pick-cover.is-liked {
  outline: 3px solid rgba(0, 124, 120, 0.32);
}

.tag-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
}

.choice-chip.positive {
  border-color: var(--teal);
  background: #e8f4f1;
  color: var(--teal);
}

.choice-chip.negative {
  border-color: var(--coral);
  background: #fff0e6;
  color: #bd4d2f;
}

.restore-tools {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.72);
}

.restore-tools label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.restore-tools input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--paper);
  color: var(--ink);
}

.ranking-band {
  margin-top: 30px;
}

.ranking-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.item-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(42, 35, 29, 0.08);
}

.item-card .cover-art {
  aspect-ratio: 4 / 5;
}

.rank-num {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.88);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.item-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.item-actions button,
.item-actions a {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f2;
  color: var(--ink);
  text-decoration: none;
}

.item-actions .mini-like {
  border-color: rgba(0, 124, 120, 0.35);
  color: var(--teal);
}

.item-actions .mini-dislike {
  border-color: rgba(231, 95, 77, 0.35);
  color: #bd4d2f;
}

.item-actions .out-link {
  border-color: rgba(201, 154, 46, 0.48);
  color: #8a671d;
  font-weight: 700;
}

.load-sentinel {
  height: 1px;
}

.detail-dialog {
  width: min(560px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.detail-dialog::backdrop {
  background: rgba(34, 33, 31, 0.58);
}

.detail-dialog form {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.detail-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
}

.detail-layout .cover-art {
  aspect-ratio: 3 / 4;
}

.plain-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 52px) 64px;
}

.plain-page h1 {
  margin: 0 0 18px;
}

.plain-page section {
  margin-top: 22px;
}

.plain-page p,
.plain-page li {
  color: var(--muted);
}

@media (max-width: 960px) {
  .cover-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ranking-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-header,
  .diagnosis-head,
  .ranking-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .swipe-stage {
    grid-template-columns: 96px minmax(0, 1fr) 96px;
    gap: 8px;
  }

  .swipe-card {
    grid-template-columns: 1fr;
  }

  .swipe-card .cover-art {
    aspect-ratio: 4 / 3;
    min-height: auto;
  }

  .cover-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tag-tools {
    grid-template-columns: 1fr;
  }

  .restore-tools {
    grid-template-columns: 1fr 1fr;
  }

  .restore-tools label,
  .restore-tools input {
    grid-column: 1 / -1;
  }

  .ranking-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  main {
    padding-inline: 12px;
  }

  .swipe-stage {
    grid-template-columns: 1fr 1fr;
  }

  .swipe-card {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .swipe-button {
    width: 100%;
    border-radius: 8px;
  }

  .cover-picker,
  .ranking-grid {
    grid-template-columns: 1fr;
  }
}
