/* ===== HeroUI 風デザイントークン =====
   本物のHeroUI(React+Tailwind)は使わず、配色・角丸・シャドウなどの
   デザイン言語だけを素のCSSで再現（ビルド不要の構成を維持するため）。 */
:root {
  --primary: #006FEE;      /* HeroUI default: primary */
  --primary-ink: #ffffff;
  --primary-tint: #E6F1FE; /* primary-50 */
  --secondary: #7828C8;    /* HeroUI default: secondary */
  --secondary-tint: #F2EAFA;
  --success: #17C964;
  --success-tint: #E8FAF0;
  --warning: #F5A524;
  --warning-tint: #FEF4E4;
  --danger: #F31260;
  --danger-tint: #FDECF1;

  --bg: #FAFAFA;           /* HeroUI page background */
  --card: #FFFFFF;         /* content1 */
  --card-2: #F4F4F5;       /* content2 / zinc-100 */
  --ink: #11181C;          /* foreground */
  --ink-2: #71717A;        /* default-500 */
  --line: #E4E4E7;         /* default-200 */

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
  --shadow: 0 2px 6px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 20px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.01em;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ===== オンボーディング ===== */
.onboarding {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--primary);
  color: #fff;
  padding: calc(var(--safe-top) + 8px) 22px calc(var(--safe-bot) + 24px);
}
.ob-hero { text-align: center; padding: 40px 0 26px; }
.ob-logo {
  font-size: 52px; line-height: 1; width: 96px; height: 96px; margin: 0 auto;
  display: grid; place-items: center; background: rgba(255,255,255,.16);
  border-radius: var(--radius-xl);
}
.ob-hero h1 { font-size: 30px; margin: 18px 0 6px; letter-spacing: -.02em; font-weight: 800; }
.ob-tag { margin: 0; opacity: .88; font-size: 14px; }
.ob-form {
  background: var(--card); color: var(--ink);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  margin: auto -22px calc(var(--safe-bot) * -1 - 24px);
  padding: 26px 22px calc(var(--safe-bot) + 28px);
  box-shadow: var(--shadow-lg);
}
.field { display: block; margin-bottom: 20px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.field input[type=text] {
  width: 100%; padding: 14px 16px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card-2);
  color: var(--ink);
  transition: border-color .15s, background .15s;
}
.field input[type=text]:focus { outline: none; border-color: var(--primary); background: var(--card); }
.team-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 12px; border-radius: var(--radius);
  border: 1.5px solid var(--line); background: var(--card);
  font-size: 14px; font-weight: 600; text-align: left; color: var(--ink);
  transition: transform .1s, border-color .15s, box-shadow .15s;
}
.team-chip .em { font-size: 22px; }
.team-chip.sel { border-color: var(--tc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 18%, transparent); }
.btn-primary {
  width: 100%; padding: 15px; border-radius: var(--radius);
  background: var(--primary); color: #fff; font-size: 16px; font-weight: 600;
  box-shadow: var(--shadow); transition: transform .1s, opacity .15s, background .15s;
}
.btn-primary:active { transform: scale(.98); background: color-mix(in srgb, var(--primary) 88%, black); }
.btn-primary:disabled { opacity: .4; box-shadow: none; }
.ob-note { font-size: 12px; color: var(--ink-2); text-align: center; margin: 16px 0 0; }

/* ===== アプリ骨格 ===== */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 18px 12px;
  background: var(--card); color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.hdr-left { display: flex; align-items: center; gap: 11px; }
.team-dot { width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 17px; background: var(--card-2); }
.hdr-title { font-size: 17px; font-weight: 700; }
.hdr-sub { font-size: 12px; color: var(--ink-2); margin-top: 1px; }
.hdr-points { text-align: right; line-height: 1; background: var(--primary-tint); color: var(--primary); padding: 7px 12px; border-radius: 999px; }
.hdr-points span { font-size: 16px; font-weight: 800; }
.hdr-points small { font-size: 11px; font-weight: 600; margin-left: 2px; }

.screens { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 96px; }
.screen { padding: 16px; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== ミッション ===== */
.rank-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px;
  box-shadow: var(--shadow-sm); margin-bottom: 14px;
}
.rank-banner .big { font-size: 26px; font-weight: 800; line-height: 1; }
.rank-banner .lbl { font-size: 12px; color: var(--ink-2); }
.rank-banner .sep { width: 1px; align-self: stretch; background: var(--line); }
.rank-banner .prog { flex: 1; }
.prog-bar { height: 8px; border-radius: 999px; background: var(--card-2); overflow: hidden; margin-top: 6px; }
.prog-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width .5s ease; }

.seg { display: flex; gap: 2px; background: var(--card-2); padding: 4px; border-radius: var(--radius); margin-bottom: 14px; }
.seg-btn { flex: 1; padding: 9px 4px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--ink-2); transition: .15s; }
.seg-btn.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow-sm); }

.mission-list { display: flex; flex-direction: column; gap: 10px; }
.m-card {
  display: flex; align-items: center; gap: 13px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px;
  box-shadow: var(--shadow-sm); transition: transform .1s, box-shadow .15s;
  position: relative; overflow: hidden;
}
.m-card:active { transform: scale(.985); }
.m-card.done { opacity: .65; }
.m-ico { width: 44px; height: 44px; border-radius: var(--radius); display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.m-ico.quiz { background: var(--secondary-tint); } .m-ico.qr { background: var(--primary-tint); } .m-ico.photo { background: var(--danger-tint); }
.m-main { flex: 1; min-width: 0; }
.m-title { font-size: 15px; font-weight: 600; }
.m-meta { font-size: 12px; color: var(--ink-2); margin-top: 3px; display: flex; align-items: center; gap: 8px; }
.m-pts { font-weight: 700; color: var(--primary); }
.m-right { flex-shrink: 0; }
.chev { color: var(--ink-2); font-size: 20px; opacity: .5; }
.done-badge { background: var(--success-tint); color: #0d8a48; font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 999px; }

/* ===== フィード ===== */
.feed-list { display: flex; flex-direction: column; gap: 14px; }
.post { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-sm); }
.post-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.post-ava { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; font-size: 17px; color: #fff; flex-shrink: 0; }
.post-who { font-size: 14px; font-weight: 600; }
.post-sub { font-size: 12px; color: var(--ink-2); }
.post-img { aspect-ratio: 4/3; display: grid; place-items: center; font-size: 64px; color: rgba(255,255,255,.9); }
.post-img img { width: 100%; height: 100%; object-fit: cover; }
.post-body { padding: 11px 14px 14px; }
.post-cap { font-size: 14px; margin: 0 0 10px; }
.post-actions { display: flex; align-items: center; gap: 6px; }
.like-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 6px 10px; border-radius: 999px; background: var(--card-2); }
.like-btn.on { color: var(--danger); background: var(--danger-tint); }
.like-btn .heart { font-size: 16px; transition: transform .2s; }
.like-btn.on .heart { transform: scale(1.15); }
.best-tag { margin-left: auto; background: var(--warning-tint); color: #92610a; font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 999px; }

/* ===== ランキング ===== */
.live-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); padding: 7px 12px; border-radius: 999px; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(23,201,100,.5); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(23,201,100,.5)} 70%{box-shadow:0 0 0 8px rgba(23,201,100,0)} 100%{box-shadow:0 0 0 0 rgba(23,201,100,0)} }
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 13px 15px;
  box-shadow: var(--shadow-sm); transition: transform .5s ease;
}
.rank-row.mine { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-sm); }
.rank-pos { font-size: 16px; font-weight: 700; width: 28px; text-align: center; flex-shrink: 0; color: var(--ink-2); }
.rank-pos.top { font-size: 22px; }
.rank-em { font-size: 24px; flex-shrink: 0; }
.rank-mid { flex: 1; min-width: 0; }
.rank-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.rank-me-tag { font-size: 10px; font-weight: 700; color: var(--primary); background: var(--primary-tint); padding: 2px 8px; border-radius: 999px; }
.rank-bar { height: 6px; border-radius: 999px; background: var(--card-2); overflow: hidden; margin-top: 7px; }
.rank-bar > i { display: block; height: 100%; border-radius: 999px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.rank-pts { font-size: 16px; font-weight: 700; flex-shrink: 0; }
.rank-pts small { font-size: 11px; font-weight: 500; color: var(--ink-2); }

/* ===== お知らせ ===== */
.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 15px; box-shadow: var(--shadow-sm); border-left: 3px solid var(--line); }
.news-card.high { border-left-color: var(--danger); }
.news-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.news-title { font-size: 15px; font-weight: 700; }
.news-time { font-size: 11px; color: var(--ink-2); margin-left: auto; flex-shrink: 0; }
.news-pin { font-size: 10px; font-weight: 700; color: var(--danger); background: var(--danger-tint); padding: 2px 8px; border-radius: 999px; }
.news-body { font-size: 13px; color: var(--ink-2); line-height: 1.6; margin: 0; }

/* ===== マイページ ===== */
.me-pane { display: flex; flex-direction: column; gap: 14px; }
.me-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 20px; box-shadow: var(--shadow-sm); text-align: center; }
.me-ava { width: 68px; height: 68px; border-radius: 999px; display: grid; place-items: center; font-size: 32px; color: #fff; margin: 0 auto 12px; }
.me-name { font-size: 19px; font-weight: 700; }
.me-team { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.me-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.me-stat { background: var(--card-2); border-radius: var(--radius); padding: 12px 6px; }
.me-stat b { display: block; font-size: 20px; font-weight: 800; color: var(--primary); }
.me-stat span { font-size: 11px; color: var(--ink-2); }
.me-btn { width: 100%; padding: 14px; border-radius: var(--radius-lg); background: var(--card); border: 1px solid var(--line); font-size: 15px; font-weight: 600; color: var(--ink); text-align: left; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-sm); }
.me-btn .ar { margin-left: auto; color: var(--ink-2); opacity: .5; }

/* ===== ボトムナビ ===== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: rgba(255,255,255,.9); backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(var(--safe-bot) + 6px);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 10px; font-weight: 600; color: var(--ink-2); position: relative; }
.tab .tab-ico { font-size: 20px; filter: grayscale(.5); opacity: .55; transition: .15s; }
.tab.active { color: var(--primary); }
.tab.active .tab-ico { filter: none; opacity: 1; }
.tab.active::before { content: ''; position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 20px; height: 3px; border-radius: 999px; background: var(--primary); }
.badge { position: absolute; top: 0px; right: 50%; margin-right: -22px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: center; }

/* ===== シート（モーダル） ===== */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(17,24,28,.4); animation: fade .2s; }
.sheet {
  position: relative; width: 100%; max-width: 520px;
  background: var(--bg); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 92dvh; overflow-y: auto;
  padding: 10px 18px calc(var(--safe-bot) + 22px);
  animation: slideUp .28s cubic-bezier(.2,.8,.2,1);
  box-shadow: var(--shadow-lg);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grip { width: 36px; height: 4px; border-radius: 999px; background: var(--line); margin: 4px auto 14px; }
.sheet h2 { font-size: 19px; margin: 0 0 4px; font-weight: 700; }
.sheet .sub { font-size: 13px; color: var(--ink-2); margin: 0 0 18px; }

/* クイズ */
.choices { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.choice { padding: 15px 16px; border-radius: var(--radius); background: var(--card); border: 1.5px solid var(--line); font-size: 15px; font-weight: 500; text-align: left; transition: .12s; }
.choice.correct { border-color: var(--success); background: var(--success-tint); color: #0d8a48; }
.choice.wrong { border-color: var(--danger); background: var(--danger-tint); color: #b3134f; }
.choice:disabled { opacity: 1; }
.q-result { text-align: center; padding: 8px 0 4px; font-weight: 700; font-size: 16px; }
.q-result.ok { color: var(--success); } .q-result.no { color: var(--danger); }

/* 写真ミッション */
.photo-brief { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow-sm); margin-bottom: 16px; font-size: 14px; line-height: 1.6; }
.photo-drop { aspect-ratio: 4/3; border-radius: var(--radius-lg); border: 1.5px dashed var(--line); display: grid; place-items: center; text-align: center; color: var(--ink-2); background: var(--card); overflow: hidden; }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.cam-hint { font-size: 36px; }
.cap-input { width: 100%; padding: 13px 14px; font-size: 15px; border: 1.5px solid var(--line); border-radius: var(--radius); margin: 14px 0; background: var(--card); color: var(--ink); }

/* QRチェックイン */
.qr-scan { aspect-ratio: 1; max-width: 260px; margin: 8px auto 18px; border-radius: var(--radius-xl); background: #11181C; position: relative; overflow: hidden; display: grid; place-items: center; }
.qr-frame { width: 62%; aspect-ratio: 1; border: 3px solid #fff; border-radius: var(--radius-lg); position: relative; }
.qr-line { position: absolute; left: 6%; right: 6%; height: 3px; background: var(--success); box-shadow: 0 0 12px var(--success); animation: scan 2s ease-in-out infinite; }
@keyframes scan { 0%,100%{ top: 8%; } 50%{ top: 88%; } }
.qr-cam-lbl { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.8); font-size: 12px; }
.info-box { background: var(--primary-tint); color: #004a9e; border-radius: var(--radius); padding: 12px 14px; font-size: 13px; line-height: 1.6; margin-bottom: 16px; }

.sheet .btn-primary { margin-top: 6px; }
.btn-ghost { width: 100%; padding: 14px; border-radius: var(--radius); background: transparent; color: var(--ink-2); font-size: 15px; font-weight: 600; }

/* 運営モード */
.admin-field { margin-bottom: 14px; }
.admin-field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.admin-field input, .admin-field textarea, .admin-field select { width: 100%; padding: 12px 14px; font-size: 15px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); }
.admin-field textarea { min-height: 74px; resize: vertical; }

/* トースト */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bot) + 88px); transform: translateX(-50%);
  z-index: 90; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); max-width: 88%; text-align: center;
  animation: toastIn .3s cubic-bezier(.2,.8,.2,1);
}
.toast.pts { background: var(--primary); }
@keyframes toastIn { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* 花吹雪 */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; opacity: .9; animation: fall 1.5s linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: 0; } }

@media (prefers-color-scheme: dark) {
  :root {
    --bg:#000000; --card:#18181B; --card-2:#27272A;
    --ink:#ECEDEE; --ink-2:#A1A1AA; --line:#3F3F46;
    --primary-tint:#0A2540; --secondary-tint:#2A1745; --success-tint:#0B2E1D; --warning-tint:#3A2A0A; --danger-tint:#3A0A1A;
    --shadow-sm:0 1px 2px rgba(0,0,0,.4); --shadow:0 2px 8px rgba(0,0,0,.5); --shadow-lg:0 10px 26px rgba(0,0,0,.6);
  }
  .app-header { background: var(--card); border-color: var(--line); }
  .tabbar { background: rgba(24,24,27,.9); }
  .info-box { color: #8ec4ff; }
  .rank-me-tag { color: #8ec4ff; }
}
