:root {
  --hot: #FF1493;
  --mag: #FF00AA;
  --vio: #9D00FF;
  --cyan: #00F0FF;
  --gold: #FFE45C;
  --bg: #14001a;
  --card: rgba(40, 0, 50, .78);
  --line: rgba(255, 20, 147, .55);
  --text: #fff;
  --dim: #ffb3dc;
  --holo: linear-gradient(115deg, #FF1493, #FF00AA 25%, #9D00FF 45%, #00F0FF 65%, #FF00AA 85%, #FF1493);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 20, 147, .45), transparent 45%),
    radial-gradient(circle at 90% 30%, rgba(157, 0, 255, .45), transparent 45%),
    radial-gradient(circle at 30% 100%, rgba(255, 0, 170, .35), transparent 50%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "M PLUS Rounded 1c", system-ui, sans-serif;
  font-weight: 800;
  padding: 0 16px calc(40px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
.glitter {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(2px 2px at 10% 20%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 70% 10%, #ffd6ee, transparent),
    radial-gradient(2px 2px at 40% 60%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 85% 75%, #fff, transparent),
    radial-gradient(2px 2px at 25% 85%, #ffe45c, transparent),
    radial-gradient(1.5px 1.5px at 55% 35%, #fff, transparent);
  background-size: 260px 260px;
  animation: twinkle 3s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .35 } to { opacity: 1 } }
header, main, nav, .sub { position: relative; z-index: 1; max-width: 960px; margin-left: auto; margin-right: auto; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: calc(18px + env(safe-area-inset-top)); }
.logo {
  margin: 0; font-family: "Rubik Wet Paint", "Dela Gothic One", sans-serif; font-weight: 400;
  font-size: clamp(30px, 8vw, 54px); line-height: 1;
  background: var(--holo); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 20, 147, .9));
  animation: holo 6s linear infinite;
}
.logo span { display: block; font-size: .5em; letter-spacing: .08em; }
@keyframes holo { to { background-position: 300% 0 } }
.sync-btn, .mini, .tabs button, .cal-head button {
  font: inherit; color: #fff; cursor: pointer; border: 0;
}
.sync-btn {
  flex: none; padding: 12px 18px; border-radius: 999px; font-size: 15px; font-weight: 900;
  background: linear-gradient(135deg, var(--hot), var(--mag), var(--vio));
  box-shadow: 0 0 18px var(--hot), inset 0 0 8px rgba(255, 255, 255, .5);
}
.top-btns { display: flex; gap: 8px; align-items: center; }
.gear { font: inherit; color: #fff; cursor: pointer; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); font-size: 20px; }
.sync-btn.busy { animation: busy 1s linear infinite; }
@keyframes busy { 50% { filter: brightness(1.6) saturate(1.4); box-shadow: 0 0 30px var(--gold); } }
.sub { color: var(--dim); font-size: 12px; margin: 8px auto 14px; }

/* tabs */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.tabs button {
  padding: 12px 0; border-radius: 14px; background: var(--card); border: 2px solid var(--line);
  font-family: "Dela Gothic One", sans-serif; font-size: 15px; letter-spacing: .06em;
}
.tabs button.on { background: var(--holo); background-size: 200% 100%; border-color: #fff; box-shadow: 0 0 20px var(--mag); text-shadow: 0 1px 4px #600040; }
.panel { display: none; }
.panel.on { display: block; animation: pop .3s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) } }

/* ticker */
.ticker {
  overflow: hidden; white-space: nowrap; border-radius: 12px; margin-bottom: 14px;
  background: linear-gradient(90deg, #FF1493, #FF00AA); box-shadow: 0 0 16px var(--hot);
  font-size: 13px; padding: 8px 0;
}
.ticker-track { display: inline-block; padding-left: 100%; animation: tick 40s linear infinite; }
.ticker-track span { margin-right: 40px; }
@keyframes tick { to { transform: translateX(-100%) } }

/* hero */
.hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 22px 22px 20px;
  background: linear-gradient(145deg, rgba(255, 20, 147, .55), rgba(157, 0, 255, .5));
  border: 3px solid #fff; box-shadow: 0 0 30px var(--hot), 0 0 80px rgba(255, 0, 170, .5), inset 0 0 40px rgba(255, 255, 255, .15);
}
.hero-label { font-family: "Dela Gothic One", sans-serif; font-size: 18px; letter-spacing: .1em; }
.hero-label small { font-family: "M PLUS Rounded 1c"; font-size: 12px; color: var(--dim); letter-spacing: 0; margin-left: 6px; }
.hero-count { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 10px; }
.hero-count b {
  font-family: "Dela Gothic One", sans-serif; font-weight: 400; font-size: clamp(84px, 24vw, 140px); line-height: 1;
  color: #fff; text-shadow: 3px 3px 0 var(--hot), 6px 6px 0 #4a0070; /* ぼかさない：くっきり読めるステッカー風 */
}
.hero-count span { font-size: 22px; }
.hero-count i { font-style: normal; }
/* 目標のマス */
.cells { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.cells i {
  display: block; height: 22px; border-radius: 7px; background: rgba(0, 0, 0, .35); border: 2px solid rgba(255, 255, 255, .45);
}
.cells.two i { height: 18px; }
.cells i.on {
  background: linear-gradient(135deg, #FF1493, #FF00AA 50%, #9D00FF); border-color: #fff;
  box-shadow: 0 0 10px var(--hot), inset 0 0 6px rgba(255, 255, 255, .6);
}
.cells i.gold {
  background: linear-gradient(135deg, #FFF6B0, #FFE45C 40%, #FFB300 70%, #FFE45C); border-color: #fff;
  box-shadow: 0 0 12px var(--gold), inset 0 0 6px rgba(255, 255, 255, .8);
  background-size: 200% 200%; animation: holo 3s linear infinite;
}
.cells i.new { animation: popcell .9s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes popcell { from { transform: scale(.2); opacity: 0 } }
.hero-left { margin-top: 10px; font-size: 15px; }
.hero-left b { font-family: "Dela Gothic One", sans-serif; font-weight: 400; font-size: 22px; color: var(--gold); text-shadow: 0 0 10px var(--gold); }
.hero-left .done { font-family: "Dela Gothic One", sans-serif; font-size: 20px; color: var(--gold); -webkit-text-stroke: 1px #4a0070; paint-order: stroke fill; text-shadow: 0 2px 0 #4a0070, 0 0 14px var(--gold), 0 0 30px var(--hot); }
.bar { height: 18px; border-radius: 999px; background: rgba(0, 0, 0, .35); overflow: hidden; border: 2px solid rgba(255, 255, 255, .7); }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--hot), var(--mag), var(--cyan)); box-shadow: 0 0 14px var(--gold); transition: width .8s cubic-bezier(.2, 1.4, .4, 1); }
.hero-imp { margin-top: 12px; font-size: 16px; }
.hero-imp b { font-family: "Dela Gothic One", sans-serif; font-weight: 400; font-size: 26px; color: var(--gold); text-shadow: 0 0 12px var(--gold); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 6px; }
.stat { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: 0 0 12px rgba(255, 20, 147, .35); min-width: 0; }
.stat span { display: block; font-size: 11px; color: var(--dim); }
.stat b { font-family: "Dela Gothic One", sans-serif; font-weight: 400; font-size: 26px; text-shadow: 0 0 10px var(--hot); word-break: break-all; }
.stat small { font-size: 11px; color: var(--gold); margin-left: 4px; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.h { font-family: "Dela Gothic One", sans-serif; font-weight: 400; font-size: 20px; margin: 22px 0 10px; letter-spacing: .04em; text-shadow: 0 0 10px var(--hot); }
.h small { font-family: "M PLUS Rounded 1c"; font-size: 11px; color: var(--dim); margin-left: 6px; text-shadow: none; }
.h3 { font-size: 14px; margin: 18px 0 8px; color: var(--dim); }

/* chart */
.chart { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 12px 8px 6px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .legend { display: flex; gap: 14px; font-size: 11px; color: var(--dim); padding: 0 6px 6px; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* post list */
.list { display: grid; gap: 10px; }
.post {
  display: block; text-decoration: none; color: #fff; background: var(--card); border: 2px solid var(--line);
  border-radius: 18px; padding: 12px 14px; transition: transform .15s, box-shadow .15s;
}
.post:hover { box-shadow: 0 0 18px var(--mag); }
.post-time { font-size: 11px; color: var(--dim); display: flex; gap: 6px; flex-wrap: wrap; }
.post-time .tag { background: var(--hot); color: #fff; border-radius: 6px; padding: 0 6px; }
.post-time .to-x { margin-left: auto; color: var(--gold); text-decoration: none; }
.pics { display: grid; gap: 4px; grid-template-columns: 1fr 1fr; border-radius: 14px; overflow: hidden; margin: 0 0 10px; border: 2px solid rgba(255, 255, 255, .5); box-shadow: 0 0 14px rgba(255, 0, 170, .5); }
.pics.n1 { grid-template-columns: 1fr; }
.pics.n3 .pic:first-child { grid-row: span 2; }
.pic { all: unset; cursor: zoom-in; display: block; aspect-ratio: 1; background: rgba(255, 255, 255, .08); }
.pics.n1 .pic { aspect-ratio: auto; }
.pics.n1 .pic img { height: auto; max-height: 75vh; object-fit: contain; background: #fff; }
.pics.n3 .pic:first-child { aspect-ratio: auto; }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox { padding: 0; border: 3px solid var(--hot); background: #000; max-width: 96vw; max-height: 92vh; width: auto; }
.lightbox img { display: block; max-width: 94vw; max-height: 90vh; object-fit: contain; }
.post-text { font-weight: 500; font-size: 14px; line-height: 1.6; margin: 6px 0 8px; white-space: pre-wrap; word-break: break-word; }
.post-metrics { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.post-metrics .v { color: var(--gold); text-shadow: 0 0 8px var(--gold); }
.empty { text-align: center; padding: 26px 10px; color: var(--dim); background: var(--card); border: 2px dashed var(--line); border-radius: 18px; font-size: 14px; line-height: 1.7; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; }
.cal-head h2 { font-family: "Dela Gothic One", sans-serif; font-weight: 400; margin: 0; font-size: 22px; text-shadow: 0 0 10px var(--hot); }
.cal-head button { width: 44px; height: 44px; border-radius: 50%; background: var(--card); border: 2px solid var(--line); }
.cal-week, .cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-week { margin: 12px 0 6px; font-size: 11px; text-align: center; color: var(--dim); }
.cal button {
  font: inherit; color: #fff; cursor: pointer; aspect-ratio: 1 / 1.1; border-radius: 12px; border: 2px solid transparent;
  background: rgba(255, 255, 255, .06); display: flex; flex-direction: column; justify-content: space-between; padding: 5px; min-width: 0;
}
.cal button .d { font-size: 11px; align-self: flex-start; }
.cal button .n { font-family: "Dela Gothic One", sans-serif; font-size: clamp(16px, 4.6vw, 24px); line-height: 1; align-self: center; }
.cal button .vv { font-size: 10px; color: var(--gold); align-self: center; white-space: nowrap; overflow: hidden; max-width: 100%; }
.cal button.l1 { background: rgba(255, 20, 147, .3); }
.cal button.l2 { background: rgba(255, 20, 147, .55); }
.cal button.l3 { background: linear-gradient(135deg, #FF1493, #FF00AA); box-shadow: 0 0 10px var(--hot); }
.cal button.l4 { background: var(--holo); background-size: 200% 100%; box-shadow: 0 0 18px var(--mag); animation: holo 5s linear infinite; }
.cal button.today { border-color: #fff; }
.cal button.sel { outline: 3px solid var(--gold); }
.cal button.out { opacity: .25; pointer-events: none; }

/* posts filters */
.filters { display: flex; gap: 8px; }
.filters input, .filters select, .row input {
  font: inherit; color: #fff; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0;
}
.filters input { flex: 1; }
.count-note { font-size: 12px; color: var(--dim); }

/* dialog */
dialog {
  width: min(560px, calc(100vw - 32px)); max-height: 88vh; overflow: auto; color: #fff;
  background: linear-gradient(160deg, #2a0033, #14001a); border: 3px solid var(--hot); border-radius: 24px;
  box-shadow: 0 0 40px var(--hot); padding: 18px 20px 22px;
}
dialog::backdrop { background: rgba(20, 0, 26, .75); backdrop-filter: blur(4px); }
.close-row { display: flex; justify-content: flex-end; margin: 0; }
.close-row button { font: inherit; color: #fff; background: none; border: 0; font-size: 22px; cursor: pointer; width: 44px; height: 44px; }
.steps { padding-left: 20px; line-height: 1.8; font-size: 14px; font-weight: 500; }
.steps a, details a { color: var(--gold); }
.bm {
  display: block; text-align: center; margin: 14px 0 10px; padding: 16px; border-radius: 999px; color: #fff; text-decoration: none;
  font-family: "Dela Gothic One", sans-serif; font-size: 20px; background: var(--holo); background-size: 300% 100%;
  animation: holo 5s linear infinite; box-shadow: 0 0 24px var(--mag); border: 3px dashed #fff; cursor: grab;
}
.mini { display: inline-block; padding: 10px 14px; border-radius: 12px; background: var(--card); border: 2px solid var(--line); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.row input { width: 80px; }
details { font-size: 13px; font-weight: 500; margin-top: 10px; color: var(--dim); line-height: 1.7; }
.note { font-size: 12px; color: var(--dim); font-weight: 500; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 140%); z-index: 10;
  padding: 14px 22px; border-radius: 999px; background: linear-gradient(135deg, var(--hot), var(--vio)); box-shadow: 0 0 24px var(--hot);
  transition: transform .35s cubic-bezier(.2, 1.4, .4, 1); max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

/* 取りこぼし警告 */
.gap {
  display: grid; gap: 6px; margin-bottom: 14px; padding: 14px 16px; border-radius: 18px; font-size: 13px; line-height: 1.6;
  background: linear-gradient(135deg, rgba(255, 228, 92, .25), rgba(255, 20, 147, .35)); border: 2px solid var(--gold); box-shadow: 0 0 18px rgba(255, 228, 92, .6);
}
.gap[hidden] { display: none; }
.gap b { font-size: 15px; color: var(--gold); }
.gap span { font-weight: 500; }
.gap-btns { display: flex; gap: 8px; }

/* ---- ホーム：XとThreadsを並べる ---- */
.today-range { font-family: "Dela Gothic One", sans-serif; font-size: 18px; letter-spacing: .1em; margin: 4px 0 10px; text-shadow: 0 0 10px var(--hot); }
.today-range small { font-family: "M PLUS Rounded 1c"; font-size: 12px; color: var(--dim); letter-spacing: 0; margin-left: 6px; text-shadow: none; }
.heroes { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; } /* スマホでも横並び（一覧性が大事） */
.heroes .hero { padding: 18px 18px 16px; }
.heroes .hero-count b { font-size: clamp(64px, 18vw, 104px); }
.hero-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-label small { font-family: "M PLUS Rounded 1c"; font-size: 12px; color: var(--dim); letter-spacing: 0; }
.pf-tag { display: inline-block; padding: 3px 12px; border-radius: 999px; background: rgba(0, 0, 0, .35); border: 2px solid #fff; font-size: 15px; }
.hero-th {
  background: linear-gradient(145deg, rgba(0, 240, 255, .38), rgba(157, 0, 255, .55));
  box-shadow: 0 0 30px #00C8FF, 0 0 80px rgba(157, 0, 255, .5), inset 0 0 40px rgba(255, 255, 255, .15);
}
.hero-th .hero-count b { text-shadow: 3px 3px 0 #00C8FF, 6px 6px 0 #3a0070; }
.hero-th .cells i.on { background: linear-gradient(135deg, #00F0FF, #6A5CFF 50%, #9D00FF); box-shadow: 0 0 10px #00F0FF, inset 0 0 6px rgba(255, 255, 255, .6); }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.mini-stats div { background: rgba(0, 0, 0, .3); border: 1px solid rgba(255, 255, 255, .35); border-radius: 12px; padding: 7px 8px; min-width: 0; }
.mini-stats span { display: block; font-size: 10px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stats b { font-family: "Dela Gothic One", sans-serif; font-weight: 400; font-size: 19px; }
.mini-stats small { font-size: 10px; color: var(--gold); margin-left: 3px; }

/* 投稿カードのバッジ */
.badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; font-size: 13px; color: #fff; }
.b-x { background: linear-gradient(135deg, #FF1493, #FF00AA); box-shadow: 0 0 8px var(--hot); }
.b-threads { background: linear-gradient(135deg, #00F0FF, #9D00FF); box-shadow: 0 0 8px #00F0FF; }
.post-threads { border-color: rgba(0, 240, 255, .55); }
.post-time { align-items: center; }

/* 投稿一覧の絞り込み */
.chips { display: flex; gap: 8px; margin-top: 10px; }
.chips button { font: inherit; color: #fff; cursor: pointer; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 2px solid var(--line); font-size: 13px; }
.chips button.on { background: var(--holo); background-size: 200% 100%; border-color: #fff; box-shadow: 0 0 14px var(--mag); }

/* カレンダー：1マスに両方 */
.cal button .nn { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: clamp(10px, 2.9vw, 14px); line-height: 1.15; font-weight: 900; }
.cal button .nn span:empty { display: none; }
.cal button .cx.ok, .cal button .ct.ok { color: var(--gold); text-shadow: 0 0 6px var(--gold); }

/* スマホ：2枚並べても一目で読めるサイズに */
@media (max-width: 600px) {
  .heroes { gap: 8px; }
  .heroes .hero { padding: 12px 10px 12px; border-radius: 20px; border-width: 2px; }
  .heroes .hero-count { margin: 2px 0 8px; gap: 4px; flex-wrap: wrap; }
  .heroes .hero-count b { font-size: clamp(46px, 15vw, 64px); text-shadow: 2px 2px 0 var(--hot), 4px 4px 0 #4a0070; }
  .heroes .hero-th .hero-count b { text-shadow: 2px 2px 0 #00C8FF, 4px 4px 0 #3a0070; }
  .heroes .hero-count span { font-size: 13px; }
  .hero-label { gap: 4px; }
  .hero-label small { display: none; }
  .pf-tag { font-size: 12px; padding: 2px 9px; }
  .heroes .cells { gap: 3px; }
  .heroes .cells i { height: 14px; border-radius: 4px; border-width: 1.5px; }
  .heroes .cells.two i { height: 11px; }
  .heroes .hero-left { font-size: 11px; margin-top: 8px; }
  .heroes .hero-left b { font-size: 17px; }
  .heroes .hero-left .done { font-size: 14px; }
  .heroes .hero-imp { font-size: 11px; margin-top: 6px; }
  .heroes .hero-imp b { font-size: 18px; }
  .mini-stats { grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 10px; }
  .mini-stats div { padding: 5px 6px; border-radius: 9px; }
  .mini-stats b { font-size: 15px; }
}

#thUrls { display: block; width: 100%; margin-bottom: 8px; font: inherit; font-size: 13px; color: #fff; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; }
