/* ==========================================================
   北九州ITクラブ 打っちゃ！寿司タイピング
   カラーは北九州ITクラブのロゴ（青グラデーション＋黄色アクセント）を参照
   ========================================================== */

:root {
  --club-blue-light: #4fa3e3;
  --club-blue: #1f6fb2;
  --club-blue-dark: #124a80;
  --club-yellow: #f7c948;
  --bg: #eef5fb;
  --panel-bg: #ffffff;
  --text-dark: #1b2733;
  --text-light: #ffffff;
  --danger: #e0483e;
  --success: #2fa84f;
  --radius: 14px;
  --shadow: 0 4px 14px rgba(18, 74, 128, 0.18);
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text-dark);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", "Meiryo", sans-serif;
}

body {
  background: #d8ecfa url("../assets/bg-kanmon.svg") center bottom / cover no-repeat fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */
header.app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 14px;
  background: linear-gradient(120deg, var(--club-blue-light), var(--club-blue) 60%, var(--club-blue-dark));
  color: var(--text-light);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 5;
}

/* ヘッダーの中身を「本日のTOP10」カードと同じ幅にそろえる */
header.app-header .header-inner {
  width: 100%;
  max-width: 1028px; /* ゲームパネル（980px）＋左右の余白 */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
header.app-header .header-title { text-align: center; flex: 1; }

header.app-header img.logo {
  height: clamp(56px, 6vw, 86px);
  width: auto;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25));
}

header.app-header h1 {
  font-size: clamp(26px, 3.6vw, 48px);
  margin: 0;
  letter-spacing: 0.02em;
}

header.app-header .accent-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--club-yellow);
  display: inline-block;
  margin: 0 4px;
}

header.app-header .capital-tag {
  font-size: clamp(13px, 1.3vw, 18px);
  font-weight: 700;
  color: var(--club-yellow);
  letter-spacing: 0.08em;
  margin-top: 2px;
}

/* ---------- 本日のTOP10 ---------- */
.leaderboard-card {
  background: linear-gradient(160deg, var(--club-blue-dark), #0b3560);
  color: #fff;
  border-radius: 12px;
  padding: 12px 16px 14px;
  box-shadow: var(--shadow);
  border: 2px solid var(--club-yellow);
}
.leaderboard-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.lb-crown { font-size: 20px; }
.lb-title { font-weight: 800; font-size: 18px; color: var(--club-yellow); letter-spacing: .06em; }
.lb-date { margin-left: auto; font-size: 13px; color: #cfe0ee; font-weight: 700; }
.leaderboard-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(5, auto);
  column-gap: 14px; row-gap: 4px;
}
.lb-row {
  display: grid; grid-template-columns: 26px minmax(4em, 1fr) auto auto; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.08); border-radius: 8px; padding: 5px 10px; font-size: 14px;
}
.lb-rank { font-weight: 800; text-align: center; }
.lb-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-vacant { color: #7f9fbd; font-weight: 400; }
.lb-age { color: #cfe0ee; font-size: 11px; white-space: nowrap; }
.lb-score { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-top1 { background: var(--club-yellow); color: var(--text-dark); }
.lb-top1 .lb-age { color: var(--club-blue-dark); }
.lb-top2 { background: rgba(220, 230, 240, 0.35); }
.lb-top3 { background: rgba(214, 140, 80, 0.35); }
.lb-me { outline: 3px solid #fff; animation: meblink 1s ease-in-out 3; }
@keyframes meblink { 50% { outline-color: var(--club-yellow); } }

/* ---------- layout ---------- */
main.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(90px, 160px) 1fr minmax(90px, 160px);
  gap: 14px;
  padding: 14px;
  align-items: stretch;
}

.ad-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.ad-column .ad-slot {
  background: var(--panel-bg);
  border-radius: 10px;
  box-shadow: var(--shadow);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-column .ad-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ad-column .ad-slot.empty {
  color: #9fb3c5;
  font-size: 11px;
  text-align: center;
  padding: 4px;
  border: 2px dashed #cfe0ee;
  background: #f5f9fd;
}

/* ---------- game panel ---------- */
.game-panel {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(3px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  min-height: 420px;
  gap: 18px;
  justify-content: flex-start;
}

/* ---------- entry screen ---------- */
.screen { width: 100%; max-width: 560px;
}
.screen.screen-wide { max-width: 980px; }
.screen { display: flex; flex-direction: column; gap: 18px; align-items: stretch; }
.screen h2 { text-align: center; color: var(--club-blue-dark); margin: 0 0 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; color: var(--club-blue-dark); }
.field input[type="text"], .field input[type="number"], .field select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid #cfe0ee;
  font-size: 16px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--club-blue); }

.age-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.age-btn {
  padding: 10px 6px;
  border-radius: 8px;
  border: 2px solid #cfe0ee;
  background: #f5f9fd;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--club-blue-dark);
  transition: all .15s ease;
}
.age-btn:hover { border-color: var(--club-blue-light); }
.age-btn.selected {
  background: var(--club-blue);
  border-color: var(--club-blue);
  color: #fff;
}

.duration-note {
  text-align: center;
  font-size: 13px;
  color: var(--club-blue);
  font-weight: 600;
  margin: 0;
}

button.primary {
  padding: 14px 20px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: 30px;
  background: linear-gradient(120deg, var(--club-yellow), #f2a93c);
  color: var(--text-dark);
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.18);
  transition: transform .1s ease;
}
button.primary:hover { transform: translateY(-1px); }
button.primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

button.secondary {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid var(--club-blue);
  border-radius: 24px;
  background: #fff;
  color: var(--club-blue);
  cursor: pointer;
}

/* ---------- play screen ---------- */
.hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--club-blue-dark);
  font-size: 15px;
}
.hud .timer { font-size: 26px; color: var(--danger); font-variant-numeric: tabular-nums; }
.hud .yen { font-size: 26px; color: var(--club-blue); }
.hud .yen span { font-size: 14px; color: var(--text-dark); }

.word-card {
  text-align: center;
  padding: 18px 30px;
  border-radius: 12px;
  background: #f5f9fd;
  border: 2px solid #dceaf6;
  min-width: 260px;
}
.word-card .kana { font-size: clamp(30px, 5vw, 46px); font-weight: 700; color: var(--text-dark); word-break: break-all; }
.word-card { max-width: 100%; }
.word-card .price-tag { margin-top: 6px; font-size: 14px; color: var(--club-blue); font-weight: 600; }
.word-card.rare {
  background: linear-gradient(120deg, #fff7e0, #ffe9b3);
  border-color: var(--club-yellow);
  box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.4);
}
.word-card.rare .kana { color: #a8760a; }

.trivia-box {
  max-width: 480px;
  min-height: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--club-blue-dark);
  background: #eef8f0;
  border: 1px solid #cdeed6;
  border-radius: 10px;
  padding: 0;
  opacity: 0;
  transition: opacity .2s ease;
}
.trivia-box.show {
  opacity: 1;
  padding: 8px 14px;
}

.typing-box {
  font-family: "Courier New", monospace;
  font-size: 28px;
  letter-spacing: 2px;
  padding: 10px 16px;
  border-radius: 8px;
  background: #fff;
  border: 3px solid var(--club-blue-light);
  min-width: 260px;
  min-height: 44px;
  text-align: center;
  color: var(--club-blue-dark);
}
.typing-box.error { border-color: var(--danger); animation: shake .15s; }
.typing-box.success { border-color: var(--success); }

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

.combo-toast {
  position: absolute;
  top: 40%;
  font-size: 22px;
  font-weight: 700;
  color: var(--success);
  opacity: 0;
  pointer-events: none;
}
.combo-toast.show { animation: pop .55s ease forwards; }
@keyframes pop {
  0% { opacity: 0; transform: translateY(10px) scale(.8); }
  30% { opacity: 1; transform: translateY(-10px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-40px) scale(1); }
}

/* ---------- result screen ---------- */
.result-total { font-size: 48px; font-weight: 800; color: var(--club-blue-dark); }
.result-total span { font-size: 20px; }
.result-rank { font-size: 20px; font-weight: 700; color: var(--club-yellow); background: var(--club-blue-dark); padding: 6px 18px; border-radius: 20px; }
.result-stats { display: flex; gap: 24px; justify-content: center; font-size: 14px; color: var(--text-dark); }
.result-stats b { display: block; font-size: 20px; color: var(--club-blue); }

footer.app-footer {
  text-align: center;
  font-size: 12px;
  color: #7690a5;
  padding: 8px 0 14px;
}
footer.app-footer a { color: var(--club-blue); }

/* admin link, small, unobtrusive */
.admin-link {
  position: fixed;
  bottom: 8px;
  right: 10px;
  font-size: 11px;
  color: #b9c9d6;
  text-decoration: none;
}
.admin-link:hover { color: var(--club-blue); }

/* ---------- admin page ---------- */
.admin-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.admin-card {
  background: var(--panel-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.admin-card h2 {
  margin-top: 0;
  color: var(--club-blue-dark);
  border-bottom: 3px solid var(--club-yellow);
  display: inline-block;
  padding-bottom: 4px;
}
.login-box {
  max-width: 360px;
  margin: 60px auto;
  text-align: center;
}
table.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.results-table th, table.results-table td {
  border-bottom: 1px solid #e3edf6;
  padding: 8px 6px;
  text-align: left;
}
table.results-table th { color: var(--club-blue-dark); background: #f5f9fd; }
.table-wrap { max-height: 420px; overflow-y: auto; }

.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.upload-slot {
  border: 2px dashed #cfe0ee;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  background: #f9fcff;
}
.upload-slot img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.upload-slot .placeholder { width: 100%; aspect-ratio: 1/1; display:flex; align-items:center; justify-content:center; color:#9fb3c5; background:#eef5fb; border-radius:6px; margin-bottom:6px; font-size:12px; }
.upload-slot input[type="file"] { font-size: 11px; width: 100%; }
.upload-slot button.remove { margin-top: 4px; font-size: 11px; color: var(--danger); background: none; border: none; cursor: pointer; }

.toolbar { display:flex; gap:10px; flex-wrap: wrap; align-items:center; }
.stat-pill { background:#f5f9fd; border-radius:20px; padding:6px 14px; font-size:13px; font-weight:600; color: var(--club-blue-dark); }

@media (max-width: 720px) {
  header.app-header .header-inner { flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 820px) {
  main.layout { grid-template-columns: 1fr; }
  .ad-column { flex-direction: row; overflow-x: auto; }
  .ad-column .ad-slot { min-width: 90px; }
}

/* ---------- 受付・結果の2カラム ---------- */
#screen-entry { gap: 22px; }
#screen-entry .entry-form { width: 100%; max-width: 560px; margin: 0 auto; }
.entry-form { display: flex; flex-direction: column; gap: 14px; }
.result-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 24px; align-items: center; }
.result-main { display: flex; flex-direction: column; gap: 16px; }
.result-today { font-weight: 800; color: var(--club-blue); margin: 10px 0 0; }
.hint { color: #7690a5; font-size: 18px; font-weight: 600; margin: 0; }
@media (max-width: 1100px) {
  .result-grid { grid-template-columns: 1fr; }
}

/* ---------- 寿司イラスト ---------- */
.word-art { width: 150px; height: 100px; margin: 0 auto 4px; }
.word-art svg { width: 100%; height: 100%; display: block; }
.word-art.arrive { animation: arrive .35s cubic-bezier(.2,1.4,.5,1); }
@keyframes arrive {
  0% { transform: translateX(-120px) rotate(-10deg); opacity: 0; }
  100% { transform: translateX(0) rotate(0); opacity: 1; }
}
.word-card.rare .word-art { animation: arrive .35s, sparkle 1s ease-in-out infinite .35s; }
@keyframes sparkle { 50% { filter: drop-shadow(0 0 10px #f7c948); transform: scale(1.06); } }

.fly-sushi {
  position: fixed; width: 90px; height: 60px; z-index: 50; pointer-events: none;
  animation: fly .85s cubic-bezier(.3,-.4,.6,1) forwards;
}
.fly-sushi svg { width: 100%; height: 100%; }
@keyframes fly {
  0% { transform: translate(0,0) scale(1); opacity: 1; }
  35% { transform: translate(calc(var(--dx) * .3), calc(var(--dy) * .3 - 60px)) scale(1.2) rotate(15deg); }
  100% { transform: translate(var(--dx), var(--dy)) scale(.2) rotate(360deg); opacity: 0; }
}

/* ---------- 回転寿司レーン ---------- */
.sushi-lane {
  width: 100%; overflow: hidden; margin-top: 6px;
  background: repeating-linear-gradient(90deg, #c9d6e2 0 38px, #b8c7d5 38px 40px);
  border-top: 6px solid #8aa3b8; border-bottom: 6px solid #8aa3b8; border-radius: 6px;
  padding: 6px 0;
}
.lane-track { display: flex; width: max-content; animation: lane 18s linear infinite; }
.lane-plate { width: 110px; height: 72px; flex-shrink: 0; margin-right: 24px; }
.lane-plate svg { width: 100%; height: 100%; }
.lane-plate:nth-child(odd) { animation: bob 1.6s ease-in-out infinite; }
@keyframes lane { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes bob { 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .lane-track, .lane-plate, .word-art, .fly-sushi { animation: none !important; }
}

/* ---------- BeWithロゴ ---------- */
header.app-header .partner {
  display: flex; align-items: center;
  background: #fff; border-radius: 10px; padding: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
header.app-header .partner-logo { height: clamp(56px, 6vw, 86px); width: auto; display: block; }

.tts-sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 10px; }

/* ---------- 名所・ラッキーモード ---------- */
.word-label { font-size: clamp(30px, 5vw, 46px); font-weight: 800; color: var(--club-blue-dark); line-height: 1.2; }
.word-card.with-label .kana { font-size: clamp(18px, 2.6vw, 26px); color: var(--club-blue); font-weight: 600; }
.word-card.place { background: linear-gradient(160deg, #f5f9fd, #e3f0fb); border-color: var(--club-blue-light); }
.word-romaji {
  font-family: "Courier New", monospace;
  font-size: 38px; font-weight: 700; color: #5c7c94;
  letter-spacing: 2px; margin-top: 6px;
  max-width: 100%; word-break: break-all; line-height: 1.15;
}
.lucky-banner {
  background: linear-gradient(90deg, #d9362b, #f7c948, #d9362b);
  background-size: 200% 100%;
  color: #fff; font-weight: 900; font-size: 18px; letter-spacing: .05em;
  padding: 6px 18px; border-radius: 20px; text-shadow: 0 1px 2px rgba(0,0,0,.35);
  animation: luckyflow 1.5s linear infinite;
}
@keyframes luckyflow { to { background-position: 200% 0; } }

/* ---------- 難関問題 ---------- */
.word-card.hard {
  background: linear-gradient(160deg, #eef2f5, #cfd8e0);
  border-color: #7d8b98;
  box-shadow: 0 0 0 3px rgba(125, 139, 152, 0.35);
}
.word-card.hard .word-label { color: #1b2733; }
.word-card.hard .kana { font-size: clamp(16px, 2.2vw, 22px); color: #4a5a68; }
.word-card.hard .price-tag::before { content: "難関！ "; color: #d9362b; font-weight: 900; }

/* ---------- 写真つき問題 ---------- */
.word-art.photo { width: auto; height: 220px; }
.word-art.photo img {
  height: 100%; width: auto; max-width: 360px; object-fit: cover; display: block; margin: 0 auto;
  border-radius: 10px; border: 4px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
