:root {
  --bg: #090b10;
  --surface: #121621;
  --surface-2: #1a2030;
  --border: #273046;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --purple: #a855f7;
  --gold: #fbbf24;
  --green: #34d399;
  --red: #f87171;
  --orange: #fb923c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(circle at top, #171e30 0%, #07090d 70%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 44px;
}

.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: calc(100vh - 44px);
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 14px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.btn {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
  text-align: left;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: #20283d;
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-color: transparent;
  text-align: center;
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-gold {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #111827;
  border-color: transparent;
  text-align: center;
  font-weight: 800;
}

/* Lobby */
.hero-header {
  text-align: center;
  padding: 16px 10px 8px;
}

.hero-kicker {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}

.hero-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  background: linear-gradient(90deg, #f8fafc, #38bdf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.sector-card {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.sector-card.selected {
  border-color: var(--accent);
  background: #131d2e;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
}

.sector-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.sector-name {
  font-size: 15px;
  font-weight: 800;
}

.sector-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 4px;
}

.input-row {
  display: flex;
  gap: 8px;
}

.text-input, .select-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
}

/* HUD */
.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

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

.stat-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 8px;
}

.stat-label {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.stat-val {
  font-size: 14px;
  font-weight: 800;
  margin-top: 2px;
}

.bar-wrap {
  width: 100%;
  height: 5px;
  background: #0b0e16;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* Masks */
.mask-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.mask-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 4px;
  text-align: center;
  cursor: pointer;
  color: var(--text);
  font-size: 11px;
}

.mask-btn.active {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.12);
}

/* Event Narrative */
.event-chapter {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.event-title {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 8px;
}

.event-body {
  font-size: 13.5px;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre-line;
}

.sense-box {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px dashed rgba(56, 189, 248, 0.45);
  font-size: 12px;
  color: #bae6fd;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.choice-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold);
  margin-bottom: 4px;
}

.choice-effect {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* Night Tabs */
.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.tab-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 4px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.tab-btn.active {
  color: var(--text);
  border-color: var(--accent);
  background: #172338;
}

.market-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.market-row:last-child {
  border-bottom: none;
}

.mini-btn {
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.mini-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Roulette Mini-game */
.roulette-track {
  position: relative;
  height: 26px;
  background: #0f172a;
  border-radius: 999px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 16px 0;
}

.roulette-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 38%;
  width: 24%;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.35), rgba(52, 211, 153, 0.55), rgba(251, 191, 36, 0.35));
}

.roulette-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  background: #fff;
  box-shadow: 0 0 10px #fff;
}

/* Business Card Ending */
.biz-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1.5px solid #475569;
  border-radius: 14px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.biz-card::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.25), transparent 70%);
}

/* Blind Ticker */
.blind-ticker-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: #0d111a;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 40;
}

.blind-badge {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  margin-left: 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.blind-marquee {
  overflow: hidden;
  flex: 1;
  margin-left: 10px;
}

.blind-track {
  display: inline-block;
  white-space: nowrap;
  font-size: 12px;
  color: #cbd5e1;
  animation: marquee 28s linear infinite;
}

@keyframes marquee {
  0% { transform: translateX(40%); }
  100% { transform: translateX(-100%); }
}

/* Modal */
.modal-root {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-root.hidden {
  display: none;
}

.modal-box {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  max-height: 85vh;
  overflow-y: auto;
}

.ssr-flash {
  border-color: var(--gold);
  box-shadow: 0 0 32px rgba(251, 191, 36, 0.45);
}
