Add admin role with an admin-only hand range study page

- Optional ADMIN_KEY (6 digits, distinct from ACCESS_KEY): entering it on the
  key screen signs in as admin (role-specific HMAC cookie; member cookies
  stay valid). Logged-in members can open /key?admin to enter it.
- /range (range chart + color/category quiz, ported from poker-hand and
  restyled to the site design) and its files under admin/ are served only to
  admins; everyone else gets 404. Card images cached privately for a day.
- Lobby shows a link to the page for admins only (GET /api/me).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
agomizi1cmandClaude Opus 5.5 committed 2026-10-16 12:13:14 +09:00
1 parent 1e1ac4e91d
commit e89d867f85
64 files changed
+477 -19

No files matched your search

+82
View File
@@ -0,0 +1,82 @@
/* ハンドレンジ学習(管理者専用)。基本のデザインは /assets/style.css を使う */
.range-wrap { padding-bottom: 32px; }
/* タブ */
.seg { display: flex; gap: 6px; background: var(--panel); border-radius: 12px; padding: 4px; margin: 12px 0 16px; }
.seg-btn {
flex: 1;
font: inherit;
font-size: 15px;
font-weight: 800;
border: 0;
border-radius: 9px;
padding: 10px 6px;
background: transparent;
color: var(--muted);
cursor: pointer;
}
.seg-btn.active { background: var(--panel-2); color: var(--text); }
/* レンジ表の分類ごとの色(レンジ表のデータとしての色なのでサイトの配色とは別) */
.cat-navy { --c: #20365d; --fg: #fff; }
.cat-red { --c: #9e342e; --fg: #fff; }
.cat-yellow { --c: #ddb356; --fg: #14191f; }
.cat-green { --c: #4e8051; --fg: #101910; }
.cat-blue { --c: #6aa5c9; --fg: #14191f; }
.cat-white { --c: #f7f7f7; --fg: #222; }
.cat-gray, .cat-purple { --c: #929292; --fg: #222; }
/* 13×13 の表 */
.range-matrix { display: grid; grid-template-columns: repeat(13, 1fr); gap: 2px; }
.range-cell {
aspect-ratio: 1;
min-width: 0;
padding: 0;
border: 0;
border-radius: 3px;
background: var(--c);
color: var(--fg);
font: inherit;
font-size: clamp(8px, 2.4vw, 12px);
font-weight: 800;
letter-spacing: -0.04em;
cursor: pointer;
position: relative;
}
.range-cell.cat-purple { box-shadow: inset 0 0 0 2px #c12cff; }
.range-cell.selected { outline: 2px solid var(--gold); outline-offset: 1px; z-index: 1; }
/* 凡例 */
.range-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.range-legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch-dot { width: 14px; height: 14px; border-radius: 4px; background: var(--c); flex: none; }
.swatch-dot.cat-purple { box-shadow: inset 0 0 0 2px #c12cff; }
/* 選択したハンド */
.sel-hand { font-size: 28px; font-weight: 900; line-height: 1.1; }
.sel-label { display: flex; align-items: center; gap: 8px; font-weight: 800; margin-top: 6px; }
/* クイズ */
.quiz-progress { height: 6px; background: var(--input); border-radius: 999px; overflow: hidden; margin: 16px 0 8px; }
.quiz-progress i { display: block; height: 100%; width: 0; background: var(--green); transition: width 0.2s; }
.quiz-stats { display: flex; justify-content: center; gap: 12px; font-size: 13px; color: var(--muted); }
.quiz-hand { text-align: center; margin: 12px 0; padding: 18px 12px; }
.quiz-cards { display: flex; justify-content: center; gap: 10px; min-height: 0; }
.quiz-cards img { width: min(32%, 120px); height: auto; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4)); }
.quiz-hand-name { font-size: 40px; font-weight: 900; margin-top: 8px; line-height: 1.1; }
.quiz-answers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.quiz-answers .btn {
font-size: 15px;
padding: 12px 8px;
justify-content: flex-start;
background: var(--panel-2);
color: var(--text);
border: 2px solid transparent;
}
.quiz-answers .btn:disabled { opacity: 1; }
.quiz-answers .btn.correct { border-color: var(--green); background: rgba(46, 204, 113, 0.18); }
.quiz-answers .btn.wrong { border-color: var(--red); background: rgba(255, 90, 90, 0.15); }
.quiz-feedback { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--panel); font-size: 14px; }
.quiz-feedback.good { box-shadow: inset 0 0 0 2px var(--green); }
.quiz-feedback.bad { box-shadow: inset 0 0 0 2px var(--red); }