/* ===========================================
   PTA攻略 Design Tokens
   羊皮紙×墨×朱 × ドット絵RPGピクセルUI
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;900&family=Noto+Serif+JP:wght@400;700;900&family=DotGothic16&family=Press+Start+2P&display=swap');

:root {
  /* === Parchment palette === */
  --parchment-0: #fbf4e2;   /* lightest */
  --parchment-1: #f5ead0;   /* base page */
  --parchment-2: #ecdeba;   /* card */
  --parchment-3: #d9c79a;   /* border / subtle */
  --parchment-4: #b9a473;   /* hairline */
  --parchment-shadow: #8c7544;

  /* === Ink (sumi) === */
  --ink-900: #1a1410;
  --ink-800: #2b221a;
  --ink-700: #3b2f23;
  --ink-600: #58483a;
  --ink-500: #7a6853;
  --ink-400: #a08d72;

  /* === Vermillion (朱) === */
  --shu-900: #7a1e16;
  --shu-700: #a8321f;
  --shu-500: #c6412a;
  --shu-400: #d8593d;
  --shu-300: #e37d5e;
  --shu-100: #f3c9b8;

  /* === Gold (for rare / legendary) === */
  --gold-700: #8a6a1c;
  --gold-500: #c99a2b;
  --gold-400: #e0b849;
  --gold-300: #f0d477;

  /* === Moss / verdigris (success, safe) === */
  --moss-700: #4a6136;
  --moss-500: #6d8a4b;
  --moss-300: #a8c081;

  /* === Indigo (info, link) === */
  --indigo-700: #2d3a5c;
  --indigo-500: #4b5d8a;

  /* === Difficulty tier colors === */
  --tier-1: #6d8a4b;  /* ★     easy */
  --tier-2: #9a9535;  /* ★★    */
  --tier-3: #c99a2b;  /* ★★★   */
  --tier-4: #c6412a;  /* ★★★★  */
  --tier-5: #7a1e16;  /* ★★★★★ boss */

  /* === Type === */
  --font-ui: 'Noto Sans JP', system-ui, sans-serif;
  --font-display: 'Noto Serif JP', 'Noto Sans JP', serif;
  --font-pixel: 'DotGothic16', 'Noto Sans JP', monospace;
  --font-pixel-en: 'Press Start 2P', monospace;

  /* === Radii === */
  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 6px;

  /* === Shadows (stepped, no blur — RPG-style) === */
  --shadow-pixel-sm: 2px 2px 0 var(--ink-800);
  --shadow-pixel-md: 4px 4px 0 var(--ink-800);
  --shadow-pixel-lg: 6px 6px 0 var(--ink-800);
  --shadow-pixel-shu: 4px 4px 0 var(--shu-900);
  --shadow-soft: 0 2px 0 var(--parchment-shadow);
}

/* === Base === */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--parchment-1);
  color: var(--ink-900);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body {
  /* parchment texture via layered gradients */
  background-color: var(--parchment-1);
  background-image:
    radial-gradient(ellipse 800px 400px at 10% 0%, rgba(184, 132, 72, 0.08), transparent 60%),
    radial-gradient(ellipse 600px 300px at 90% 100%, rgba(122, 30, 22, 0.05), transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(138, 107, 64, 0.015) 2px, rgba(138, 107, 64, 0.015) 3px);
  min-height: 100vh;
}

img { max-width: 100%; display: block; }

a { color: var(--shu-700); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--shu-900); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* === Pixel border utility ===
   Uses box-shadow stacks to draw a crisp 2-color pixel border without image assets. */
.pixel-border {
  position: relative;
  background: var(--parchment-0);
  border: 3px solid var(--ink-900);
  box-shadow:
    0 0 0 3px var(--parchment-0),
    0 0 0 6px var(--ink-900),
    6px 6px 0 6px var(--ink-800);
}

.pixel-border-simple {
  background: var(--parchment-0);
  border: 3px solid var(--ink-900);
  box-shadow: 4px 4px 0 var(--ink-800);
}

.pixel-border-shu {
  background: var(--parchment-0);
  border: 3px solid var(--shu-900);
  box-shadow: 4px 4px 0 var(--shu-900);
}

/* === Pixel button === */
.pixel-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--parchment-0);
  border: 3px solid var(--ink-900);
  box-shadow: 3px 3px 0 var(--ink-800);
  color: var(--ink-900);
  font-family: var(--font-pixel);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: transform 60ms, box-shadow 60ms;
  text-decoration: none;
  cursor: pointer;
}
.pixel-btn:hover {
  background: var(--parchment-1);
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--ink-800);
}
.pixel-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink-800);
}
.pixel-btn.primary {
  background: var(--shu-700);
  color: var(--parchment-0);
  border-color: var(--ink-900);
}
.pixel-btn.primary:hover { background: var(--shu-900); }

.pixel-btn.gold {
  background: var(--gold-500);
  color: var(--ink-900);
}

/* === Headings === */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 900; letter-spacing: 0.02em; color: var(--ink-900); }

/* === Pixel divider === */
.pixel-hr {
  height: 6px;
  background-image:
    linear-gradient(90deg, var(--ink-900) 0 6px, transparent 6px 12px);
  background-size: 12px 6px;
  border: none;
  margin: 24px 0;
  opacity: 0.7;
}

/* === Stars === */
.stars {
  display: inline-flex;
  gap: 2px;
  font-family: var(--font-pixel-en);
  letter-spacing: 0;
}
.stars .star { color: var(--gold-500); font-size: 14px; }
.stars .star.dim { color: var(--parchment-4); }

/* === Difficulty badge === */
.diff-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-family: var(--font-pixel);
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--ink-900);
  background: var(--parchment-0);
  color: var(--ink-900);
  white-space: nowrap;
}
.diff-badge.t1 { background: var(--tier-1); color: #fff; }
.diff-badge.t2 { background: var(--tier-2); color: #fff; }
.diff-badge.t3 { background: var(--tier-3); color: #fff; }
.diff-badge.t4 { background: var(--tier-4); color: #fff; }
.diff-badge.t5 { background: var(--tier-5); color: #fff; }

/* === Scanline overlay (subtle for CRT feel, optional) === */
.crt::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.04) 0 1px, transparent 1px 3px);
  z-index: 1;
}

/* === Dialog box (RPG character talk) === */
.dialog-box {
  position: relative;
  background: var(--parchment-0);
  border: 4px solid var(--ink-900);
  padding: 16px 20px;
  font-family: var(--font-pixel);
  color: var(--ink-900);
  box-shadow: 4px 4px 0 var(--ink-800);
}
.dialog-box::after {
  content: "▼";
  position: absolute;
  right: 14px;
  bottom: 6px;
  font-size: 12px;
  color: var(--ink-900);
  animation: dialog-blink 1s steps(2) infinite;
}
@keyframes dialog-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* === Layout helpers === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-narrow {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
}

/* === Selection === */
::selection { background: var(--shu-500); color: var(--parchment-0); }

/* === Scrollbar (webkit) === */
::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: var(--parchment-2); }
::-webkit-scrollbar-thumb { background: var(--ink-700); border: 3px solid var(--parchment-2); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-900); }

/* === Image rendering (crisp pixels) === */
.pixelated { image-rendering: pixelated; image-rendering: crisp-edges; }

/* === Animations === */
@keyframes float-up {
  0% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

@keyframes sprite-idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes pixel-pulse {
  0%, 100% { box-shadow: 4px 4px 0 var(--ink-800), 0 0 0 0 var(--shu-500); }
  50%      { box-shadow: 4px 4px 0 var(--ink-800), 0 0 0 6px rgba(198, 65, 42, 0.2); }
}
