:root {
  --bg: #eef6ff;
  --bg2: #dff0ff;
  --card: #ffffff;
  --card2: #f8fbff;
  --line: rgba(80, 130, 200, 0.16);
  --text: #1a2b42;
  --muted: #5f7390;
  --accent: #00c566;
  --accent2: #0099ff;
  --purple: #8b5cf6;
  --pink: #ff6b9d;
  --orange: #ff9f43;
  --gold: #ffb020;
  --danger: #ff5d6c;
  --radius: 18px;
  --font: "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --nav-h: calc(64px + var(--safe-bottom));
  --top-h: calc(40px + var(--safe-top));
  --app-width: 100%;
  --page-pad: 0.9rem;
  --shadow: 0 8px 24px rgba(60, 120, 200, 0.12);
  --shadow-sm: 0 4px 14px rgba(60, 120, 200, 0.1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { min-height: 44px; }

.boot-screen {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 2rem;
  background:
    radial-gradient(circle at 20% 10%, rgba(0,153,255,0.18), transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(255,159,67,0.16), transparent 35%),
    var(--bg);
}
.boot-brand {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent2);
}
.boot-text {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: var(--app-width);
  max-width: var(--app-width);
  min-width: 0;
  margin: 0 auto;
  height: 100dvh;
  height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 0% 0%, rgba(0,153,255,0.14), transparent 42%),
    radial-gradient(circle at 100% 8%, rgba(255,107,157,0.12), transparent 38%),
    radial-gradient(circle at 50% 100%, rgba(0,197,102,0.1), transparent 45%),
    linear-gradient(180deg, #f3f9ff 0%, #eaf4ff 45%, #e3f0ff 100%);
}

.main-area {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0.75rem var(--page-pad) 1rem;
}

.top-bar {
  flex: 0 0 auto;
  position: relative;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  min-height: var(--top-h);
  padding: var(--safe-top) 0.75rem 0;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid rgba(80, 130, 200, 0.1);
  box-shadow: 0 2px 12px rgba(60, 120, 200, 0.06);
}
.app-shell.is-stag .top-bar {
  /* safe-area 는 stag 배너가 담당 */
  min-height: 40px;
  padding-top: 0;
}
.stag-env-banner {
  flex: 0 0 auto;
  position: relative;
  z-index: 70;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: #fff;
  background: linear-gradient(90deg, #c2410c, #ea580c 45%, #d97706);
  padding: 0.32rem 0.75rem;
  padding-top: max(0.32rem, var(--safe-top));
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.28);
}
.stag-env-banner--boot {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 9999;
}
.top-bar-brand {
  margin: 0;
  padding: 0.35rem 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.top-bar-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
}
.top-bar-attend {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  min-width: 0;
}
.top-attend-btn {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0.25rem 0.65rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(120deg, #00d084, #00b4ff);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.top-attend-btn.done,
.top-attend-btn:disabled {
  background: #c5d4e6;
  color: #fff;
  cursor: default;
}
.top-streak {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.top-hamburger {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin-left: 0.15rem;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}
.top-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: #1e3a5f;
}
.top-hamburger:active {
  background: rgba(80, 130, 200, 0.1);
}
.my-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 30, 50, 0.35);
}
.my-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  width: min(86vw, 320px);
  height: 100%;
  background: #fff;
  box-shadow: -8px 0 28px rgba(30, 60, 100, 0.18);
  transform: translateX(105%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  padding: var(--safe-top) 0 calc(0.75rem + var(--safe-bottom));
  box-sizing: border-box;
}
.my-drawer.open {
  transform: translateX(0);
}
.my-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid rgba(80, 130, 200, 0.12);
}
.my-drawer-head strong {
  font-size: 1.05rem;
  color: #1e3a5f;
}
.my-drawer-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: #5f7390;
  cursor: pointer;
}
.my-drawer-body {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
  align-content: start;
}
.my-drawer-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}
.my-drawer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #00d084, #00b4ff);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.my-drawer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.my-drawer-name {
  margin: 0;
  font-weight: 800;
  color: #1e3a5f;
}
.my-drawer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.my-drawer-stats button {
  border: 1px solid rgba(80, 130, 200, 0.14);
  border-radius: 14px;
  background: #f5f9fd;
  padding: 0.65rem 0.7rem;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 0.2rem;
}
.my-drawer-stats button span {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
}
.my-drawer-stats button strong {
  font-size: 0.95rem;
  color: #1e3a5f;
}
.my-drawer-nav {
  display: grid;
  gap: 0.15rem;
}
.my-drawer-nav button,
.my-drawer-nav a {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.75rem 0.35rem;
  border-radius: 10px;
  color: #1e3a5f;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}
.my-drawer-nav button:active,
.my-drawer-nav a:active {
  background: rgba(80, 130, 200, 0.08);
}
.my-drawer-logout {
  width: 100%;
  margin-top: 0.25rem;
}

.page {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  overflow-x: hidden;
}

.page-header { margin: 0 0 1rem; }
.page-title { margin: 0; font-size: 1.45rem; font-weight: 800; color: var(--text); }
.loading, .center { text-align: center; padding: 3rem 1rem; width: 100%; }

.hero-card, .section-card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 100%;
}

.hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0f8ff 100%);
  border-color: rgba(0,153,255,0.15);
}

.my-profile-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.15rem;
}
.my-avatar {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, #0099ff 0%, #0066cc 100%);
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}
.my-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.my-avatar-initial {
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  user-select: none;
}
.my-profile-text {
  min-width: 0;
  flex: 1;
}
.my-profile-text h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent2);
  word-break: break-word;
}
.my-profile-text .muted {
  margin: 0.2rem 0 0;
}
.my-edit-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-left: auto;
  min-height: 0; /* 전역 button { min-height: 44px } 해제 */
  padding: 0.28rem 0.72rem;
  border: 1px solid color-mix(in srgb, var(--accent2) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent2) 10%, #fff);
  color: var(--accent2);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 153, 255, 0.12);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.my-edit-btn:hover {
  background: color-mix(in srgb, var(--accent2) 18%, #fff);
  box-shadow: 0 4px 12px rgba(0, 153, 255, 0.18);
}
.my-edit-btn:active {
  transform: scale(0.97);
}
.my-edit-icon {
  display: block;
  flex-shrink: 0;
}

.my-edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem calc(1.25rem + var(--safe-bottom));
  background: rgba(15, 35, 70, 0.45);
  backdrop-filter: blur(4px);
}
.my-edit-sheet {
  width: min(100%, 400px);
  padding: 1.15rem 1.2rem 1.25rem;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(15, 35, 70, 0.28);
}
.my-edit-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.my-edit-sheet-head h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}
.my-edit-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.my-edit-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.my-edit-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, #0099ff 0%, #0066cc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 102, 204, 0.25);
}
.my-edit-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.my-edit-photo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}
.my-edit-photo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fbff;
  color: var(--accent2);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}
.my-edit-photo-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.my-edit-photo-remove {
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, #fff);
  color: var(--danger);
}
.my-edit-field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}
.my-edit-field input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  background: #fff;
}
.my-edit-field input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent2) 35%, transparent);
  border-color: var(--accent2);
}
.my-edit-error {
  margin: 0 0 0.75rem;
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 700;
}
.my-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
.home-help a {
  color: var(--accent2);
  font-weight: 700;
  text-decoration: none;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.brand-sm {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent2);
}

.today-earn-wrap {
  display: inline-grid;
  grid-template-columns: max-content max-content;
  column-gap: 0.35rem;
  row-gap: 0.15rem;
  margin-top: 0.35rem;
  color: var(--muted);
  align-items: baseline;
}
.today-earn-wrap .earn-value { justify-self: end; text-align: right; }
.today-earn-wrap .earn-value strong { color: var(--orange); font-size: 1.1rem; }
.today-earn-wrap .earn-value.today-gems strong { color: #7c5cff; }
.today-earn-wrap .earn-label { justify-self: start; }

.point-box {
  text-align: right;
  background: linear-gradient(135deg, #e8fff3, #dff6ff);
  border: 1px solid rgba(0,197,102,0.25);
  border-radius: 16px;
  padding: 0.7rem 0.9rem;
  box-shadow: var(--shadow-sm);
}
.point-box .label { display: block; color: var(--muted); font-size: 0.8rem; }
.point-box .points {
  display: block;
  font-size: clamp(1.25rem, 5vw, 1.55rem);
  color: #00a85a;
  line-height: 1.2;
  font-weight: 800;
}
.point-box .gems { color: var(--purple); font-size: 0.9rem; font-weight: 700; }
.point-box .point-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-bottom: 1px dashed color-mix(in srgb, currentColor 40%, transparent);
}
.point-box .point-link:active,
.point-box .point-link:hover {
  opacity: 0.85;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.section-head h2 { margin: 0; font-size: 1.08rem; font-weight: 800; }

.mission-list { display: grid; gap: 0.45rem; }
.mission-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  background: #f3f4f6;
  border: 1px solid rgba(120, 130, 150, 0.12);
}
.mission-main {
  flex: 1;
  min-width: 0;
}
.mission-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.mission-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.2;
}
.mission-count {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #4b5563;
}
.mission-bar {
  height: 8px;
  border-radius: 999px;
  background: #d1fae5;
  overflow: hidden;
}
.mission-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #10b981);
  transition: width .25s ease;
  min-width: 0;
}
.mission-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.mission-play,
.mission-claim {
  flex-shrink: 0;
  width: 4.1rem;
  min-height: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  padding: 0.18rem 0.15rem;
  line-height: 1.05;
  color: #fff;
  cursor: pointer;
}
.mission-play {
  background: linear-gradient(160deg, #38bdf8, #0284c7);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.22);
}
.mission-play strong,
.mission-claim strong {
  font-size: 0.8rem;
  font-weight: 800;
}
.mission-play span,
.mission-claim span {
  font-size: 0.64rem;
  font-weight: 700;
}
.mission-claim {
  background: #9ca3af;
  cursor: default;
}
.mission-claim.ready {
  background: linear-gradient(160deg, #22c55e, #16a34a);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.28);
}
.mission-claim.done {
  background: #6b7280;
}
.mission-claim.wait {
  background: #9ca3af;
}
.mission-claim:disabled {
  opacity: 1;
}

.game-row-scroll {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.25rem;
  margin: 0;
  max-width: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.game-row-scroll::-webkit-scrollbar { display: none; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  width: 100%;
}
.game-grid.scroll-y {
  /* 2줄(4개) 보이고, 5번째부터는 세로 스크롤 */
  max-height: calc((56px + 1.4rem) * 2 + 0.65rem + 0.25rem);
  overflow-y: auto !important;
  overflow-x: hidden;
  padding-right: 0.2rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.game-grid.scroll-y::-webkit-scrollbar { width: 4px; }
.game-grid.scroll-y::-webkit-scrollbar-thumb {
  background: rgba(80, 130, 200, 0.45);
  border-radius: 999px;
}
.section-card .game-grid.scroll-y {
  min-height: 0;
}

.game-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.95rem;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 44px;
  -webkit-user-select: none;
  user-select: none;
  box-shadow: var(--shadow-sm);
}
.game-card:active { transform: scale(0.98); }
.game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.game-card.featured {
  min-width: 108px;
  max-width: 108px;
  text-align: center;
  padding: 0.55rem;
  background: linear-gradient(160deg, #fff7ed, #fff);
  border-color: rgba(255,159,67,0.25);
}
.game-card.compact {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem;
  background: linear-gradient(160deg, #f5f3ff, #fff);
}
.game-card.tile {
  display: flex;
  flex-direction: column;
  padding: 0.55rem;
  gap: 0.45rem;
}
.game-card:nth-child(4n+1) { background: linear-gradient(160deg, #eff6ff, #fff); }
.game-card:nth-child(4n+2) { background: linear-gradient(160deg, #ecfdf5, #fff); }
.game-card:nth-child(4n+3) { background: linear-gradient(160deg, #fff7ed, #fff); }
.game-card:nth-child(4n+4) { background: linear-gradient(160deg, #fdf2f8, #fff); }

.game-card h3 { margin: 0; font-size: 0.92rem; font-weight: 800; line-height: 1.25; }
.game-card.featured h3 { margin-top: 0.35rem; }
.game-card p { margin: 0; font-size: 0.85rem; }
.game-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
  line-height: 1.2;
}
.emoji { font-size: 1.9rem; line-height: 1; }
.emoji.lg { font-size: 2.4rem; }

.rating-stars {
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
  margin: 0.15rem 0 0.25rem;
}
.rating-star {
  font-size: 0.95rem;
  line-height: 1;
  color: rgba(255, 176, 32, 0.35);
  transform: translateY(-0.5px);
}
.rating-star.on {
  color: var(--gold);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}
.rating-stars.interactive {
  gap: 1px;
}
.rating-star-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.1rem 0.05rem;
  margin: 0;
  min-height: 0;
  min-width: 1.35rem;
  font-size: 1.15rem;
  line-height: 1;
  color: rgba(255, 176, 32, 0.35);
  cursor: pointer;
}
.rating-star-btn.on {
  color: var(--gold);
}
.rating-star-btn.mine.on {
  color: #f59e0b;
}
.rating-star-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.rating-stars.busy {
  pointer-events: none;
  opacity: 0.75;
}
.rating-meta {
  margin: 0 0 0.2rem !important;
  font-size: 0.72rem !important;
  text-align: center;
  min-height: 1.15em;
  line-height: 1.15;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.game-thumb-wrap {
  position: relative;
  overflow: hidden;
  background: #eef2f7;
  border-radius: 14px;
  flex-shrink: 0;
}
.game-thumb-wrap.featured {
  width: 100%;
  aspect-ratio: 1;
}
.game-thumb-wrap.compact {
  width: 56px;
  height: 56px;
}
.game-thumb-wrap.tile {
  width: 100%;
  aspect-ratio: 1;
}
.game-thumb-wrap.playable {
  cursor: pointer;
}
.game-card.tile {
  cursor: default;
}
.game-thumb-wrap .game-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.game-thumb-wrap .emoji {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}
.game-thumb-wrap.tile .emoji { font-size: 2.2rem; }
.thumb-badge {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  right: auto;
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  z-index: 2;
}
.thumb-badge-new {
  left: auto;
  right: 0.35rem;
}
.badge.rank {
  color: #92400e;
  background: #fef3c7;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  border: 0;
}
.badge.hot { color: #b45309; background: #fef3c7; }
.badge.new { color: #1d4ed8; background: #dbeafe; }
.badge.event { color: #be185d; background: #fce7f3; }
.badge.reward { color: #047857; background: #d1fae5; margin-top: 0.35rem; }
.badge.pending { color: #b45309; background: #fef3c7; }
.badge.completed { color: #047857; background: #d1fae5; }
.badge.cancelled { color: #b91c1c; background: #fee2e2; }

.reward-redeem-item {
  margin: 0 0 0.45rem;
  font-weight: 700;
  color: var(--text);
}
.reward-redeem-hint {
  margin: 0 0 0.9rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--muted);
}

.rank-list { display: grid; gap: 0.45rem; }
.rank-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 0.35rem;
  border-bottom: 1px solid var(--line);
}
.rank-row.big { padding: 0.75rem 0.35rem; }
.rank-reward-box {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 196, 74, 0.14), rgba(255, 140, 66, 0.08));
  border: 1px solid rgba(230, 150, 40, 0.22);
}
.rank-reward-note {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: #7a5a20;
  line-height: 1.35;
}
.rank-reward-period + .rank-reward-period { margin-top: 0.45rem; }
.rank-reward-period strong {
  display: block;
  font-size: 0.82rem;
  margin-bottom: 0.2rem;
}
.rank-reward-places {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.8rem;
}
.rank-reward-places em {
  font-style: normal;
  font-weight: 700;
  margin-right: 0.15rem;
  color: #c27a12;
}
.rank-date-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.rank-date-field {
  flex: 1;
  margin: 0;
}
.rank-date-field input[type="date"] {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: var(--text);
}
.rank-no {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: #eef4ff;
  font-weight: 800; font-size: 0.85rem;
  color: var(--muted);
}
.rank-no.top1 { background: linear-gradient(135deg,#ffd34d,#ffb020); color:#1a1200; }
.rank-no.top2 { background: #e2e8f0; color:#1a2030; }
.rank-no.top3 { background: #fdba74; color:#1a1008; }

.event-list { display: grid; gap: 0.55rem; }
.event-row {
  display: flex; gap: 0.65rem; align-items: flex-start;
  padding: 0.75rem; border-radius: 14px;
  background: #f8fbff;
  border: 1px solid var(--line);
}

.rewards-page .page-header { margin-bottom: 0.4rem; }
.rewards-top { margin-bottom: 0.75rem; }
.rewards-balance {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.rewards-balance span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.rewards-balance strong {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}
.rewards-balance em {
  margin-left: auto;
  font-style: normal;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.9rem;
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  width: 100%;
}
.reward-card {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}
.reward-card-btn {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  text-align: left;
  box-shadow: 0 2px 10px rgba(30, 50, 80, 0.06);
  cursor: pointer;
}
.reward-card-btn:active { transform: scale(0.985); }
.reward-card-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.reward-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.05;
  background: #f4f5f7;
  overflow: hidden;
}
.reward-media.is-empty {
  background: linear-gradient(160deg, #eef1f5, #f8f9fb);
}
.reward-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #fff;
}
.reward-disc {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 1;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(0,0,0,0.06);
  color: #ff6a00;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
}

.reward-body {
  display: grid;
  gap: 0.22rem;
  padding: 0.55rem 0.6rem 0.7rem;
}
.reward-brand {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reward-name {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.3em;
}
.reward-price-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.15rem;
}
.reward-off {
  color: #ff6a00;
  font-size: 0.82rem;
  font-weight: 800;
}
.reward-points {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
}
.reward-gem-ico {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  position: relative;
  top: 0.12rem; /* 숫자와 광학적 수직 맞춤 */
}
.reward-cta {
  margin-top: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 32px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, #fff);
  color: #0a8a4a;
  font-size: 0.78rem;
  font-weight: 800;
}

.reward-search {
  display: block;
  margin-top: 0.65rem;
}
.reward-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 0.95rem;
}
.reward-search input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent2) 35%, transparent);
  border-color: var(--accent2);
}
.reward-count { margin: 0.45rem 0 0; }
.cost { color: var(--orange); font-weight: 800; margin: 0.35rem 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.reward-sentinel {
  width: 100%;
  height: 48px;
}
.reward-loading-more {
  margin: 0.75rem 0 0.25rem;
  text-align: center;
}
.center { text-align: center; }

.app-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 12px);
  transform: translateX(-50%);
  z-index: 9999;
  max-width: min(88vw, 360px);
  padding: 0.78rem 1.1rem;
  border-radius: 999px;
  background: rgba(26, 43, 66, 0.92);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  animation: toast-in 0.22s ease-out;
}
.attend-gem-toast {
  bottom: auto;
  top: 42%;
  padding: 0.95rem 1.35rem;
  font-size: 1.05rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(251, 191, 36, 0.45);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.35);
}
.attend-confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  overflow: hidden;
}
.attend-confetti span {
  position: absolute;
  top: -16px;
  display: block;
  opacity: 0.95;
  animation-name: confetti-fall;
  animation-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
  animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  85% { opacity: 1; }
  100% {
    transform: translate3d(var(--drift, 0px), 105vh, 0) rotate(720deg);
    opacity: 0;
  }
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 앱 강제/선택 업데이트 */
.app-update-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
}
.app-update-modal {
  width: min(92vw, 360px);
  padding: 1.35rem 1.2rem 1.15rem;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.28);
  text-align: center;
}
.app-update-modal h3 {
  margin: 0 0 0.45rem;
  font-size: 1.15rem;
  color: var(--text);
}
.app-update-desc {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted, #5f7390);
}
.app-update-meta {
  margin: 0 0 1rem;
}
.app-update-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.app-update-actions .btn {
  width: 100%;
}

/* 이어하기 선택 모달 */
.continue-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}
.continue-modal {
  width: min(92vw, 360px);
  padding: 1.35rem 1.2rem 1.1rem;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.28);
  text-align: center;
}
.continue-modal h3 {
  margin: 0 0 0.45rem;
  font-size: 1.15rem;
  color: var(--text);
}
.continue-modal-meta {
  margin: 0 0 1.1rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}
.continue-modal-actions {
  display: grid;
  gap: 0.65rem;
}
.continue-modal-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 52px;
  padding: 0.85rem 1rem;
  border: 0;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}
.continue-modal-btn.restart {
  background: #eef2f7;
  color: #334155;
}
.continue-modal-btn.resume {
  background: linear-gradient(120deg, #00c566, #0099ff);
  color: #fff;
}
.continue-modal-resume-label {
  font-size: 1.05rem;
}
.continue-modal-rewards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  font-weight: 700;
  opacity: 0.95;
}
.continue-modal-reward {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}
.continue-modal-cancel {
  margin-top: 0.75rem;
  width: 100%;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.stat-row .label { display: block; color: var(--muted); font-size: 0.78rem; }
.stat-row strong { color: var(--accent2); }
.stat-link {
  display: inline-block;
  text-decoration: none;
  color: inherit;
}
.stat-link strong {
  border-bottom: 1px dashed color-mix(in srgb, var(--accent2) 45%, transparent);
}
.stat-link:active strong,
.stat-link:hover strong {
  opacity: 0.85;
}

.menu-list { display: grid; gap: 0.45rem; width: 100%; }
.menu-list a {
  display: block;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; padding: 0.75rem 1.15rem;
  cursor: pointer; font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.btn-primary {
  background: linear-gradient(120deg, #00d084, #00b4ff);
  color: #fff;
}
.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-sm { padding: 0.5rem 0.85rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.link-btn {
  background: none; border: 0; color: var(--accent2);
  cursor: pointer; font-size: 0.85rem; font-weight: 700;
}

.alert {
  padding: 0.75rem 0.9rem; border-radius: 14px; margin-bottom: 0.65rem;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #be123c;
}
.alert.ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.muted { color: var(--muted); }
.mt-1 { margin-top: 0.75rem; }
.mt-2 { margin-top: 1rem; }

.my-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.wallet-log-card {
  margin-top: 0.75rem;
}
.wallet-log-page-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
}
.wallet-log-page-head .page-title {
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
}
.wallet-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.wallet-log-head h3 {
  margin: 0;
  font-size: 1rem;
}
.wallet-log-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}
.wallet-log-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.wallet-log-tabs button.active {
  color: var(--accent2);
  border-color: color-mix(in srgb, var(--accent2) 35%, var(--line));
  background: color-mix(in srgb, var(--accent2) 10%, #fff);
}
.wallet-log-empty {
  padding: 0.85rem 0.25rem 0.35rem;
}
.wallet-log-list {
  display: grid;
}
.wallet-log-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.7rem 0.15rem;
  border-bottom: 1px solid var(--line);
}
.wallet-log-row:last-child {
  border-bottom: 0;
}
.wallet-log-main {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.wallet-log-main strong {
  font-size: 0.92rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wallet-log-amount {
  font-size: 0.95rem;
  font-weight: 800;
  white-space: nowrap;
}
.wallet-log-amount.plus { color: #047857; }
.wallet-log-amount.minus { color: #be123c; }
.wallet-log-sentinel { height: 1px; }
.wallet-log-more { display:flex; justify-content:center; padding:0.75rem 0 0.25rem; }

.inquiry-page-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
}
.inquiry-page-head .page-title {
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
}

.inbox-list { display: grid; }
.inbox-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  padding: 0.85rem 0.15rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.inbox-row:last-child { border-bottom: 0; }
.inbox-row.unread .inbox-row-main strong { color: #0b5cab; }
.inbox-row-main {
  display: grid;
  gap: 0.22rem;
  min-width: 0;
}
.inbox-row-main strong {
  font-size: 0.94rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-row-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}
.inbox-row-meta {
  display: grid;
  justify-items: end;
  gap: 0.35rem;
  flex-shrink: 0;
}
.inbox-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4d6d;
}
.inbox-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: #ff4d6d;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  font-style: normal;
  line-height: 1;
}
.menu-inbox-link,
.my-drawer-inbox {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.inquiry-list {
  display: grid;
}
.inquiry-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  padding: 0.75rem 0.1rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.inquiry-row:last-child { border-bottom: 0; }
.inquiry-row-main {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.inquiry-row-main strong {
  font-size: 0.94rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inquiry-row-main .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inquiry-row-meta {
  display: grid;
  justify-items: end;
  gap: 0.25rem;
  flex-shrink: 0;
}
.badge.inq-open { color: #b45309; background: #fef3c7; }
.badge.inq-answered { color: #1d4ed8; background: #dbeafe; }
.badge.inq-closed { color: #6b7280; background: #f3f4f6; }
.inquiry-subject-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}
.inquiry-thread {
  display: grid;
  gap: 0.65rem;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding: 0.85rem;
}
.inquiry-bubble {
  max-width: 88%;
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  background: #f1f5f9;
}
.inquiry-bubble.me {
  justify-self: end;
  background: color-mix(in srgb, var(--accent2) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent2) 22%, var(--line));
}
.inquiry-bubble.admin {
  justify-self: start;
}
.inquiry-bubble-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.inquiry-bubble-meta strong { font-size: 0.8rem; }
.inquiry-bubble p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.45;
}
.inquiry-composer {
  display: grid;
  gap: 0.55rem;
}
.inquiry-composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  resize: vertical;
  min-height: 4.5rem;
  background: #fff;
  color: var(--text);
}
.inquiry-attach {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.inquiry-attach-btn { cursor: pointer; }
.inquiry-attach-preview { margin-top: 0.15rem; }
.inquiry-attach-preview img,
.inquiry-msg-image img {
  display: block;
  max-width: min(100%, 240px);
  max-height: 240px;
  border-radius: 10px;
  object-fit: cover;
}
.inquiry-msg-image { display: inline-block; margin-top: 0.4rem; }


.bottom-nav {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--line);
  padding: 0.35rem 0 calc(0.4rem + var(--safe-bottom));
  z-index: 50;
  box-shadow: 0 -6px 20px rgba(60,120,200,0.08);
}
.app-install-banner {
  position: relative;
  flex: 0 0 auto;
  z-index: 45;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem 0.75rem;
  align-items: center;
  margin: 0 0.65rem 0.45rem;
  padding: 0.75rem 2rem 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent2) 28%, var(--line));
  background: linear-gradient(135deg, #f0f9ff 0%, #ecfdf5 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.app-install-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.app-install-copy strong {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
}
.app-install-copy span {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
.app-install-cta {
  white-space: nowrap;
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
}
.app-install-close {
  position: absolute;
  top: 0.2rem;
  right: 0.35rem;
  width: 1.6rem;
  height: 1.6rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.app-shell.has-install-banner .main-area {
  padding-bottom: 0.25rem;
}
.bottom-nav a {
  position: relative;
  display: grid;
  place-items: center;
  gap: 0.15rem;
  margin: 0.15rem 0.2rem;
  padding: 0.35rem 0.2rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  min-height: 52px;
  border-radius: 14px;
  transition: color 0.15s ease, background 0.15s ease;
}
.bottom-nav .nav-ico {
  font-size: 1.35rem;
  line-height: 1;
  filter: grayscale(0.15);
  opacity: 0.85;
}
.bottom-nav a small {
  font-weight: 700;
}
/* exact-active: 홈(/)이 다른 페이지에서도 켜지지 않도록 */
.bottom-nav a.router-link-exact-active {
  color: var(--accent2);
  background: color-mix(in srgb, var(--accent2) 12%, #fff);
  font-weight: 800;
}
.bottom-nav a.router-link-exact-active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent2);
}
.bottom-nav a.router-link-exact-active .nav-ico {
  transform: scale(1.1);
  filter: none;
  opacity: 1;
}
.bottom-nav a.router-link-exact-active small {
  font-weight: 800;
}

.auth-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: min(70vh, calc(100dvh - 140px));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}
.auth-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  box-sizing: border-box;
}
.auth-panel h2 {
  margin: 0 0 1.55rem;
  font-size: 1.25rem;
  word-break: keep-all;
}
.auth-panel .muted {
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 0.82rem;
  line-height: 1.4;
}
.form {
  display: grid;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.form label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 0;
}
.form input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0.85rem 0.9rem;
  font-size: 16px;
  box-shadow: inset 0 1px 2px rgba(60,120,200,0.06);
}
.form input.input-readonly,
.form input[readonly] {
  background: #f3f6fb;
  color: var(--muted);
  cursor: not-allowed;
}
.auth-panel .btn {
  width: 100%;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.9rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.btn-kakao {
  display: block;
  width: 100%;
  background: #fee500;
  color: #191919;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.15rem;
  cursor: pointer;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.btn-kakao:hover { filter: brightness(0.98); }
.btn-google {
  display: block;
  width: 100%;
  margin-top: 1.1rem;
  background: linear-gradient(120deg, #00d084, #00b4ff);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.15rem;
  cursor: pointer;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.btn-google:hover { filter: brightness(0.96); }
.btn-facebook {
  display: block;
  width: 100%;
  margin-top: 1.1rem;
  background: #1877f2;
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.15rem;
  cursor: pointer;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.btn-facebook:hover { filter: brightness(0.96); }
.btn-apple {
  display: block;
  width: 100%;
  margin-top: 1.1rem;
  background: #000;
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.15rem;
  cursor: pointer;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.btn-apple:hover { filter: brightness(1.15); }
.auth-demo-btn {
  display: block;
  width: 100%;
  margin-top: 0.85rem;
  text-align: center;
  padding: 0.55rem 0.35rem;
}
.auth-link {
  display: inline-block;
  margin-top: 0.35rem;
  color: var(--accent2);
  font-weight: 700;
}
.auth-legal {
  margin-top: 1.45rem;
  text-align: center;
  line-height: 1.5;
}
.auth-legal a {
  color: var(--accent2);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.agree-list {
  display: grid;
  gap: 0.55rem;
  margin: 0.15rem 0 0.35rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: #f3f8ff;
  border: 1px solid var(--line);
}
.agree-item {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  line-height: 1.4;
  white-space: nowrap;
}
.agree-item span {
  display: inline;
  min-width: 0;
  white-space: normal;
}
.agree-item input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent2);
}
.agree-item a {
  color: var(--accent2);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.tabs button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  min-height: 36px;
}
.tabs button.active {
  color: #fff;
  background: var(--accent2);
  border-color: var(--accent2);
}
.period-tabs button { flex: 1 1 auto; min-width: 4.2rem; }
.period-tabs.is-dated button {
  font-size: 0.78rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  min-width: 0;
}
.game-tabs {
  max-width: 100%;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.15rem;
}
.game-tabs button { flex: 0 0 auto; white-space: nowrap; }

.play-page .play-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.75rem;
}
.game-canvas {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #1a2b42;
  touch-action: none;
  box-shadow: var(--shadow);
}
.game-2048-wrap { text-align: center; }
.game-2048 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: #c8e4ff;
  padding: 8px;
  border-radius: 14px;
}
.game-2048 .tile {
  aspect-ratio: 1;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,0.65);
  font-weight: 800;
  color: var(--text);
}
.game-2048 .tile.t2 { background: #dbeafe; }
.game-2048 .tile.t4 { background: #bfdbfe; }
.game-2048 .tile.t8 { background: #93c5fd; color:#fff; }
.game-2048 .tile.t16 { background: #60a5fa; color:#fff; }
.game-2048 .tile.t32 { background: #3b82f6; color:#fff; }
.game-2048 .tile.t64 { background: #2563eb; color:#fff; }
.game-2048 .tile.t128, .game-2048 .tile.t256, .game-2048 .tile.t512, .game-2048 .tile.t1024, .game-2048 .tile.t2048 {
  background: linear-gradient(135deg, var(--gold), var(--orange)); color:#fff;
}

.pad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  gap: 10px;
  max-width: 280px;
  margin: 0.85rem auto 0;
}
.pad-grid button {
  height: 56px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent2);
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.pad-grid button:active { background: #e0f2fe; }
.pad-grid button:nth-child(1) { grid-column: 2; }
.pad-grid button:nth-child(2) { grid-column: 1; grid-row: 2; }
.pad-grid button:nth-child(3) { grid-column: 2; grid-row: 2; }
.pad-grid button:nth-child(4) { grid-column: 3; grid-row: 2; }

@media (max-width: 380px) {
  .game-grid { grid-template-columns: 1fr; }
  .reward-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
  .hero-top { flex-direction: column; }
  .point-box { text-align: left; width: 100%; }
}

@media (min-width: 521px) {
  :root {
    --app-width: 480px;
    --page-pad: 1rem;
  }

  body {
    background: linear-gradient(180deg, #dbeafe 0%, #eef6ff 100%);
    display: flex;
    justify-content: center;
    align-items: stretch;
  }

  .app-shell {
    width: var(--app-width);
    max-width: var(--app-width);
    min-width: var(--app-width);
    box-shadow: 0 0 0 1px var(--line), 0 24px 50px rgba(60,120,200,0.18);
    border-radius: 0;
  }

  .game-grid,
  .reward-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  :root { --app-width: 480px; }
}

/* Admin */
.admin-tabs { margin-bottom: 0.75rem; }
.admin-stats { margin-bottom: 0.85rem; }
.admin-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.admin-search input {
  flex: 1;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.7rem 0.85rem;
  font-size: 16px;
}
.table-wrap { overflow-x: auto; width: 100%; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.65rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.admin-table th { color: var(--muted); font-size: 0.8rem; }
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.btn-danger {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}
.admin-hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}
.small { font-size: 0.78rem; }
.badge.admin { color: #6d28d9; background: #ede9fe; }
.badge.user { color: #1d4ed8; background: #dbeafe; }
.form select {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0.7rem 0.85rem;
}

.invite-page .invite-hero { text-align: center; }
.invite-reward-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0.85rem 0 1rem;
  text-align: left;
}
.invite-reward-row > div {
  background: color-mix(in srgb, #fff 70%, #e8f6ff);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
}
.invite-reward-row .label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}
.invite-code-box {
  margin: 0.4rem auto 1rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, #f0fbff, #eef8f3);
  border: 1px dashed color-mix(in srgb, var(--accent2) 35%, var(--line));
}
.invite-code-box .label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}
.invite-code {
  font-size: 1.55rem;
  letter-spacing: 0.14em;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}
.invite-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.invite-actions .btn-primary {
  grid-column: 1 / -1;
}
.invite-stats { margin-top: 0; }
.invite-list { display: grid; gap: 0.55rem; margin-top: 0.75rem; }
.invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid var(--line);
}
.invite-row-reward {
  font-weight: 800;
  color: var(--accent2);
  white-space: nowrap;
}
