/*
 * 게이트 브레이커 스타일
 * 색과 크기는 :root 변수에 모았습니다. 그래픽 스타일을 바꿀 때 여기부터 고치면 됩니다.
 */
:root {
  --bg: #0b1020;
  --panel: #18213f;
  --panel-2: #212c55;
  --line: #2f3d73;
  --ink: #0b1020;        /* 카툰 외곽선 색 */
  --text: #eef3ff;
  --muted: #94a3c8;
  --accent: #36d6f0;
  --accent-2: #9b6bff;
  --danger: #ff5a6e;
  --ok: #4be38a;
  --radius: 18px;
  --topbar-h: 56px;
  --tabbar-h: 66px;
  --gutter: 16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation; /* 두 번 탭 확대 막기 */
  overscroll-behavior: none;  /* 당겨서 새로고침 막기 */
}

body { position: fixed; top: 0; right: 0; bottom: 0; left: 0; }

[hidden] { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; }

p { margin: 0 0 8px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }

/* ── 아이콘 ───────────────────────────────── */
.icon { display: inline-block; width: 24px; height: 24px; flex: none; }
.icon svg {
  width: 100%; height: 100%;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.cur-icon { width: 20px; height: 20px; flex: none; vertical-align: -4px; }

/* ── 앱 틀: 상단 바 / 화면 / 하단 탭 ───────── */
.app {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column;
  background: radial-gradient(ellipse at 50% 0%, #1b2554 0%, var(--bg) 65%);
}

.topbar {
  flex: none;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) calc(var(--gutter) + var(--safe-r)) 0 calc(var(--gutter) + var(--safe-l));
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.chips { display: flex; gap: 6px; min-width: 0; overflow: hidden; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 6px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 999px;
  font-size: 15px; white-space: nowrap;
}

.icon-btn {
  flex: none;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); border: 2px solid var(--line); border-radius: 14px;
}

.screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 8px calc(var(--gutter) + var(--safe-r)) 20px calc(var(--gutter) + var(--safe-l));
}

.tabbar {
  flex: none;
  display: flex;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  background: #0e1530;
  border-top: 2px solid var(--line);
}

.tab {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: 0; padding: 0;
  color: var(--muted);
}
.tab-label { font-size: 12px; font-weight: 700; }
.tab.active { color: var(--accent); }
.tab.active .icon { transform: translateY(-1px) scale(1.1); }

body.no-chrome .topbar,
body.no-chrome .tabbar { display: none; }

/* ── 페이지와 카드 ─────────────────────────── */
.page {
  max-width: 960px; margin: 0 auto;
  display: grid; gap: 14px;
}

.card {
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3);
  min-width: 0;
}

.card-title { margin: 0 0 12px; font-size: 18px; font-weight: 800; }

/* ── 버튼 ─────────────────────────────────── */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px;
  background: var(--panel-2); color: var(--text);
  border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
  font-size: 16px; font-weight: 800;
  transition: transform 0.06s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--ink); }
.btn.secondary { background: #2c3a6b; color: var(--text); }
.btn.danger { background: var(--danger); color: var(--ink); }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 14px; }

.button-row { display: flex; gap: 10px; }
.button-row .btn { flex: 1; }

/* ── 준비 중 표시 ──────────────────────────── */
.soon {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; margin-top: 4px;
  border: 2px dashed var(--line); border-radius: 12px;
  color: var(--muted); font-size: 14px;
}
.soon-badge {
  flex: none;
  padding: 2px 8px; border-radius: 999px;
  background: var(--line); color: var(--text);
  font-size: 12px; font-weight: 800;
}

/* ── 아바타(임시 도형) ─────────────────────── */
.avatar {
  flex: none;
  width: var(--s); height: var(--s);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #2e3b72 0%, var(--panel-2) 70%);
  border: 3px solid var(--c);
  box-shadow: 0 3px 0 var(--ink);
  overflow: hidden;
}
.avatar img { width: 92%; height: 92%; object-fit: contain; pointer-events: none; }

/* ── 메인 ─────────────────────────────────── */
.hero { display: flex; flex-direction: column; gap: 16px; }

.logo { display: flex; flex-direction: column; align-items: center; text-align: center; }
.logo-sub { font-size: 13px; letter-spacing: 0.3em; color: var(--accent); font-weight: 800; }
.logo-main {
  font-size: 34px; font-weight: 900; line-height: 1.15;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.hero-awakener { display: flex; align-items: center; gap: 14px; }
.hero-awakener .label { font-size: 13px; color: var(--muted); }
.hero-awakener .name { font-size: 22px; font-weight: 900; }

.btn.sortie {
  width: 100%;
  min-height: 72px;
  flex-direction: column; gap: 0;
  font-size: 28px; font-weight: 900; letter-spacing: 0.08em;
  color: var(--ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 0 var(--ink);
}
.btn.sortie small { font-size: 14px; letter-spacing: 0; font-weight: 800; opacity: 0.8; }

.gate-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }

.gate-btn {
  position: relative;
  height: 72px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2);
  border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
  color: var(--gate);
}
.gate-btn .gate-rank { font-size: 30px; font-weight: 900; }
.gate-btn .gate-mark { position: absolute; top: 3px; right: 3px; }
.gate-btn .gate-mark .icon { width: 16px; height: 16px; }
.gate-btn.selected { background: var(--gate); color: var(--ink); transform: translateY(-2px); }
.gate-btn.locked { color: #4b5788; }
.gate-btn.locked .gate-mark { color: var(--muted); }

.gate-info {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  margin-top: 12px; font-size: 14px; color: var(--muted);
}

/* ── 각성자 ───────────────────────────────── */
.awakener-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }

.awakener-card {
  position: relative;
  width: 104px; padding: 10px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--panel-2);
  border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
}
.awakener-card .name { font-weight: 800; }
.awakener-card.selected { outline: 3px solid var(--accent); outline-offset: 2px; }
.awakener-card.locked { opacity: 0.5; }
.awakener-card > .icon { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; }

.awakener-detail .hero-awakener { align-items: flex-start; margin-bottom: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  display: flex; flex-direction: column;
  padding: 10px 12px;
  background: var(--panel-2); border-radius: 12px;
}
.stat .muted { font-size: 13px; }
.stat b { font-size: 20px; }

/* ── 장비 ─────────────────────────────────── */
.gear-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.gear-slot {
  height: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--panel-2);
  border: 3px dashed var(--line); border-radius: 14px;
}
.slot-name { font-weight: 800; }

.rarity-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.rarity-tag {
  padding: 2px 10px; border-radius: 999px;
  border: 2px solid var(--r); color: var(--r);
  font-size: 13px; font-weight: 800;
}

/* ── 뽑기 ─────────────────────────────────── */
.gacha-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.gacha-buttons .btn { min-height: 64px; padding: 8px 10px; font-size: 17px; white-space: nowrap; }

.rates { display: grid; gap: 8px; }
.rate-row { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 10px; }
.rate-name { color: var(--r); font-weight: 800; }
.rate-bar { height: 12px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.rate-bar span { display: block; height: 100%; min-width: 4px; background: var(--r); border-radius: 999px; }
.rate-value { text-align: right; }

.rules { margin: 14px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.rules li { margin-bottom: 4px; }
.rules b { color: var(--text); }

/* ── 영구 강화 ─────────────────────────────── */
.upgrade-list { display: grid; gap: 10px; margin-bottom: 8px; }
.upgrade-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px; background: var(--panel-2); border-radius: 14px;
}
.upgrade-row .name { font-weight: 800; font-size: 17px; }
.upgrade-info { flex: 1; min-width: 0; display: grid; gap: 3px; }
.upgrade-level { font-size: 13px; color: var(--accent); margin-left: 4px; }
.upgrade-row .next { color: var(--ok); }
.upgrade-row .btn { flex: none; min-width: 92px; }
.level-bar { height: 6px; background: #121a38; border-radius: 999px; overflow: hidden; }
.level-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* 각성자 능력치의 강화 보너스 */
.stat .up { color: var(--ok); font-size: 13px; }

/* 초반 보너스 안내 */
.beginner-note {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: rgba(194, 123, 255, 0.15);
  border: 2px solid #c27bff; border-radius: 12px;
  font-size: 14px;
}
.beginner-note b { color: #e0b8ff; }

/* 결과 화면 보상 */
.rewards { display: grid; gap: 10px; }
.reward-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.reward-total {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 6px;
  background: var(--panel-2); border: 2px solid var(--c); border-radius: 14px;
}
.reward-total .cur-icon { width: 28px; height: 28px; }
.reward-total .muted { font-size: 12px; }
.reward-total b { font-size: 22px; color: var(--c); }
.reward-lines {
  list-style: none; margin: 0; padding: 8px 12px;
  background: rgba(0, 0, 0, 0.18); border-radius: 12px;
  text-align: left; font-size: 13px; color: var(--muted);
}
.reward-lines li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.reward-lines li span { flex: 1; }
.reward-lines li b { color: var(--text); }
.reward-lines .cur-icon { width: 16px; height: 16px; vertical-align: 0; }

/* ── 도감 ─────────────────────────────────── */
.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.codex-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; background: var(--panel-2); border-radius: 12px;
  font-size: 14px; font-weight: 700; text-align: center;
}

/* ── 결과 ─────────────────────────────────── */
.result-page {
  min-height: 100%;
  max-width: 520px;
  align-content: center;
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
}
.result { display: grid; gap: 12px; text-align: center; }
.result-title { font-size: 34px; font-weight: 900; }
.result.win { border-color: var(--accent); }
.result.win .result-title { color: var(--accent); }
.result.lose { border-color: var(--danger); }
.result.lose .result-title { color: var(--danger); }
.result-stats { text-align: left; }
.unlock-note {
  padding: 10px; border-radius: 12px;
  background: var(--gate); color: var(--ink); font-weight: 900;
}

/* ── 전투 화면 ─────────────────────────────── */
.battle {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 10;
  background: #0d1430;
  touch-action: none; /* 화면을 끌어도 스크롤/확대가 일어나지 않게 */
}
.battle canvas { display: block; width: 100%; height: 100%; }

.hud {
  position: absolute; top: 0; left: 0; right: 0;
  padding: calc(26px + var(--safe-t)) calc(84px + var(--safe-r)) 0 calc(12px + var(--safe-l));
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  pointer-events: none;
}

/* 맨 위 경험치 바 */
.hud-exp {
  position: absolute;
  top: calc(4px + var(--safe-t)); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r));
  height: 16px;
  background: rgba(11, 16, 32, 0.8);
  border: 2px solid var(--ink); border-radius: 999px;
  overflow: hidden;
}
.hud-exp-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #4aa8ff, #5ef2c2);
}
.hud-level {
  position: absolute; top: 0; bottom: 0; left: 10px;
  display: flex; align-items: center;
  font-size: 11px; font-weight: 900;
  text-shadow: 0 0 3px var(--ink), 0 0 3px var(--ink);
}

.hud-left { display: flex; flex-direction: column; gap: 6px; }

.hud-skills { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }
.hud-skill {
  position: relative;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(11, 16, 32, 0.75);
  border: 2px solid var(--c); border-radius: 8px;
  font-size: 16px; line-height: 1;
}
.hud-skill i {
  position: absolute; right: -4px; bottom: -5px;
  min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--ink); color: var(--text); border-radius: 999px;
  font-style: normal; font-size: 10px; font-weight: 900; line-height: 15px; text-align: center;
}

.hud-hp {
  position: relative;
  width: min(36vw, 260px); height: 28px;
  background: rgba(11, 16, 32, 0.8);
  border: 3px solid var(--ink); border-radius: 999px;
  overflow: hidden;
}
.hud-hp-fill {
  height: 100%; width: 100%;
  background: linear-gradient(180deg, #ff8a98, var(--danger));
  transition: width 0.15s;
}
.hud-hp-fill.low { animation: hp-low 0.6s infinite alternate; }
@keyframes hp-low { from { opacity: 1; } to { opacity: 0.55; } }
.hud-hp-text {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900;
  text-shadow: 0 0 3px var(--ink), 0 0 3px var(--ink);
}

.hud-center {
  position: absolute; left: 50%; top: calc(24px + var(--safe-t));
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
}
.hud-timer {
  font-size: 32px; font-weight: 900; line-height: 1.1;
  text-shadow: 0 3px 0 var(--ink), 0 0 6px var(--ink);
}
.hud-timer.urgent { color: var(--danger); }
.hud-kills {
  font-size: 14px; font-weight: 800; color: var(--muted);
  text-shadow: 0 0 4px var(--ink);
  white-space: nowrap;
}
.hud-kills .cur-icon { width: 14px; height: 14px; vertical-align: -2px; }

/* 화면 가운데 큰 알림 */
.hud-banner {
  position: fixed; left: 50%; top: 32%;
  transform: translate(-50%, -50%) scale(0.6);
  padding: 10px 26px;
  background: rgba(11, 16, 32, 0.85);
  border: 3px solid #ffd166; border-radius: 16px;
  color: #ffd166;
  font-size: 26px; font-weight: 900; white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.hud-banner.boss { border-color: #3a86ff; color: #8fd8ff; }
.hud-banner.clear { border-color: var(--accent); color: var(--accent); font-size: 34px; }
.hud-banner.show { animation: banner 2.4s ease-out forwards; }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  20% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* 화면 아래 보스 체력 바 */
.hud-boss {
  position: fixed; left: 50%; bottom: calc(18px + var(--safe-b));
  transform: translateX(-50%);
  width: min(80vw, 560px);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  pointer-events: none;
}
.hud-boss-name {
  font-size: 15px; font-weight: 900;
  text-shadow: 0 0 4px var(--ink), 0 0 4px var(--ink);
}
.hud-boss-bar {
  width: 100%; height: 18px;
  background: rgba(11, 16, 32, 0.85);
  border: 3px solid var(--ink); border-radius: 999px;
  overflow: hidden;
}
.hud-boss-fill {
  height: 100%; width: 100%;
  background: linear-gradient(180deg, #ffb35c, #ff7b00);
  transition: width 0.15s;
}

/* 좁은 세로 화면: 체력 바를 시간 아래로 */
@media (max-width: 520px) {
  .hud-left {
    position: absolute; top: calc(100px + var(--safe-t)); left: 50%; transform: translateX(-50%);
    align-items: center;
  }
  .hud-hp { width: 60vw; height: 24px; }
  .hud-skills { justify-content: center; max-width: 80vw; }
}

.battle.choosing .pause-btn { display: none; }

.pause-btn {
  position: absolute;
  top: calc(28px + var(--safe-t));
  right: calc(12px + var(--safe-r));
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: rgba(24, 33, 63, 0.85);
  border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
}
.pause-btn span { width: 7px; height: 22px; background: var(--text); border-radius: 3px; }

/* ── 모달 ─────────────────────────────────── */
.overlay { position: fixed; z-index: 20; top: 0; left: 0; }

.modal-backdrop {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  background: rgba(5, 8, 20, 0.72);
}

.modal {
  width: 100%; max-width: 420px; max-height: 100%;
  overflow-y: auto;
  background: var(--panel);
  border: 3px solid var(--ink); border-radius: 22px;
  box-shadow: 0 6px 0 var(--ink);
  padding: 20px;
  animation: pop 0.14s ease-out;
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-title { margin: 0 0 14px; font-size: 22px; font-weight: 900; text-align: center; }
.modal-buttons { display: flex; gap: 10px; margin-top: 16px; }
.modal-buttons .btn { flex: 1; }

.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 52px; padding: 4px 0;
  border-bottom: 2px solid var(--panel-2);
  font-weight: 700;
}

.toggle {
  position: relative; flex: none;
  width: 62px; height: 36px; padding: 0;
  background: #2c3a6b;
  border: 3px solid var(--ink); border-radius: 999px;
  transition: background 0.15s;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.toggle.on { background: var(--ok); }
.toggle.on::after { transform: translateX(26px); }

/* ── 레벨업 카드 ───────────────────────────── */
.modal.levelup { max-width: 760px; }
.modal-title small { font-size: 15px; color: var(--muted); margin-left: 6px; }
.center { text-align: center; }

.levelup-cards { display: grid; gap: 10px; margin-bottom: 10px; }

.skill-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px;
  background: var(--panel-2);
  border: 3px solid var(--ink); border-left: 8px solid var(--t);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
  text-align: left;
  transition: transform 0.06s, filter 0.2s;
}
.skill-card:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.skill-card:disabled { filter: saturate(0.5) brightness(0.85); cursor: default; }
.skill-card.maxed { border-color: #ffd166; border-left-color: var(--t); }

.skill-icon {
  flex: none;
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.18), rgba(0,0,0,0.15)), #121a38;
  border: 3px solid var(--c); border-radius: 14px;
  font-size: 30px; line-height: 1;
}
.skill-icon.small { width: 34px; height: 34px; font-size: 18px; border-width: 2px; border-radius: 9px; }

.skill-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.skill-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.skill-name { font-size: 18px; font-weight: 900; }
.skill-type {
  padding: 1px 8px; border-radius: 999px;
  background: var(--t); color: var(--ink);
  font-size: 11px; font-weight: 900;
}
.skill-level { font-size: 13px; font-weight: 800; color: var(--accent); }
.skill-level.new { color: #ffd166; }
.skill-desc { font-size: 14px; color: var(--muted); }

/* 가로로 넓은 화면: 카드 3장을 나란히 */
@media (orientation: landscape) and (min-width: 760px) {
  .levelup-cards { grid-template-columns: repeat(3, 1fr); }
  .skill-card { flex-direction: column; align-items: center; text-align: center; padding: 16px 10px; border-left-width: 3px; border-top: 8px solid var(--t); }
  .skill-info { align-items: center; }
  .skill-head { justify-content: center; }
}

/* 일시정지 메뉴의 보유 스킬 */
.owned-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin-bottom: 10px; }
.owned-skill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; background: var(--panel-2); border-radius: 10px;
  font-size: 14px; font-weight: 700;
}
.owned-skill .owned-name { flex: 1; min-width: 0; }
.owned-skill b { font-size: 12px; color: var(--accent); }

.setting-info { display: grid; gap: 6px; justify-items: center; margin-top: 14px; text-align: center; }

/* ── 알림과 오류 ──────────────────────────── */
.toast {
  position: fixed; z-index: 30;
  top: calc(12px + var(--safe-t)); left: 50%;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  background: var(--panel-2); color: var(--text);
  border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 700; font-size: 15px; text-align: center;
  transform: translate(-50%, -150%);
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.error-box {
  position: fixed; z-index: 40;
  left: 8px; right: 8px; bottom: calc(8px + var(--safe-b));
  padding: 8px 12px;
  background: #5c1020; color: #fff; border-radius: 10px;
  font-size: 13px;
}

/* ── 반응형 ───────────────────────────────── */
/* 가로 화면(태블릿 가로 등): 메인을 두 칸으로 */
@media (orientation: landscape) and (min-width: 760px) {
  .main-page { grid-template-columns: 1fr 1fr; align-items: start; }
  .main-page .hero { grid-row: span 2; }
}

/* 좁은 화면(휴대폰 세로): 게이트를 3칸씩 */
@media (max-width: 480px) {
  .gate-grid { grid-template-columns: repeat(3, 1fr); }
  .logo-main { font-size: 30px; }
}

/* 낮은 화면(휴대폰 가로): 상단/하단 바를 얇게 */
@media (max-height: 500px) {
  :root { --topbar-h: 48px; --tabbar-h: 54px; }
  .tab { flex-direction: row; gap: 6px; }
  .tab .icon { width: 20px; height: 20px; }
}

/* 큰 태블릿: 글자와 여백을 조금 키움 */
@media (min-width: 1000px) and (min-height: 700px) {
  :root { --gutter: 24px; --tabbar-h: 72px; }
  .tab-label { font-size: 13px; }
}
