/* ランキング・まとめ・リザルトで共有する器。
 *
 * 画像は増やさない。飾りは CSS とインライン SVG だけで作る——このサイトは
 * ゲームのリンクから開かれるので、開いてから絵が出るまでが短いほうがいい。
 * 配色はゲーム内の判定色・難易度カードから採ってある(勝手な色を足さない)。 */
:root {
	color-scheme: light;
	--paper: #FFF9F2;
	--ink: #3B2430;
	--muted: #7A6674;
	--faint: #5C4652;
	--line: #E4D8CE;
	--wash: #FFFDFC;
	--accent: #B13F75;
	--accent-soft: #F7E7EF;
	--accent-line: #EBD3E0;
	--shadow: 0 10px 32px rgba(91, 55, 75, .07);
}
* { box-sizing: border-box; }
body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
	-webkit-text-size-adjust: 100%;
}
button, select, input { font: inherit; }
canvas { direction: ltr; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* --- 上の帯 ---------------------------------------------------------------
   作品名そのものが公式サイトへの入口。ページの中では名乗らない
   (下部のナビにもう一度だけ、公式サイトへの入口として出す) */
.shell-bar {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 4px 14px 4px 18px;
	background: rgba(255, 253, 252, .92);
	border-bottom: 1px solid var(--line);
}
.shell-brand {
	display: inline-flex; align-items: center; gap: 6px; padding: 7px 0;
	color: var(--ink); text-decoration: none;
}
.shell-brand:hover, .shell-brand:focus-visible { color: var(--accent); }
.shell-brand .name { font-size: 11px; letter-spacing: .14em; }
.shell-brand .go { font-size: 9px; color: var(--accent); }
.shell-left { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; min-width: 0; }
/* ストアへの入口。作品名より一段小さく、押せる色で */
.shell-store { color: var(--accent); font-size: 10px; letter-spacing: .06em; text-decoration: none; white-space: nowrap; }
.shell-store:hover, .shell-store:focus-visible { text-decoration: underline; }
.language-switch {
	display: inline-flex; align-items: center; gap: 4px;
	min-height: 30px; padding: 2px 4px 2px 7px; border-radius: 999px;
	color: var(--muted); font-size: 10px; letter-spacing: .06em;
}
.language-switch:hover { background: rgba(228, 216, 206, .35); }
.language-switch svg { flex: 0 0 auto; }
.language-switch select {
	max-width: 150px; padding: 2px 2px 2px 1px;
	border: 0; background: transparent; color: var(--muted);
	font-size: 10px; cursor: pointer;
}
.language-switch select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ステージの足元灯。判定の色をそのまま帯にしている */
.shell-footlight {
	height: 2px; opacity: .55;
	background: linear-gradient(90deg, #FFD45C, #F0649B 32%, #55C8FF 64%, #4FBF76);
}

.site-main { width: min(100%, 996px); margin: 0 auto; padding: 0 0 8px; }
.site-body { padding: 0 18px; }

/* --- 見出し --------------------------------------------------------------- */
.stage-hero {
	padding: 20px 18px 16px;
	background: radial-gradient(120% 78% at 50% -22%, rgba(255, 201, 228, .55), rgba(255, 249, 242, 0) 72%);
}
.stage-eyebrow { display: flex; align-items: center; gap: 9px; }
.stage-eyebrow .kicker { font-size: 10px; font-weight: 700; letter-spacing: .18em; color: var(--accent); }
.stage-eyebrow .rule { flex: 1 1 auto; height: 1px; background: var(--line); }
.stage-eyebrow .stamp { font-size: 10px; color: var(--muted); letter-spacing: .06em; }
.stage-title { margin: 7px 0 0; font-size: clamp(25px, 6vw, 31px); line-height: 1.12; letter-spacing: .01em; font-weight: 400; }
.stage-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.chip {
	padding: 4px 9px; border-radius: 5px;
	background: rgba(122, 102, 116, .1); color: var(--muted);
	font-size: 10px; letter-spacing: .06em;
}
.chip.level { background: rgba(255, 212, 92, .26); color: #8A6810; font-weight: 700; letter-spacing: .1em; }

/* --- 切り替え -------------------------------------------------------------
   四角いタブ(通算 / 今日の譜面)。紙が一枚めくれている見立て */
.tabs { display: flex; margin: 14px 18px 0; border-bottom: 1px solid var(--line); }
.tab {
	flex: 1 1 0; padding: 10px 6px; border: 1px solid transparent; border-bottom: 0;
	border-radius: 9px 9px 0 0; background: none;
	color: var(--muted); font-size: 12px; text-align: center; cursor: pointer;
}
.tab[aria-selected="true"] {
	border-color: var(--line); background: var(--wash);
	color: var(--ink); font-weight: 700;
	box-shadow: 0 1px 0 var(--wash);
}
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 曲は2つだけなので、選ぶのではなく並べて押させる */
.pill-tabs { display: flex; gap: 6px; padding: 12px 18px 0; }
.pill-tab {
	flex: 1 1 0; padding: 8px 6px; border: 1px solid var(--line); border-radius: 8px;
	background: var(--wash); color: var(--muted); font-size: 12px; text-align: center; cursor: pointer;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill-tab[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); font-weight: 700; }
.pill-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 絞り込みは横幅をいっぱい使う。今選んでいるものがそのまま見えていればいい */
.fields { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 0; }
.field {
	width: 100%; min-height: 44px; padding: 11px 34px 11px 13px;
	border: 1px solid var(--line); border-radius: 10px;
	background: var(--wash); color: var(--ink); font-size: 13px;
}
.field:disabled { color: #B8AAB2; background: #F4EEE8; }

/* --- 難易度 ---------------------------------------------------------------
   ゲーム内の難易度カードと同じ配色・同じ改行。選んだものだけ明かりが当たる */
.diffs { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px 18px; }
.diff {
	display: grid; place-items: center; width: 62px; height: 62px; padding: 0;
	border: 1.5px solid #D8CBB6; border-radius: 50%;
	background: linear-gradient(180deg, #F6EEDF, #EBE0CB);
	opacity: .8; cursor: pointer;
}
.diff[aria-selected="true"] {
	border: 2px solid #C9A961; background: linear-gradient(180deg, #FFFFFF, #FBF5E8); opacity: 1;
	box-shadow: 0 0 0 3px var(--paper), 0 8px 18px rgba(91, 55, 75, .16);
}
.diff:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.diff span {
	font-size: 10px; line-height: 1.08; font-weight: 700; letter-spacing: .02em; text-align: center;
	background-image: var(--g); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.diff-0 span { --g: linear-gradient(180deg, #39A0A3, #78BAC4); }
.diff-1 span { --g: linear-gradient(180deg, #D94C5E, #E17077); }
.diff-2 span { --g: linear-gradient(180deg, #7D81C0, #7E96D0); }
.diff-3 span { --g: linear-gradient(100deg, #D98CAE, #B49CD8 52%, #86C2C4); }

/* --- 順位表 ---------------------------------------------------------------
   1行1人。「あなたの記録」のカードも同じ列割りで組む */
.rank-cols {
	/* em にすると行の親(16px)基準になって、10px の列が実寸で 70px になる。
	   ここは px で決める——番号が省略されると誰の記録か読めなくなる */
	display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 46px 40px;
	gap: 7px; align-items: baseline;
}
.rank-list { padding: 0 18px; }
.rank-row { padding: 11px 10px; border-top: 1px solid rgba(228, 216, 206, .8); }
.rank-row .place { font-size: 13px; color: var(--muted); text-align: right; }
.rank-row .who { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .who .cc { font-size: 10px; color: var(--muted); letter-spacing: .08em; }
.rank-row .score { font-size: 14px; text-align: right; }
.rank-row .acc, .rank-row .combo { font-size: 10px; text-align: right; color: var(--faint); }
/* 上位3人と自分だけ太字。全部太いと、どれが強いのか分からなくなる */
.rank-row.is-top .place, .rank-row.is-top .who, .rank-row.is-top .score { font-weight: 700; }
.rank-row.is-top .place { color: var(--ink); }
.rank-row.is-you {
	border-top: 0; border-left: 3px solid var(--accent); border-radius: 10px;
	background: var(--accent-soft); padding-left: 7px;
}
.rank-row.is-you .place, .rank-row.is-you .who, .rank-row.is-you .score { font-weight: 700; }
.rank-row.is-you .place { color: var(--ink); }

.you-card {
	margin: 0 18px 14px; padding: 12px 12px 13px;
	border: 1px solid var(--accent-line); border-radius: 14px;
	background: linear-gradient(180deg, rgba(255, 231, 243, .5), var(--wash) 62%);
}
.you-card .head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.you-card .head .label { font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--accent); }
.you-card .head .of { font-size: 10px; color: var(--muted); }
.you-card .rank-cols { margin-top: 7px; }
.you-card .place { font-size: 19px; font-weight: 700; color: var(--accent); text-align: right; }
.you-card .who { font-size: 13px; font-weight: 700; overflow: hidden; }
.you-card .who .cc { font-size: 10px; font-weight: 400; color: var(--muted); letter-spacing: .08em; }
.you-card .score { font-size: 19px; font-weight: 700; text-align: right; }
.you-card .acc, .you-card .combo { font-size: 10px; text-align: right; color: var(--faint); }

/* 続きはスクロールで伸びる。末尾は読み込み中の合図だけ置く */
.load-dots { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 20px 0 24px; }
.load-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.load-dots span:nth-child(1) { opacity: .8; }
.load-dots span:nth-child(2) { opacity: .45; }
.load-dots span:nth-child(3) { opacity: .2; }
.list-end { padding: 18px 0 24px; text-align: center; color: var(--muted); font-size: 11px; }

/* --- まとめの数字 ---------------------------------------------------------- */
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 0 18px; }
.tile {
	min-width: 0; padding: 12px 13px;
	border: 1px solid var(--line); border-radius: 10px; background: var(--wash);
}
.tile .label { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .11em; }
.tile .value { display: block; margin-top: 3px; font-size: 23px; font-weight: 700; overflow-wrap: anywhere; }
.tile.wide { grid-column: 1 / -1; }

.sec { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin: 26px 0 10px; }
.sec h2 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.sec .note { margin: 0; color: var(--muted); font-size: 10px; text-align: right; }

.surface { background: var(--wash); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.pill-link {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 42px; padding: 9px 17px;
	border: 1px solid var(--ink); border-radius: 999px;
	background: var(--wash); color: var(--ink);
	font-size: 12px; font-weight: 700; letter-spacing: .04em; text-decoration: none;
}
.pill-link:hover, .pill-link:focus-visible { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: 2px; }

.state { padding: 42px 16px; text-align: center; color: var(--muted); }
.state strong { display: block; color: var(--ink); font-size: 15px; letter-spacing: .08em; }
.state p { margin: 8px 0 0; font-size: 12px; }
.retry-button {
	margin-top: 14px; min-height: 40px; padding: 8px 18px;
	border: 1px solid var(--ink); border-radius: 6px;
	background: var(--wash); color: var(--ink); cursor: pointer;
	font-size: 12px; font-weight: 700;
}

/* --- ページ間のリンクとフッター -------------------------------------------
   4枚は同じ話の裏表なので、どこからでも隣へ行けるようにしておく。
   ボタンの形と大きさは共有ページ上部のシェアボタン(index.html の .btn)と同じ。
   フッターの線の上に置き、線の下は名乗りと作者だけ */
.shell-links { display: flex; flex-wrap: wrap; gap: 10px; padding: 26px 18px 8px; }
.shell-links .nav-btn {
	flex: 1 1 160px;
	display: inline-flex; align-items: center; justify-content: center;
	padding: 12px 16px; border-radius: 999px;
	border: 2px solid var(--ink); background: #fff; color: var(--ink);
	font-size: 14px; font-weight: 700; text-align: center; text-decoration: none;
}
.shell-links a.nav-btn:hover, .shell-links a.nav-btn:focus-visible { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.shell-links a.nav-btn:active { transform: translateY(1px); }
/* 今いるページ。押せないことが分かる薄さにする */
.shell-links .nav-btn.here { border-color: var(--line); background: transparent; color: var(--muted); }
@media (max-width: 520px) {
	.shell-links .nav-btn { flex-basis: 100%; }
}
.shell-nav { margin-top: 18px; padding: 14px 18px 24px; border-top: 1px solid var(--line); }
.shell-nav .foot {
	display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
	gap: 8px 14px;
}
.shell-nav .places { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.shell-nav .brand-link { color: var(--ink); font-size: 12px; letter-spacing: .12em; text-decoration: none; }
.shell-nav .brand-link:hover, .shell-nav .brand-link:focus-visible { color: var(--accent); }
.shell-nav .store-link { color: var(--accent); font-size: 11px; text-decoration: none; }
.shell-nav .store-link:hover, .shell-nav .store-link:focus-visible { text-decoration: underline; }
.shell-nav .sep { color: #DCD2C4; font-size: 11px; }
.shell-nav .credit { color: var(--muted); font-size: 11px; }
.shell-nav .credit a { color: var(--accent); font-size: 11px; text-decoration: none; }
.shell-nav .credit a:hover { text-decoration: underline; }

/* 広い画面。1行1人のまま、番号とスコアが離れすぎないよう真ん中で分ける
   (スコアだけ右端に貼り付くと、行の真ん中が読むもののない空白になる) */
@media (min-width: 720px) {
	.rank-cols { grid-template-columns: 3em minmax(0, 1fr) minmax(0, 1fr) 5.5em 5em; gap: 12px; }
	.rank-row { padding: 13px 12px; }
	.rank-row .place { font-size: 15px; }
	.rank-row .who { font-size: 15px; }
	.rank-row .who .cc { font-size: 11px; }
	.rank-row .score { font-size: 17px; }
	.rank-row .acc, .rank-row .combo { font-size: 12px; }
	.you-card .place, .you-card .score { font-size: 22px; }
	.you-card .who { font-size: 15px; }
	.tile-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
	.tile.wide { grid-column: auto; }
	.tile .value { font-size: 26px; }
	.stage-title { font-size: clamp(28px, 4vw, 38px); }
}

/* 見出しと説明が1行に入らないと、見出しのほうが縦に割れて読みにくくなる */
@media (max-width: 560px) {
	.sec { display: block; }
	.sec .note { padding-top: 4px; text-align: left; }
}

@media (max-width: 380px) {
	.diffs { gap: 9px; }
	.diff { width: 56px; height: 56px; }
	.rank-cols { grid-template-columns: 26px minmax(0, 1fr) auto 43px 37px; gap: 5px; }
	.site-body, .rank-list, .tile-grid, .fields, .pill-tabs, .stage-hero { padding-left: 14px; padding-right: 14px; }
	.you-card { margin-left: 14px; margin-right: 14px; }
	.tabs { margin-left: 14px; margin-right: 14px; }
}
