/* Spark Draw — Y2K × レトロポップ。Kasey Labs標準とは別デザイン（2026-10-20 本人決定） */
:root {
  --ink: #1b1a3a; --cream: #fff6df; --paper: #fffdf6;
  --pink: #ff7eb6; --yellow: #ffd23f; --mint: #70e6c4; --sky: #74b9ff; --cherry: #ff4d6d;
  --sub: #5d5b82;
  --shadow: 4px 4px 0 var(--ink);
  --display: "Dela Gothic One", "Zen Maru Gothic", sans-serif;
  --body: "Zen Maru Gothic", system-ui, sans-serif;
  --pixel: "DotGothic16", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: var(--body); font-weight: 500; line-height: 1.7;
  background-color: var(--cream);
  background-image: radial-gradient(var(--ink) 1.2px, transparent 1.4px);
  background-size: 22px 22px;
  background-position: 0 0;
  background-blend-mode: multiply;
}
body::before { /* ドットを薄くするベール */
  content: ""; position: fixed; inset: 0; background: var(--cream); opacity: .9; z-index: -1;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--cherry); outline-offset: 3px; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 16px; max-width: 560px; margin: 0 auto; }
.logo { font-family: var(--display); font-size: 24px; letter-spacing: .01em; }
.logo .star { color: var(--cherry); display: inline-block; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.lang { display: flex; border: 2.5px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--paper); box-shadow: 2px 2px 0 var(--ink); }
.lang a { color: inherit; text-decoration: none; padding: 4px 14px; font-family: var(--pixel); font-size: 14px; }
.lang a[aria-current="page"] { background: var(--yellow); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

main { max-width: 560px; margin: 0 auto; padding: 0 16px 32px; }
.lead { text-align: center; margin: 4px 0 28px; font-weight: 700; }

/* ---- カード ---- */
.stage { margin-bottom: 28px; }
.deck { position: relative; }
.deck::before, .deck::after { /* 重なったカードの端 */
  content: ""; position: absolute; inset: 0; border: 3px solid var(--ink); border-radius: 28px; background: var(--paper); z-index: 0;
}
.deck::before { transform: rotate(-3deg) translate(-6px, 6px); background: var(--mint); }
.deck::after  { transform: rotate(2.5deg) translate(6px, 4px); background: var(--sky); }

.card {
  position: relative; z-index: 1; min-height: 280px; padding: 52px 26px 28px;
  border: 3px solid var(--ink); border-radius: 28px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: center;
  background: var(--paper);
}
.card[data-tone="1"] { background: var(--pink); }
.card[data-tone="2"] { background: var(--yellow); }
.card[data-tone="3"] { background: #b9f3df; }
.card[data-tone="4"] { background: #b9dcff; }
.card.pop { animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { 0% { transform: scale(.7) rotate(-8deg); opacity: 0; } 60% { transform: scale(1.04) rotate(1.5deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@media (prefers-reduced-motion: reduce) { .card.pop, .logo .star { animation: none; } }

.card-head { position: absolute; top: 14px; left: 18px; right: 60px; display: flex; gap: 8px; align-items: center; }
.card-cat { font-family: var(--pixel); font-size: 13px; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 1px 12px; }
.card-no { font-family: var(--pixel); font-size: 13px; color: var(--ink); opacity: .7; }
.card-cat:empty, .card-no:empty { display: none; }

.card-text { margin: 0; font-family: var(--display); font-size: clamp(22px, 6vw, 30px); line-height: 1.5; text-wrap: balance; }
.card[data-empty="true"] { background: var(--paper); }
.card[data-empty="true"] .card-text { font-family: var(--body); font-weight: 700; font-size: 18px; text-align: center; color: var(--sub); }
.card[data-empty="true"] .fav { display: none; }

.sparkle { position: absolute; font-size: 22px; pointer-events: none; }
.s1 { right: 18px; bottom: 14px; color: var(--cherry); }
.s2 { left: 18px; bottom: 12px; font-size: 18px; }

.fav { position: absolute; top: 8px; right: 10px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 50%; width: 40px; height: 40px; font-size: 20px; line-height: 1; box-shadow: 2px 2px 0 var(--ink); transition: transform .12s; }
.fav:active { transform: translate(2px, 2px); box-shadow: none; }
.fav[aria-pressed="true"] { background: var(--cherry); color: var(--paper); }

/* ---- 引くボタン ---- */
.draw {
  display: block; width: 100%; padding: 16px; border: 3px solid var(--ink); border-radius: 999px;
  background: var(--cherry); color: var(--paper); font-family: var(--display); font-size: 22px; letter-spacing: .04em;
  box-shadow: 0 6px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.draw:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.hint { text-align: center; font-size: 13px; color: var(--sub); margin: 18px 0 32px; font-family: var(--pixel); }
.hint:empty { display: none; }

/* ---- 履歴・お気に入り ---- */
.log { background: var(--paper); border: 3px solid var(--ink); border-radius: 24px; padding: 14px 16px 18px; box-shadow: var(--shadow); }
.tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.tabs button { background: none; border: 2.5px solid transparent; border-radius: 999px; padding: 3px 16px; font-family: var(--pixel); font-size: 15px; color: var(--sub); }
.tabs button[aria-selected="true"] { border-color: var(--ink); background: var(--yellow); color: var(--ink); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: baseline; padding: 10px 0; border-bottom: 2px dotted #1b1a3a40; }
.list li:last-child { border-bottom: 0; }
.list .cat { font-family: var(--pixel); font-size: 12px; background: var(--mint); border: 2px solid var(--ink); border-radius: 999px; padding: 0 10px; white-space: nowrap; }
.list .cat[data-cat="arrange"] { background: var(--sky); }
.list .empty { color: var(--sub); display: block; text-align: center; }
.clear { margin-top: 12px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 999px; padding: 3px 16px; font-size: 13px; font-weight: 700; box-shadow: 2px 2px 0 var(--ink); }
.clear[hidden] { display: none; }
.foot { text-align: center; padding: 24px 16px 32px; font-family: var(--pixel); font-size: 13px; color: var(--sub); }

/* ---- 説明文 ---- */
.about { margin-top: 36px; }
.about h2 { font-family: var(--display); font-size: 22px; margin: 0 0 8px; }
.about h3 { font-family: var(--display); font-size: 17px; margin: 24px 0 6px; }
.about p, .about li { font-size: 15px; }
.about ol, .about ul { padding-left: 1.4em; margin: 6px 0; }
.about .note { font-size: 13px; color: var(--sub); }

/* ---- 共通フッター（Kasey Labs共通の部品を、このアプリの配色に合わせる。共通CSSが後から読まれるので !important）---- */
footer.kl-footer { background: var(--paper) !important; color: var(--sub) !important; font-family: var(--body) !important; border: 3px solid var(--ink) !important; border-radius: 24px; box-shadow: var(--shadow); max-width: 560px !important; width: calc(100% - 32px) !important; margin: 40px auto 32px !important; padding: 24px 20px !important; }
footer.kl-footer .kl-title { color: var(--cherry) !important; font-family: var(--pixel); font-size: 13px !important; }
footer.kl-footer a { color: var(--ink) !important; }
footer.kl-footer a[aria-current="page"] { color: var(--cherry) !important; }
footer.kl-footer .kl-bottom { border-top-color: #1b1a3a33 !important; }
.foot { display: none; }
