/* ===========================================================
   Self Game — Home Screen (Static UI)
   Theme: dark + neon, inspired by football game UI
   =========================================================== */

:root {
  --bg-0: #050912;
  --bg-1: #0b1224;
  --bg-2: #121b33;
  --bg-card: rgba(20, 28, 52, 0.85);
  --border: rgba(120, 160, 255, 0.14);
  --border-strong: rgba(120, 160, 255, 0.28);

  --text: #f3f6ff;
  --text-mute: #9aa7c7;
  --text-dim: #5d6a8a;

  --cyan:    #1fd4ff;
  --magenta: #ff2e7e;
  --purple:  #b14cff;
  --green:   #44d57b;
  --orange:  #ff9a2e;
  --gold:    #ffd24a;
  --red:     #ff5566;
  --silver:  #d8dff0;

  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 24px rgba(31, 212, 255, 0.18);

  /* Easing — strong custom curves (built-in ease* are too weak) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

* { box-sizing: border-box; }

/* ensure [hidden] always wins over component display rules */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(31, 212, 255, 0.10), transparent 60%),
    radial-gradient(700px 500px at 110% 20%, rgba(177, 76, 255, 0.10), transparent 60%),
    linear-gradient(180deg, #06091a 0%, #050912 60%, #03060f 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Yu Gothic UI", "Noto Sans JP", "Meiryo", sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(64px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  position: relative;
}

/* views — invisible wrapper that lets children inherit .app layout */
.view { display: contents; }
.view[hidden] { display: none; }

/* ===========================================================
   Top bar (asset / budget / unlocked / frozen)
   =========================================================== */
.topbar {
  background: linear-gradient(180deg, rgba(11, 18, 36, 0.95), rgba(8, 13, 28, 0.85));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px 12px;
  box-shadow: var(--shadow-lg);
}

.topbar__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stat {
  flex: 1 1 0;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0));
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
}

.stat__icon {
  font-size: 22px;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.25));
}

.stat__body {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.stat__label {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}

.stat__value {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.stat--asset    .stat__value { color: var(--silver); }
.stat--budget   .stat__value { color: var(--cyan);   text-shadow: 0 0 12px rgba(31,212,255,0.35); }
.stat--unlocked .stat__value { color: var(--gold);   text-shadow: 0 0 12px rgba(255,210,74,0.35); }
.stat--frozen   .stat__value { color: var(--text-dim); }

.topbar__icons {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  transition: transform 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { transform: translateY(-1px); }
}
.icon-btn:active { transform: scale(0.94); }

.icon-btn__emoji { font-size: 18px; }

.icon-btn__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--bg-0);
}
.icon-btn__badge--neutral { background: var(--orange); }

/* gauge */
.gauge {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.gauge__bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.gauge__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--purple) 70%, var(--magenta));
  box-shadow: 0 0 14px rgba(31,212,255,0.5);
  transition: width 700ms var(--ease-out);
}
.gauge__text {
  font-size: 12px;
  color: var(--text-mute);
  white-space: nowrap;
}
.gauge__text strong {
  color: var(--text);
  font-size: 13px;
}

/* ===========================================================
   Tabs
   =========================================================== */
.tabs {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 4px;
  background: rgba(15, 22, 44, 0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  backdrop-filter: blur(6px);
}
.tabs__item {
  flex: 1;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--text-mute);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  position: relative;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .tabs__item:hover { color: var(--text); }
}
.tabs__item:active { transform: scale(0.97); }
.tabs__item.is-active {
  background: linear-gradient(180deg, #2a3252, #1a2140);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-strong), 0 4px 14px rgba(0,0,0,0.4);
}
.tabs__dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.tabs__dot--alert { background: var(--magenta); box-shadow: 0 0 8px var(--magenta); }
.tabs__dot--info  { background: var(--orange);  box-shadow: 0 0 8px var(--orange);  }

/* ===========================================================
   Banner
   =========================================================== */
.banner {
  position: relative;
  margin-top: 16px;
  border-radius: 22px;
  overflow: hidden;
  min-height: 180px;
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.banner__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 240px at 80% 20%, rgba(255, 46, 126, 0.55), transparent 65%),
    radial-gradient(700px 300px at 100% 100%, rgba(177, 76, 255, 0.55), transparent 65%),
    linear-gradient(135deg, #2b0e3b 0%, #14163a 60%, #060a1a 100%);
}
.banner__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(115deg, transparent 38%, rgba(255,255,255,0.06) 39%, transparent 41%),
    linear-gradient(115deg, transparent 55%, rgba(255,255,255,0.04) 56%, transparent 58%);
}

.banner__content {
  position: relative;
  z-index: 1;
  padding: 22px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.banner__title {
  font-size: 30px;
  font-weight: 900;
  margin: 0;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.banner__period {
  margin: 0;
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.banner__period span { color: var(--gold); }
.banner__lead {
  margin: 8px 0 0;
  color: #e2e8ff;
  font-size: 13px;
  line-height: 1.6;
}
.banner__lead strong {
  color: var(--gold);
  font-size: 16px;
}

.banner__side {
  position: relative;
  z-index: 1;
  width: 130px;
  display: grid;
  place-items: center;
  padding-right: 20px;
}
.banner__card {
  width: 96px;
  height: 130px;
  border-radius: 14px;
  background: linear-gradient(160deg, #1f2a55, #0a1130);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 12px 24px rgba(0,0,0,0.5), 0 0 24px rgba(31,212,255,0.15);
}
.banner__card-rank {
  font-size: 38px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(31,212,255,0.6);
  line-height: 1;
}
.banner__card-label {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.06em;
}

/* ===========================================================
   5 Action buttons
   =========================================================== */
.actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.action {
  position: relative;
  padding: 18px 8px 14px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: white;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 18px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out), filter 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .action:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.2);
  }
}
.action:active {
  transform: scale(0.97);
  filter: brightness(0.95);
}

.action__icon {
  font-size: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.action__label {
  font-size: 13px;
}

.action--match    { background: linear-gradient(180deg, #2fd0e0, #1aa5b8); }
.action--team     { background: linear-gradient(180deg, #ff4d7f, #d12a5d); }
.action--contract { background: linear-gradient(180deg, #b966ff, #7b39c4); }
.action--mission  { background: linear-gradient(180deg, #66e07a, #2fa64a); }
.action--bonus    { background: linear-gradient(180deg, #ffb14a, #e07d18); }

.action__pip {
  position: absolute;
  top: 8px; right: 10px;
  min-width: 20px; height: 20px;
  border-radius: 10px;
  padding: 0 6px;
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.4);
}
.action__pip--num { background: var(--red); }

.action__tag {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ffd24a, #ff9a2e);
  color: #1a1100;
  font-size: 10px;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(255,154,46,0.35);
}

/* ===========================================================
   Today's Best 3
   =========================================================== */
.block {
  margin-top: 22px;
}

.block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 10px;
}
.block__title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.block__title::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 14px;
  background: linear-gradient(180deg, var(--cyan), var(--purple));
  border-radius: 2px;
  margin-right: 8px;
  vertical-align: -2px;
  box-shadow: 0 0 8px rgba(31,212,255,0.6);
}
.block__hint {
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
}

.missions {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mission {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 160ms var(--ease-out), transform 160ms var(--ease-out);
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .mission:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
  }
}
.mission:active { transform: scale(0.99); }

.mission__delete {
  width: 30px;
  height: 30px;
  margin: -4px -6px -4px 0;   /* trim the gap a little so it hugs the right edge */
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms var(--ease-out), background 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .mission__delete:hover {
    color: var(--red, #ff5d73);
    background: rgba(255, 93, 115, 0.1);
    border-color: rgba(255, 93, 115, 0.4);
  }
}
.mission__delete:active { transform: scale(0.88); }

.mission__rank {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #2a3252, #1a2140);
  font-weight: 900;
  color: var(--cyan);
  font-size: 16px;
  box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: background 200ms var(--ease-out), color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.mission__rank-num {
  transition: opacity 160ms var(--ease-out), transform 200ms var(--ease-out);
}
.mission__check {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  color: #ffffff;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 200ms var(--ease-out), transform 260ms var(--ease-out);
}

.mission--done {
  opacity: 0.55;
}
.mission--done .mission__title {
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.4);
}
.mission--done .mission__rank {
  background: linear-gradient(180deg, #2fa64a, #1e7d36);
  color: white;
  box-shadow: inset 0 0 0 1px rgba(80, 220, 130, 0.5), 0 0 14px rgba(68, 213, 123, 0.35);
}
.mission--done .mission__rank-num {
  opacity: 0;
  transform: scale(0.6);
}
.mission--done .mission__check {
  opacity: 1;
  transform: scale(1);
}
.mission--done .mission__amount {
  color: var(--green);
  text-shadow: 0 0 10px rgba(68, 213, 123, 0.4);
}

.mission__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.mission__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.mission__meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-mute);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.chip--diff { color: var(--gold); }
.chip--skill {
  color: var(--cyan);
  border-color: rgba(31, 212, 255, 0.3);
  background: rgba(31, 212, 255, 0.08);
}

.mission__reward {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.mission__amount {
  color: var(--gold);
  font-weight: 900;
  font-size: 16px;
  text-shadow: 0 0 10px rgba(255,210,74,0.4);
}
.mission__penalty {
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
  min-height: 14px;
}

/* ===========================================================
   Summary cards
   =========================================================== */
.summary {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.summary__card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary__label {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
.summary__value {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
}
.summary__sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* ===========================================================
   Reward splash — floating "+¥XXX" on mission completion
   =========================================================== */
.reward-splash {
  position: absolute;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -50%);
  color: var(--gold);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.02em;
  text-shadow: 0 0 12px rgba(255, 210, 74, 0.6), 0 2px 8px rgba(0,0,0,0.5);
  animation: reward-splash 900ms var(--ease-out) forwards;
  will-change: transform, opacity;
}
@keyframes reward-splash {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
  20%  { opacity: 1; transform: translate(-50%, -70%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -180%) scale(1); }
}

/* ===========================================================
   Footer — discreet reset link
   =========================================================== */
.footer {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 10px;
}
.reset-link--danger { color: #6b3a44; }
@media (hover: hover) and (pointer: fine) {
  .reset-link--danger:hover { color: var(--red, #ff5d73); border-color: rgba(255,93,115,0.4); }
}
.reset-link {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .reset-link:hover {
    color: var(--text-mute);
    border-color: var(--border);
  }
}
.reset-link:active { transform: scale(0.97); }

/* ===========================================================
   Backup / Restore modal
   =========================================================== */
.backup { display: flex; flex-direction: column; gap: 18px; }
.backup__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
}
.backup__heading {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.backup__summary { margin: 0; font-size: 11px; color: var(--cyan); font-weight: 700; }
.backup__hint { margin: 0; font-size: 11px; color: var(--text-mute); line-height: 1.6; }
.backup__text {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-mute);
  background: #05060f;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.backup__btns { display: flex; gap: 8px; }
.backup__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .backup__btn:hover { background: rgba(255,255,255,0.07); border-color: var(--border-strong); }
}
.backup__btn:active { transform: scale(0.97); }
.backup__btn--accent {
  border-color: transparent;
  background: linear-gradient(180deg, #2fd0e0, #1aa5b8);
  color: #fff;
}
.backup__btn--file { position: relative; }
.backup__note { margin: 0; font-size: 12px; font-weight: 700; min-height: 1.2em; text-align: center; }
.backup__note.is-ok  { color: #46d39a; }
.backup__note.is-err { color: var(--red, #ff5d73); }

/* ===========================================================
   Team screen — マイチーム
   =========================================================== */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2a3252, #1a2140);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 1px solid var(--border-strong);
  transition: transform 160ms var(--ease-out);
}
.back-btn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .back-btn:hover { background: linear-gradient(180deg, #34406b, #1f2855); }
}

.screen-title {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.team-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 14px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(91, 64, 18, 0.9), rgba(42, 29, 5, 0.9));
  border: 1px solid rgba(255, 210, 74, 0.4);
  box-shadow: 0 0 16px rgba(255, 210, 74, 0.15);
}
.team-rating__label {
  font-size: 9px;
  color: rgba(255, 210, 74, 0.85);
  font-weight: 800;
  letter-spacing: 0.08em;
}
.team-rating__value {
  font-size: 22px;
  font-weight: 900;
  color: var(--gold);
  line-height: 1.05;
  text-shadow: 0 0 12px rgba(255, 210, 74, 0.4);
}

/* team mode toggle (習慣 / 知識) — top-level filter above position tabs */
.team-mode {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 4px 0 10px;
}
.team-mode__btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: 9px;
  background: transparent;
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.team-mode__btn.is-active {
  background: linear-gradient(180deg, #1a2548, #131c38);
  color: var(--cyan);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 14px rgba(31, 212, 255, 0.18);
}
.team-mode__btn--knowledge.is-active {
  color: var(--gold);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 14px rgba(255, 210, 74, 0.22);
}
@media (hover: hover) and (pointer: fine) {
  .team-mode__btn:not(.is-active):hover { color: var(--text); background: rgba(255,255,255,0.04); }
}
.team-mode__btn:active { transform: scale(0.97); }

/* お金 (knowledge pool) cards — show the pool label in gold to match the theme */
.player-card[data-pool="money"] .player-card__position {
  color: rgba(255, 210, 74, 0.85);
  text-shadow: 0 0 8px rgba(255, 210, 74, 0.25);
}

/* filter tabs */
.filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.filter-tab.is-active {
  background: linear-gradient(180deg, #2a3252, #1a2140);
  color: var(--cyan);
  border-color: rgba(31, 212, 255, 0.4);
  box-shadow: 0 0 14px rgba(31, 212, 255, 0.18);
}
.filter-tab:active { transform: scale(0.97); }

/* card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

/* player card */
.player-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}

.player-card--gold {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 210, 74, 0.22), transparent 60%),
    linear-gradient(160deg, #5a3f10 0%, #2b1d05 50%, #18120c 100%);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 210, 74, 0.5),
    0 0 22px rgba(255, 210, 74, 0.12);
}
.player-card--silver {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(216, 223, 240, 0.16), transparent 60%),
    linear-gradient(160deg, #2f364c 0%, #181d2e 50%, #0c0f1a 100%);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(216, 223, 240, 0.32);
}
.player-card--locked {
  background:
    repeating-linear-gradient(135deg, rgba(120, 160, 255, 0.04) 0 8px, transparent 8px 16px),
    linear-gradient(160deg, rgba(40, 48, 70, 0.4), rgba(15, 20, 38, 0.4));
  border: 1px dashed var(--border-strong);
  box-shadow: none;
  opacity: 0.85;
}
.player-card--locked .player-card__rating,
.player-card--locked .player-card__name,
.player-card--locked .player-card__level,
.player-card--locked .player-card__position {
  color: var(--text-mute);
}
.player-card--locked .player-card__art {
  color: var(--text-mute);
  font-weight: 900;
  font-size: 40px;
}

@media (hover: hover) and (pointer: fine) {
  .player-card:hover {
    transform: translateY(-3px);
    box-shadow:
      0 14px 28px rgba(0, 0, 0, 0.55),
      inset 0 0 0 1px rgba(255, 210, 74, 0.65),
      0 0 30px rgba(255, 210, 74, 0.18);
  }
  .player-card--silver:hover {
    box-shadow:
      0 14px 28px rgba(0, 0, 0, 0.55),
      inset 0 0 0 1px rgba(216, 223, 240, 0.5);
  }
}
.player-card:active { transform: scale(0.97); }

.player-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px 0;
  position: relative;
  z-index: 2;
}

.player-card__rating-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.player-card__rating {
  font-size: 30px;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.player-card--gold .player-card__rating {
  color: var(--gold);
  text-shadow: 0 0 14px rgba(255, 210, 74, 0.45);
}
.player-card--silver .player-card__rating {
  color: var(--silver);
}

.player-card__position {
  font-size: 10px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.08em;
  margin-top: 2px;
}
.player-card--gold .player-card__position {
  color: rgba(255, 210, 74, 0.85);
}

.player-card__rarity {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.05em;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(255, 210, 74, 0.35);
}
.player-card--silver .player-card__rarity {
  color: var(--silver);
  text-shadow: none;
}

.player-card__art {
  flex: 1;
  display: grid;
  place-items: center;
  font-size: 56px;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.5));
  user-select: none;
}

.player-card__bottom {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 10px 10px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.55));
  position: relative;
  z-index: 2;
  gap: 8px;
}
.player-card__name {
  font-size: 12px;
  font-weight: 800;
  color: white;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.player-card__level {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 700;
  white-space: nowrap;
}

/* ===========================================================
   Modals (card detail / contract)
   =========================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(20px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 12, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  background: linear-gradient(180deg, #131b35 0%, #08091c 100%);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 22px 22px 24px;
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(31, 212, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 240ms var(--ease-out), opacity 240ms var(--ease-out);
}
.modal__panel--narrow { max-width: 380px; }

@starting-style {
  .modal:not([hidden]) .modal__panel {
    transform: scale(0.94);
    opacity: 0;
  }
}

.modal__close {
  position: absolute;
  top: 12px; right: 12px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-mute);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .modal__close:hover { background: rgba(255,255,255,0.1); color: var(--text); }
}
.modal__close:active { transform: scale(0.92); }

/* card detail */
.modal__preview {
  display: grid;
  place-items: center;
  margin: 6px 0 18px;
}
.modal__preview .player-card {
  width: 180px;
  aspect-ratio: 3 / 4;
  pointer-events: none;
}

.modal__body { display: flex; flex-direction: column; gap: 14px; }

.modal__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.modal__label { font-size: 11px; color: var(--text-mute); letter-spacing: 0.06em; font-weight: 800; }
.modal__big { font-size: 24px; color: var(--cyan); font-weight: 900; text-shadow: 0 0 14px rgba(31,212,255,0.3); }
.modal__sub { font-size: 12px; color: var(--text-mute); margin-left: auto; }

.exp-bar {
  position: relative;
  height: 20px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.exp-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--purple) 80%, var(--magenta));
  box-shadow: 0 0 14px rgba(31, 212, 255, 0.45);
  transition: width 800ms var(--ease-out);
}
.exp-bar__text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  letter-spacing: 0.04em;
}

.modal__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.modal__stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.modal__stat-label { font-size: 10px; color: var(--text-mute); letter-spacing: 0.04em; }
.modal__stat-value { font-size: 18px; font-weight: 900; color: var(--text); }

.modal__section { display: flex; flex-direction: column; gap: 8px; }
.modal__section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-mute);
}

.modal__missions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.modal__mission {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.modal__mission.is-done { opacity: 0.5; }
.modal__mission.is-done .modal__mission-title { text-decoration: line-through; }
.modal__mission-title { color: var(--text); }
.modal__mission-reward { color: var(--gold); font-weight: 800; }
.modal__missions-empty {
  font-size: 12px;
  color: var(--text-dim);
  padding: 10px 0;
  text-align: center;
}

/* knowledge section in card-detail modal (only for knowledge cards) */
.modal__section--knowledge {
  background: linear-gradient(160deg, rgba(255, 210, 74, 0.10), rgba(255, 154, 46, 0.04));
  border: 1px solid rgba(255, 210, 74, 0.35);
  border-radius: 12px;
  padding: 12px 14px 14px;
  gap: 10px;
}
.modal__section--knowledge .modal__section-title {
  color: var(--gold);
  letter-spacing: 0.06em;
}
.modal__knowledge-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  letter-spacing: 0.01em;
}
.modal__knowledge-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.modal__knowledge-count {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
.modal__knowledge-count strong {
  color: var(--gold);
  font-weight: 900;
  font-size: 13px;
  margin: 0 2px;
}

.review-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold), var(--orange));
  color: #1a1100;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 14px rgba(255, 154, 46, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 160ms var(--ease-out), filter 160ms var(--ease-out);
}
.review-btn__icon { font-size: 13px; }
.review-btn:active { transform: scale(0.96); filter: brightness(0.95); }

/* scout pool remaining counter (below rates row) */
.scout__pool {
  text-align: center;
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.scout__pool strong {
  color: var(--cyan);
  font-weight: 900;
  font-size: 13px;
  margin: 0 2px;
}
.scout__pool.is-complete {
  color: var(--gold);
}
.scout__pool.is-complete strong {
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 210, 74, 0.5);
}

/* disabled state for the scout draw button when complete or no pt */
.scout__draw[disabled] {
  filter: grayscale(0.4) brightness(0.7);
  cursor: not-allowed;
  pointer-events: none;
}

/* knowledge fact text under the scout reveal */
.scout__knowledge {
  margin-top: 14px;
  padding: 10px 14px 12px;
  background: linear-gradient(160deg, rgba(255, 210, 74, 0.12), rgba(255, 154, 46, 0.04));
  border: 1px solid rgba(255, 210, 74, 0.4);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scout__knowledge-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--gold);
  font-weight: 900;
}
.scout__knowledge-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
}

/* +ミッションを追加 button (inside card-detail modal) */
.add-mission-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  background: rgba(31, 212, 255, 0.04);
  color: var(--cyan);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  width: 100%;
  transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.add-mission-btn__plus {
  font-size: 16px;
  line-height: 1;
  font-weight: 900;
}
@media (hover: hover) and (pointer: fine) {
  .add-mission-btn:hover {
    background: rgba(31, 212, 255, 0.08);
    border-color: var(--cyan);
  }
}
.add-mission-btn:active { transform: scale(0.98); }

/* card sell button (inside card-detail modal) */
.modal__sell {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sell-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 154, 46, 0.35);
  background: rgba(255, 154, 46, 0.08);
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.sell-btn__label { font-size: 13px; }
.sell-btn__price { font-size: 14px; font-weight: 900; }
@media (hover: hover) and (pointer: fine) {
  .sell-btn:hover { background: rgba(255, 154, 46, 0.14); border-color: var(--gold); }
}
.sell-btn:active { transform: scale(0.98); }
.modal__sell-note { margin: 0; font-size: 10px; color: var(--text-dim); text-align: center; }

/* field row — pair two fields side-by-side inside mission-add form */
.field-row {
  display: flex;
  gap: 10px;
}
.field-row .field { flex: 1 1 0; }
.field-row select.field__input {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-mute) 50%),
    linear-gradient(135deg, var(--text-mute) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

/* contract form */
.modal__title { margin: 0 0 8px; font-size: 18px; font-weight: 900; letter-spacing: 0.04em; }
.modal__lead { margin: 0 0 16px; font-size: 12px; color: var(--text-mute); line-height: 1.6; }

.contract-form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field--inline { flex-direction: row; align-items: center; gap: 12px; }
.field--inline .field__label { min-width: 60px; }
.field__label {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.06em;
  font-weight: 800;
}
.field__input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: border-color 160ms var(--ease-out), background 160ms var(--ease-out);
  width: 100%;
}
.field__input:focus {
  outline: none;
  border-color: var(--cyan);
  background: rgba(31, 212, 255, 0.05);
}
.field__input--emoji { font-size: 26px; width: 80px; text-align: center; padding: 6px 8px; }

.position-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.position-picker__opt { cursor: pointer; }
.position-picker__opt input { position: absolute; opacity: 0; pointer-events: none; }
.position-picker__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: 0.06em;
  transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.position-picker__btn small {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}
.position-picker__opt input:checked + .position-picker__btn {
  background: linear-gradient(180deg, #2a3252, #1a2140);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 16px rgba(31, 212, 255, 0.22);
}
.position-picker__opt input:checked + .position-picker__btn small { color: rgba(31, 212, 255, 0.75); }
.position-picker__opt input:focus-visible + .position-picker__btn {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.contract-submit {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, #2fd0e0, #1aa5b8);
  color: white;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.06em;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 160ms var(--ease-out), filter 160ms var(--ease-out);
}
.contract-submit:active { transform: scale(0.98); filter: brightness(0.95); }

/* bronze card variant */
.player-card--bronze {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(205, 127, 50, 0.2), transparent 60%),
    linear-gradient(160deg, #4a2e10 0%, #221305 50%, #110903 100%);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(205, 127, 50, 0.45);
}
.player-card--bronze .player-card__rating { color: #e09558; text-shadow: 0 0 12px rgba(205, 127, 50, 0.4); }
.player-card--bronze .player-card__rarity  { color: #d28a4e; }
.player-card--bronze .player-card__position { color: rgba(224, 149, 88, 0.85); }
@media (hover: hover) and (pointer: fine) {
  .player-card--bronze:hover {
    box-shadow:
      0 14px 28px rgba(0, 0, 0, 0.55),
      inset 0 0 0 1px rgba(205, 127, 50, 0.7);
  }
}

/* ===========================================================
   Shop view — 契約 (category carousel)
   =========================================================== */
.shop-currency {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(31, 212, 255, 0.08);
  border: 1px solid rgba(31, 212, 255, 0.3);
  font-size: 13px;
  font-weight: 800;
  color: var(--cyan);
  letter-spacing: 0.04em;
}
.shop-currency__icon { font-size: 14px; }

.shop-lead {
  margin: 14px 4px 12px;
  font-size: 13px;
  color: var(--text-mute);
  line-height: 1.5;
}

.shop-carousel {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 4px 24px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.shop-carousel::-webkit-scrollbar { display: none; }

.shop-tile {
  position: relative;
  flex: 0 0 280px;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  scroll-snap-align: center;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .shop-tile:not(.shop-tile--coming):hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  }
}
.shop-tile:not(.shop-tile--coming):active { transform: scale(0.98); }

.shop-tile__art {
  flex: 1.4;
  position: relative;
  display: grid;
  place-items: center;
  background:
    radial-gradient(100% 80% at 50% 30%, rgba(255, 255, 255, 0.16), transparent 70%),
    linear-gradient(160deg, #2a3252, #0a1130);
}
.shop-tile__emoji {
  font-size: 96px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.6));
  line-height: 1;
}
.shop-tile__sub {
  position: absolute;
  bottom: 10px;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 900;
  text-transform: uppercase;
}

.shop-tile__body {
  flex: 1;
  padding: 14px 16px 16px;
  background: linear-gradient(180deg, rgba(20, 28, 52, 0.96), rgba(8, 13, 28, 0.98));
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border);
}
.shop-tile__title {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--text);
}
.shop-tile__desc {
  margin: 0;
  font-size: 11px;
  color: var(--text-mute);
  line-height: 1.5;
  flex: 1;
}
.shop-tile__cta {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--cyan);
}

.shop-tile__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--cyan), #1aa5b8);
  color: white;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 12px rgba(31, 212, 255, 0.4);
}
.shop-tile__badge--free {
  background: linear-gradient(180deg, var(--purple), #7b39c4);
  box-shadow: 0 4px 12px rgba(177, 76, 255, 0.4);
}
.shop-tile__badge--soon {
  background: linear-gradient(180deg, #4a536d, #2a3148);
  color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.shop-tile__badge--knowledge {
  background: linear-gradient(180deg, var(--gold), var(--orange));
  color: #1a1100;
  box-shadow: 0 4px 12px rgba(255, 154, 46, 0.45);
}

/* small theme label under tile title */
.shop-tile__theme {
  margin: -2px 0 0;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-weight: 800;
  text-transform: uppercase;
}

/* scout modal — theme subtitle next to the title */
.modal__title-sub {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 210, 74, 0.15);
  border: 1px solid rgba(255, 210, 74, 0.45);
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

/* per-tile colored art backgrounds */
.shop-tile--manual .shop-tile__art {
  background:
    radial-gradient(100% 80% at 50% 30%, rgba(177, 76, 255, 0.45), transparent 70%),
    linear-gradient(160deg, #4a258b 0%, #1a0a3d 70%, #0a0520 100%);
}
.shop-tile--manual .shop-tile__cta { color: #d28aff; }

.shop-tile--scout .shop-tile__art {
  background:
    radial-gradient(100% 80% at 50% 30%, rgba(31, 212, 255, 0.45), transparent 70%),
    linear-gradient(160deg, #0a4e72 0%, #061730 70%, #03060f 100%);
}
.shop-tile--scout .shop-tile__cta { color: var(--cyan); }

.shop-tile--knowledge .shop-tile__art {
  background:
    radial-gradient(100% 80% at 50% 30%, rgba(255, 154, 46, 0.4), transparent 70%),
    linear-gradient(160deg, #5a3f10 0%, #2b1d05 70%, #110903 100%);
}
.shop-tile--knowledge .shop-tile__cta { color: var(--gold); }

.shop-tile--ceo .shop-tile__art {
  background:
    radial-gradient(100% 80% at 50% 30%, rgba(167, 139, 250, 0.42), transparent 70%),
    linear-gradient(160deg, #3a2670 0%, #1a1240 70%, #0a0820 100%);
}
.shop-tile--ceo .shop-tile__cta { color: #b9a6ff; }
.shop-tile__badge--ceo {
  background: linear-gradient(180deg, #a78bfa, #7c5cf0);
  color: #110a2e;
  box-shadow: 0 4px 12px rgba(124, 92, 240, 0.45);
}

.shop-tile--coming {
  opacity: 0.72;
  cursor: not-allowed;
}
.shop-tile--coming .shop-tile__cta { color: var(--text-dim); }
.shop-tile--coming .shop-tile__emoji { filter: grayscale(0.4) drop-shadow(0 8px 18px rgba(0, 0, 0, 0.6)); }

@media (max-width: 720px) {
  .shop-tile { flex-basis: 240px; }
  .shop-tile__emoji { font-size: 76px; }
  .shop-tile__title { font-size: 16px; }
}

/* ===========================================================
   Modal tabs (contract / scout)
   =========================================================== */
.modal__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 4px 0 18px;
}
.modal__tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 9px;
  background: transparent;
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.modal__tab-icon { font-size: 14px; }
.modal__tab.is-active {
  background: linear-gradient(180deg, #1a2548, #131c38);
  color: var(--cyan);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 14px rgba(31, 212, 255, 0.18);
}
@media (hover: hover) and (pointer: fine) {
  .modal__tab:not(.is-active):hover { color: var(--text); background: rgba(255,255,255,0.04); }
}
.modal__tab:active { transform: scale(0.97); }

.modal__tab-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--magenta);
  color: white;
  font-size: 10px;
  font-weight: 900;
  display: inline-grid;
  place-items: center;
  letter-spacing: 0;
}

.modal__tab-content { display: flex; flex-direction: column; }

/* ===========================================================
   Scout (gacha) panel
   =========================================================== */
.scout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.scout__chamber {
  position: relative;
  aspect-ratio: 3 / 4;
  max-width: 200px;
  margin: 0 auto;
  width: 100%;
  border-radius: 16px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(31, 212, 255, 0.18), transparent 60%),
    linear-gradient(160deg, #0f1631 0%, #060a1a 100%);
  border: 1px dashed rgba(120, 160, 255, 0.35);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.scout__chamber.is-drawing {
  animation: scout-shake 600ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
  border-style: solid;
  border-color: var(--cyan);
  box-shadow: 0 0 30px rgba(31, 212, 255, 0.35), inset 0 0 30px rgba(31, 212, 255, 0.15);
}
.scout__chamber.is-revealed {
  border-style: solid;
  border-color: var(--cyan);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(31, 212, 255, 0.3), transparent 65%),
    linear-gradient(160deg, #122150 0%, #060a1a 100%);
}
.scout__chamber.is-revealed.is-gold {
  border-color: var(--gold);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 210, 74, 0.35), transparent 65%),
    linear-gradient(160deg, #2a2208 0%, #060a1a 100%);
  box-shadow: 0 0 36px rgba(255, 210, 74, 0.4);
}
.scout__chamber.is-revealed.is-silver {
  border-color: var(--silver);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(216, 223, 240, 0.22), transparent 65%),
    linear-gradient(160deg, #1c2238 0%, #060a1a 100%);
}

.scout__chamber .player-card {
  width: 90%;
  max-width: 170px;
  pointer-events: none;
  animation: scout-reveal 600ms var(--ease-out) both;
}
@keyframes scout-reveal {
  0%   { opacity: 0; transform: scale(0.4) rotateY(-40deg); filter: blur(8px); }
  60%  { opacity: 1; transform: scale(1.08) rotateY(0deg); filter: blur(0); }
  100% { opacity: 1; transform: scale(1) rotateY(0deg); filter: blur(0); }
}
@keyframes scout-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px) rotate(-1deg); }
  40% { transform: translateX(5px) rotate(1deg); }
  60% { transform: translateX(-4px) rotate(-0.5deg); }
  80% { transform: translateX(4px) rotate(0.5deg); }
}

.scout__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
}
.scout__placeholder-mark {
  font-size: 56px;
  font-weight: 900;
  color: var(--text-mute);
  text-shadow: 0 0 18px rgba(31, 212, 255, 0.18);
}
.scout__placeholder-text { font-size: 11px; letter-spacing: 0.06em; }

.scout__rates {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.scout__rate {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-mute);
}
.scout__rate--gold   { color: var(--gold);   border-color: rgba(255, 210, 74, 0.4); }
.scout__rate--silver { color: var(--silver); border-color: rgba(216, 223, 240, 0.35); }
.scout__rate--bronze { color: #e09558;        border-color: rgba(205, 127, 50, 0.4); }

.scout__cost {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
.scout__cost-label { font-weight: 800; }
.scout__cost-value { font-size: 16px; font-weight: 900; color: var(--cyan); }
.scout__cost-sep   { color: var(--text-dim); }
.scout__cost-have  { color: var(--text); }
.scout__cost-have strong { color: var(--cyan); font-weight: 900; font-size: 14px; }

.scout__draw {
  background: linear-gradient(180deg, #ff7e3a, #d44a1f) !important;
}
.scout__draw:disabled {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text-dim);
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
}
.scout__draw:disabled:active { transform: none; }

.scout__hint {
  margin: -4px 0 0;
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.04em;
}

/* body lock when modal open */
body.modal-open { overflow: hidden; }

/* ===========================================================
   Responsive — mobile
   =========================================================== */
@media (max-width: 720px) {
  .app {
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(48px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .stat { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); }
  .topbar__icons { order: 99; margin-left: auto; }

  .stat__value { font-size: 16px; }

  .banner { min-height: 160px; }
  .banner__title { font-size: 24px; }
  .banner__side { width: 100px; padding-right: 12px; }
  .banner__card { width: 80px; height: 110px; }
  .banner__card-rank { font-size: 32px; }

  .actions { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .action { padding: 12px 4px 10px; border-radius: 14px; }
  .action__icon { width: 42px; height: 42px; font-size: 22px; }
  .action__label { font-size: 11px; letter-spacing: 0.02em; }
  .action__tag { font-size: 9px; padding: 3px 6px; }

  .mission { grid-template-columns: 32px 1fr auto; padding: 12px; gap: 10px; }
  .mission__rank { width: 26px; height: 26px; font-size: 13px; }
  .mission__title { font-size: 14px; }

  .summary { grid-template-columns: 1fr 1fr; }
  .summary__card:last-child { grid-column: span 2; }

  /* team screen — mobile */
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .screen-title { font-size: 16px; }
  .team-rating { padding: 3px 12px; }
  .team-rating__value { font-size: 20px; }
  .player-card__rating { font-size: 26px; }
  .player-card__art { font-size: 48px; }
}

@media (max-width: 380px) {
  .actions { grid-template-columns: repeat(3, 1fr); }
}

/* ===========================================================
   Landscape — phone in landscape fits to one screen (no scroll)
   =========================================================== */
@media (orientation: landscape) and (max-height: 500px) {
  .app {
    min-height: 100vh;
    min-height: 100svh;
    max-width: 100%;
    padding:
      max(8px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  /* topbar — single compact row */
  .topbar { padding: 6px 10px; }
  .topbar__row { flex-wrap: nowrap; gap: 6px; }
  .stat {
    min-width: 0;
    flex: 1 1 0;
    padding: 4px 8px;
    gap: 6px;
  }
  .stat__icon { font-size: 15px; }
  .stat__label { font-size: 9px; letter-spacing: 0.02em; }
  .stat__value { font-size: 13px; }
  .topbar__icons { gap: 6px; }
  .icon-btn { width: 30px; height: 30px; }
  .icon-btn__emoji { font-size: 14px; }
  .icon-btn__badge { min-width: 14px; height: 14px; font-size: 9px; }

  .gauge { margin-top: 6px; }
  .gauge__bar { height: 5px; }
  .gauge__text { font-size: 10px; }
  .gauge__text strong { font-size: 11px; }

  /* tabs */
  .tabs { margin-top: 0; padding: 3px; }
  .tabs__item { padding: 5px 10px; font-size: 12px; }

  /* banner takes available vertical space */
  .banner {
    margin-top: 0;
    min-height: 0;
    flex: 1;
    border-radius: 16px;
  }
  .banner__content { padding: 12px 18px; gap: 4px; }
  .banner__title { font-size: 22px; }
  .banner__period { font-size: 11px; }
  .banner__lead { font-size: 11px; line-height: 1.5; margin-top: 4px; }
  .banner__lead strong { font-size: 13px; }
  .banner__side { width: 100px; padding-right: 14px; }
  .banner__card { width: 74px; height: 96px; }
  .banner__card-rank { font-size: 28px; }
  .banner__card-label { font-size: 10px; }

  /* 5 action buttons */
  .actions { margin-top: 0; gap: 6px; grid-template-columns: repeat(5, 1fr); }
  .action { padding: 6px 4px 6px; border-radius: 12px; }
  .action__icon { width: 34px; height: 34px; font-size: 18px; }
  .action__label { font-size: 10px; letter-spacing: 0.02em; }
  .action__tag { font-size: 8px; padding: 2px 6px; top: -7px; }
  .action__pip { min-width: 16px; height: 16px; font-size: 9px; top: 4px; right: 6px; }

  /* hide vertical sections — accessible via tabs later */
  .block, .summary, .footer { display: none; }

  /* ---- card-detail modal: 2 columns so the tall card + details fit a short screen ----
     左にカード（固定）、右に詳細（縦スクロール）。横画面の横幅を活かして1画面に収める。 */
  [data-modal="card-detail"] .modal__panel {
    max-width: 680px;
    max-height: 100%;
    overflow: hidden;            /* scroll happens inside .modal__body, card stays put */
    display: grid;
    grid-template-columns: 128px 1fr;
    column-gap: 18px;
    align-items: stretch;
    padding: 16px 18px;
  }
  [data-modal="card-detail"] .modal__preview {
    margin: 0;
    align-self: center;
  }
  [data-modal="card-detail"] .modal__preview .player-card { width: 128px; }
  [data-modal="card-detail"] .modal__body {
    padding-top: 26px;           /* clear the × close button (sits over this column) */
    gap: 10px;
    min-height: 0;               /* allow the grid item to shrink so overflow can scroll */
    /* cap to the visible area (100dvh − .modal padding 40 − panel padding 32) and scroll the rest */
    max-height: calc(100dvh - 72px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ---- 契約 / shop view: shrink the tall 3:4 tiles so each fits the short height ---- */
  [data-view="shop"] .screen-header { margin-bottom: 4px; }
  [data-view="shop"] .shop-lead { display: none; }       /* tiles are self-explanatory; reclaim height */
  [data-view="shop"] .shop-carousel { padding: 4px 4px 8px; gap: 12px; }
  [data-view="shop"] .shop-tile {
    flex-basis: 240px;
    aspect-ratio: auto;          /* drop the 3:4 lock — height is content-driven now */
    height: auto;
  }
  [data-view="shop"] .shop-tile__art { flex: none; height: 92px; }
  [data-view="shop"] .shop-tile__emoji { font-size: 50px; }
  [data-view="shop"] .shop-tile__sub { bottom: 6px; font-size: 9px; }
  [data-view="shop"] .shop-tile__body { padding: 10px 12px 12px; gap: 4px; }
  [data-view="shop"] .shop-tile__title { font-size: 15px; }
  [data-view="shop"] .shop-tile__theme { font-size: 11px; }
  [data-view="shop"] .shop-tile__desc { font-size: 10px; line-height: 1.4; }
  [data-view="shop"] .shop-tile__cta { font-size: 11px; }
  [data-view="shop"] .shop-tile__badge { top: 8px; right: 8px; padding: 3px 8px; font-size: 11px; }
}
