@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700&family=Zen+Old+Mincho:wght@400;700&family=Zen+Kaku+Gothic+New:wght@400;500;700&display=swap');

/* ─── Variables ─────────────────────────────── */
:root {
  --gold:         #D4B45E;
  --gold-light:   #EDD389;
  --gold-deep:    #B8964A;
  --gold-dim:     rgba(212,180,94,0.35);
  --silver:       #B8C2CC;
  --bg:           #0E0818;
  --bg-card:      rgba(255,255,255,0.05);
  --bg-card-hover:rgba(255,255,255,0.07);
  --text:         #F0E9F8;
  --text-muted:   rgba(240,233,248,0.62);
  --text-faint:   rgba(240,233,248,0.38);
  --on-gold:      #1C1228;
  --purple-glow:  rgba(168,85,247,0.22);
  --border-card:  rgba(212,180,94,0.18);
  --border-hover: rgba(212,180,94,0.40);
  --border-filled:rgba(212,180,94,0.35);
  --danger:       #F08C8C;

  --font-display: 'Cinzel Decorative', 'Zen Old Mincho', serif;
  --font-serif:   'Zen Old Mincho', 'Hiragino Mincho ProN', serif;
  --font-body:    'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', sans-serif;
}

/* ─── Reset / Base ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  font-variant-numeric: lining-nums;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.6;
  font-size: 15px;
}

button { font-family: inherit; }
input  { font-family: inherit; }

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

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

/* ─── Layout ─────────────────────────────────── */
.wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 0 72px;
}

/* ─── Hero ───────────────────────────────────── */
.hero {
  text-align: center;
  padding: 36px 24px 20px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 400px; height: 300px;
  background: radial-gradient(ellipse, var(--purple-glow) 0%, transparent 70%);
  pointer-events: none;
}
.hero-ornament {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 5px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 10px;
  opacity: .85;
}
.hero-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 27px;
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 45%, var(--silver) 75%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.4;
  margin-bottom: 6px;
}
.hero-title a { text-decoration: none; color: inherit; }
.hero-sub {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 2px;
}

/* ─── Hero list link ─────────────────────────── */
.hero-list-link {
  display: inline-block;
  margin-top: 14px;
  padding: 7px 18px;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--gold);
  text-decoration: none;
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  transition: background .15s, border-color .15s;
}
.hero-list-link:hover {
  background: rgba(212,180,94,.1);
  border-color: var(--border-hover);
}

/* ─── Steps (使い方) ─────────────────────────── */
.steps {
  display: flex;
  justify-content: center;
  gap: 6px;
  list-style: none;
  padding: 0 18px 18px;
  flex-wrap: wrap;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 999px;
  padding: 5px 13px 5px 6px;
  white-space: nowrap;
}
.steps .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(212,180,94,.16);
  color: var(--gold);
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Divider ────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  margin: 4px 0 20px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}
.divider-diamond { color: var(--gold); font-size: 10px; }

/* ─── Course Title Input ─────────────────────── */
.course-title-section { padding: 0 18px 20px; }
.input-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 8px;
  display: block;
}
.course-name-input {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  padding: 13px 16px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  outline: none;
  text-align: center;
  transition: border-color .2s, box-shadow .2s;
}
.course-name-input::placeholder {
  color: var(--text-faint);
  font-weight: 400;
}
.course-name-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,180,94,.15);
}

/* shake animation for empty title */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}
.shake { animation: shake .4s ease; }

/* ─── Courses List ───────────────────────────── */
.courses-list {
  padding: 0 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── Course Row ─────────────────────────────── */
.course-row {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .2s, background .2s;
}
.course-row:hover { border-color: var(--border-hover); }
.course-row.has-content {
  border-color: var(--border-filled);
  background: var(--bg-card-hover);
}

.course-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 10px;
}
.course-icon-wrap {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(107,33,168,.35), rgba(192,38,211,.18));
  border: 1px solid rgba(212,180,94,.35);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.course-icon-wrap svg { width: 24px; height: 24px; }
.course-meta { flex: 1; min-width: 0; }
.course-label-jp {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  line-height: 1.3;
}
.course-label {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  opacity: .8;
}

/* 登録済みステータスチップ */
.course-status {
  flex-shrink: 0;
  font-size: 11.5px;
  letter-spacing: 1px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text-faint);
}
.course-status.filled {
  border-color: rgba(212,180,94,.5);
  background: rgba(212,180,94,.12);
  color: var(--gold-light);
  font-weight: 500;
}

/* ─── Content Area（閲覧ページ） ─────────────── */
.course-content-area {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 0 14px 13px;
}
.thumb-box { width: 118px; flex-shrink: 0; }
.thumb-placeholder {
  width: 100%; aspect-ratio: 3/4;
  border-radius: 6px;
  background: rgba(255,255,255,.04);
  border: 1px dashed rgba(212,180,94,.22);
  display: flex; align-items: center; justify-content: center;
  color: rgba(212,180,94,.3);
}
.thumb-img {
  width: 100%; height: auto;
  border-radius: 6px;
  border: 1px solid rgba(212,180,94,.2);
  display: block;
}
.thumb-empty {
  width: 100%; aspect-ratio: 3/4;
  border-radius: 6px;
  background: rgba(255,255,255,.03);
  border: 1px dashed rgba(212,180,94,.12);
}

.product-info { flex: 1; min-width: 0; }
.product-site-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}
.badge-dlsite {
  background: rgba(99,102,241,.2);
  color: #B6C1FD;
  border: 1px solid rgba(99,102,241,.4);
}
.badge-fanza {
  background: rgba(192,38,211,.2);
  color: #EE93FA;
  border: 1px solid rgba(192,38,211,.4);
}
.product-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.product-title-link {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  text-decoration: none;
  color: var(--text);
  transition: color .15s;
}
.product-title-link:hover { color: var(--gold-light); }
.product-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--gold);
  opacity: .8;
  text-decoration: none;
  transition: opacity .15s;
}
.product-link:hover { opacity: 1; }
.empty-hint, .empty-slot {
  color: var(--text-faint);
  font-size: 13px;
  padding-top: 6px;
}

/* ─── Course Body（作成ページ） ──────────────── */
.course-body {
  display: flex;
  gap: 13px;
  padding: 0 14px 14px;
}
.course-thumb-col {
  width: 118px;
  flex-shrink: 0;
}
.course-input-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.site-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-select-label {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.url-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.course-product-info { padding-top: 0; }
.product-title-sm {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Site Radio（DLsite / FANZA 切替） ───────── */
.radio-group {
  display: flex;
  border: 1px solid var(--gold-dim);
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
}
.radio-btn {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-faint);
  transition: background .15s, color .15s;
}
.radio-btn + .radio-btn { border-left: 1px solid var(--gold-dim); }
.radio-btn.active {
  background: rgba(212,180,94,.2);
  color: var(--gold-light);
}
.radio-btn.disabled,
.radio-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
}

/* ─── URL Input ──────────────────────────────── */
.url-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.url-input {
  flex: 1;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(212,180,94,.25);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 16px; /* 16px未満だとiOSでフォーカス時にズームされる */
  color: var(--text);
  outline: none;
  min-width: 0;
  transition: border-color .2s, box-shadow .2s;
}
.url-input::placeholder { color: var(--text-faint); font-size: 13px; }
.url-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,180,94,.12);
}
.url-input:disabled { opacity: .3; cursor: not-allowed; }

/* ─── Spinner ────────────────────────────────── */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(212,180,94,.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.loading-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60vh;
}
.loading-page .spinner {
  width: 30px; height: 30px;
  border-width: 2.5px;
}

/* ─── Input Error ────────────────────────────── */
.input-error {
  font-size: 12.5px;
  color: var(--danger);
  padding: 0 14px 11px;
  line-height: 1.5;
}

/* ─── Site Warning ───────────────────────────── */
.site-warning {
  margin: 12px 18px 0;
  padding: 12px 14px;
  background: rgba(240,140,140,.08);
  border: 1px solid rgba(240,140,140,.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--danger);
}

/* ─── Footer Actions / Buttons ───────────────── */
.footer-actions {
  padding: 22px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 主ボタン（決定・作る） */
.btn-decide {
  width: 100%;
  padding: 15px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 3px;
  border: 1px solid var(--gold-light);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: var(--on-gold);
  cursor: pointer;
  transition: filter .2s, box-shadow .2s, opacity .2s;
}
.btn-decide:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 0 24px rgba(212,180,94,.25);
}
.btn-decide:disabled {
  background: rgba(212,180,94,.08);
  border-color: var(--border-card);
  color: var(--text-faint);
  cursor: not-allowed;
}

/* 第2ボタン（アウトライン・ゴールド） */
.btn-share {
  width: 100%;
  padding: 13px;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 2px;
  border: 1px solid var(--gold);
  border-radius: 10px;
  background: rgba(212,180,94,.08);
  color: var(--gold-light);
  cursor: pointer;
  transition: background .2s, box-shadow .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-share:hover {
  background: rgba(212,180,94,.16);
  box-shadow: 0 0 20px rgba(212,180,94,.12);
}
.btn-share svg, .btn-share img { flex-shrink: 0; display: block; }

/* 第3ボタン（アウトライン・シルバー） */
.btn-copy {
  width: 100%;
  padding: 12px;
  font-size: 13.5px;
  letter-spacing: 1.5px;
  border: 1px solid rgba(184,194,204,.4);
  border-radius: 10px;
  background: rgba(184,194,204,.06);
  color: var(--silver);
  cursor: pointer;
  transition: background .2s, border-color .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.btn-copy:hover {
  background: rgba(184,194,204,.14);
  border-color: rgba(184,194,204,.6);
}

/* テキストリンク風ボタン（みんなのフルコース等） */
.btn-ghost {
  width: 100%;
  padding: 12px;
  font-size: 13.5px;
  letter-spacing: 1.5px;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: block;
  transition: border-color .2s, color .2s;
}
.btn-ghost:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.progress-note, .share-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 1px;
  padding-top: 3px;
}
.save-error {
  text-align: center;
  font-size: 13px;
  color: var(--danger);
  padding-top: 6px;
}

/* ─── Age Gate ───────────────────────────────── */
#age-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.age-gate-box {
  text-align: center;
  max-width: 380px;
  width: 100%;
}
.age-gate-ornament {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--gold);
  margin-bottom: 28px;
}
.age-gate-title {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 14px;
}
.age-gate-sub {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 36px;
}
.age-gate-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.age-gate-buttons button {
  width: 100%;
  padding: 15px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 10px;
  cursor: pointer;
  transition: filter .2s, background .2s;
}
#ageYes {
  border: 1px solid var(--gold-light);
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: var(--on-gold);
}
#ageYes:hover { filter: brightness(1.08); }
#ageNo {
  border: 1px solid rgba(184,194,204,.4);
  background: rgba(184,194,204,.07);
  color: var(--silver);
}
#ageNo:hover { background: rgba(184,194,204,.15); }

/* ─── Reaction Section ───────────────────────── */
.reaction-section {
  padding: 24px 18px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.reaction-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold);
}
.reaction-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
}
.btn-reaction {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 15px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.btn-reaction:hover {
  border-color: var(--border-hover);
  background: rgba(212,180,94,.07);
}
.btn-reaction.active {
  border-color: rgba(212,180,94,.6);
  background: rgba(212,180,94,.12);
}
.reaction-name {
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.btn-reaction.active .reaction-name {
  color: var(--gold-light);
  font-weight: 500;
}
.reaction-count {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 19px;
  color: var(--text-muted);
  line-height: 1;
}
.btn-reaction.active .reaction-count { color: var(--gold-light); }

/* ─── View Page Title ────────────────────────── */
.view-title {
  text-align: center;
  padding: 0 20px 6px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.5;
  background: linear-gradient(135deg, var(--gold-light), var(--silver));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

/* ─── List Page ─────────────────────────────── */
.list-sort-bar {
  display: flex;
  padding: 0 18px 16px;
}
.sort-tab {
  flex: 1;
  padding: 10px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1.5px;
  border: 1px solid var(--gold-dim);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sort-tab:first-child { border-radius: 8px 0 0 8px; }
.sort-tab:last-child  { border-radius: 0 8px 8px 0; }
.sort-tab + .sort-tab { border-left: none; }
.sort-tab.active {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: var(--on-gold);
  font-weight: 700;
}

.list-cards {
  padding: 0 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.list-loading {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}
.list-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.list-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color .2s, background .2s;
}
.list-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.list-card-thumb {
  width: 84px;
  flex-shrink: 0;
  align-self: flex-start;
}
.list-card-thumb img {
  width: 100%;
  height: auto;
  border-radius: 5px;
  border: 1px solid rgba(212,180,94,.2);
  display: block;
}
.list-card-thumb-empty {
  width: 84px;
  aspect-ratio: 3/4;
  background: rgba(255,255,255,.03);
  border: 1px dashed rgba(212,180,94,.15);
  border-radius: 5px;
}

.list-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.list-card-title {
  font-family: var(--font-serif);
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
}
.list-card-stat {
  font-size: 13px;
  color: var(--text-muted);
}
.list-card-stat-gold { color: var(--gold); }
.list-card-reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-faint);
}
.list-card-reaction-active { color: var(--gold); }
.list-card-date { margin-left: auto; font-size: 12px; }

/* ─── Ad Banner ─────────────────────────────── */
.ad-banner {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 24px 18px 0;
  flex-wrap: wrap;
}
.ad-banner img { display: block; border: none; max-width: 100%; height: auto; }

/* ─── Page Footer ────────────────────────────── */
.page-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 18px 8px;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-footer a {
  font-size: 12px;
  color: var(--text-faint);
  text-decoration: none;
  letter-spacing: 1px;
  transition: color .15s;
}
.page-footer a:hover { color: var(--text-muted); }
.footer-sep {
  font-size: 11px;
  color: var(--text-faint);
}
.footer-copy {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 1px;
}

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 400px) {
  .thumb-box, .course-thumb-col { width: 96px; }
  .radio-btn { padding: 7px 11px; }
  .steps li { font-size: 12px; }
}
