/* ─── Reset & Base ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #232738;
  --border:    #2e3347;
  --text:      #e8eaf0;
  --muted:     #8890a8;
  --accent:    #4f7fff;
  --accept:    #2ecc71;
  --reject:    #e74c3c;
  --gold:      #f5c518;

  --corporate: #4f7fff;
  --leisure:   #3ec97e;
  --transient: #f5a623;
}

html, body { height: 100%; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Screens ───────────────────────────────────── */
.screen { width: 100%; min-height: 100dvh; }
.screen.hidden { display: none !important; }
.screen.active { display: block; }

/* ─── Utility ───────────────────────────────────── */
.hidden { display: none !important; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }

.trainer-avatar {
  display: block;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 16px;
}

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

/* ─── Buttons ───────────────────────────────────── */
.btn {
  display: block; width: 100%;
  padding: 14px 20px;
  border-radius: 10px; border: none;
  cursor: pointer; font-size: 15px; font-weight: 700;
  transition: opacity .15s, transform .1s;
  text-align: center; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }

/* ─── Form ──────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 11px; color: var(--muted);
  font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: 7px;
}
.form-group input {
  width: 100%; padding: 12px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 16px;
  outline: none; transition: border-color .15s;
}
.form-group input:focus { border-color: var(--accent); }

.error-msg {
  margin-top: 10px; padding: 10px 14px;
  background: rgba(231,76,60,.12); border-radius: 8px;
  color: var(--reject); font-size: 13px;
}

/* ══════════════════════════════════════════════════
   WELCOME SCREEN
══════════════════════════════════════════════════ */
.welcome-wrap {
  max-width: 420px; margin: 0 auto;
  padding: 48px 20px 32px;
  display: flex; flex-direction: column; gap: 20px;
}

.logo { text-align: center; }
.logo-icon { font-size: 52px; line-height: 1; margin-bottom: 10px; }
.logo h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.logo-sub { color: var(--muted); font-size: 13px; margin-top: 5px; }

.scenario-brief {
  background: var(--surface2); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.brief-row { display: flex; justify-content: space-between; font-size: 13px; }
.brief-label { color: var(--muted); }
.brief-val   { font-weight: 700; }

.welcome-hint {
  font-size: 13px; color: var(--muted);
  margin-bottom: 16px; line-height: 1.6;
}

.leaderboard-link {
  text-align: center; font-size: 13px;
  color: var(--muted); text-decoration: none;
}
.leaderboard-link:hover { color: var(--text); }

/* ══════════════════════════════════════════════════
   GAME SCREEN
══════════════════════════════════════════════════ */

/* Top bar */
.game-topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-left    { display: flex; align-items: center; gap: 10px; }
.topbar-avatar  { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.topbar-name    { font-weight: 700; font-size: 14px; }
.topbar-revenue { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-revenue span { color: var(--accept); font-weight: 700; }
.round-indicator {
  font-size: 13px; font-weight: 700;
  background: var(--surface2); border-radius: 20px;
  padding: 4px 12px; color: var(--muted);
}

/* Mini inventory bar */
.mini-inventory {
  display: flex; height: 10px; width: 100%;
  background: var(--surface2); overflow: hidden;
}
.mini-seg {
  height: 100%; transition: width .4s;
}
.mini-seg.corporate { background: var(--corporate); }
.mini-seg.leisure   { background: var(--leisure); }
.mini-seg.transient { background: var(--transient); }
.mini-seg.free      { background: var(--surface2); flex: 1; }

/* Game body */
.game-body {
  max-width: 480px; margin: 0 auto;
  padding: 16px 16px 8px;
  display: flex; flex-direction: column; gap: 12px;
}

/* ── Inquiry Card ── */
.inquiry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}
.inq-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 14px;
}
.segment-badge {
  padding: 5px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}
.segment-badge.corporate { background: rgba(79,127,255,.2);  color: var(--corporate); }
.segment-badge.leisure   { background: rgba(62,201,126,.2);  color: var(--leisure); }
.segment-badge.transient { background: rgba(245,166,35,.2);  color: var(--transient); }

.inq-idx { font-size: 12px; color: var(--muted); }

.inq-dates {
  font-size: 13px; color: var(--muted); margin-bottom: 14px;
}
.inq-dates strong { color: var(--text); }

.inq-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 14px;
}
.inq-stat {
  background: var(--surface2); border-radius: 10px;
  padding: 10px; text-align: center;
}
.inq-stat-val   { font-size: 20px; font-weight: 800; line-height: 1.1; }
.inq-stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; margin-top: 2px; }

.inq-total {
  background: var(--surface2); border-radius: 10px;
  padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.inq-total-label { font-size: 13px; color: var(--muted); }
.inq-total-val   { font-size: 24px; font-weight: 800; color: var(--accept); }

.inq-note {
  margin-top: 10px; padding: 8px 12px;
  background: rgba(79,127,255,.08);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 12px; color: var(--muted); line-height: 1.5;
}

/* ── Forecast strip ── */
.forecast-strip {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}
.forecast-strip-title {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .07em; margin-bottom: 8px; font-weight: 700;
}
.forecast-nights {
  display: flex; gap: 4px;
}
.fc-night {
  flex: 1; text-align: center;
  padding: 6px 2px; border-radius: 6px;
  font-size: 10px;
}
.fc-night.in-stay {
  background: var(--surface2);
  outline: 2px solid var(--accent);
}
.fc-day  { color: var(--muted); margin-bottom: 3px; }
.fc-adr  { font-weight: 700; font-size: 11px; }
.fc-occ  { color: var(--muted); font-size: 9px; margin-top: 1px; }

/* ── Decision buttons ── */
.decision-area {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.btn-decision {
  padding: 18px 12px; border: 2px solid transparent;
  border-radius: 14px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-weight: 700; background: var(--surface2);
  transition: transform .1s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-decision:active { transform: scale(.95); }
.btn-accept { border-color: var(--accept); color: var(--accept); }
.btn-reject { border-color: var(--reject); color: var(--reject); }
.btn-accept:active, .btn-accept.chosen { background: var(--accept); color: #fff; }
.btn-reject:active, .btn-reject.chosen { background: var(--reject); color: #fff; }
.di-icon { font-size: 26px; }
.di-main { font-size: 15px; font-weight: 800; }
.di-th   { font-size: 12px; opacity: .8; }

/* ── Timer bar ── */
.timer-bar-wrap {
  position: relative; height: 6px;
  background: var(--surface2); border-radius: 3px; overflow: hidden;
}
.timer-bar {
  height: 100%; width: 100%; border-radius: 3px;
  background: var(--accept);
  transform-origin: left;
  transition: background .5s;
}
.timer-bar.urgent { background: var(--reject); }
.timer-label {
  position: absolute; right: 0; top: -18px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  min-width: 16px; text-align: right;
}

/* ── After decision ── */
.next-area {
  display: flex; flex-direction: column; gap: 10px;
}
.decision-feedback {
  padding: 12px 16px;
  border-radius: 10px; font-size: 13px; line-height: 1.6;
}
.decision-feedback.accepted {
  background: rgba(46,204,113,.1);
  border: 1px solid rgba(46,204,113,.3);
  color: var(--accept);
}
.decision-feedback.rejected {
  background: rgba(231,76,60,.08);
  border: 1px solid rgba(231,76,60,.2);
  color: var(--muted);
}
.decision-feedback.no-room {
  background: rgba(245,166,35,.1);
  border: 1px solid rgba(245,166,35,.3);
  color: var(--transient);
}

/* ── Booking drawer ── */
.booking-drawer {
  max-width: 480px; margin: 0 auto;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.drawer-toggle {
  width: 100%; padding: 12px 16px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
}
.drawer-body { padding: 0 16px 16px; }
.booking-item {
  padding: 8px 10px; margin-bottom: 6px;
  background: var(--surface); border-radius: 8px;
  border-left: 3px solid transparent; font-size: 12px;
}
.booking-item.corporate { border-color: var(--corporate); }
.booking-item.leisure   { border-color: var(--leisure); }
.booking-item.transient { border-color: var(--transient); }
.booking-item-top { display: flex; justify-content: space-between; }
.booking-rev { color: var(--accept); font-weight: 700; }
.booking-meta { color: var(--muted); margin-top: 2px; }

/* ══════════════════════════════════════════════════
   RESULTS SCREEN
══════════════════════════════════════════════════ */
.results-wrap {
  max-width: 480px; margin: 0 auto;
  padding: 0 0 48px;
}

.results-hero {
  text-align: center;
  padding: 32px 20px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.results-hero-name  { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.results-revpar-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.results-revpar     { font-size: 52px; font-weight: 800; color: var(--accept); line-height: 1.1; margin: 6px 0 4px; }
.results-sub        { font-size: 13px; color: var(--muted); }

/* Pattern tab */
.pattern-section { margin-bottom: 20px; }
.pattern-section h3 { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.pattern-hotel-type {
  background: linear-gradient(135deg, rgba(79,127,255,.12), rgba(62,201,126,.08));
  border: 1px solid rgba(79,127,255,.25);
  border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.pattern-hotel-type h2 { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.pattern-hotel-type p  { font-size: 13px; color: var(--muted); line-height: 1.6; }
.pattern-curve {
  display: flex; gap: 4px; align-items: flex-end;
  height: 64px; margin-bottom: 8px;
}
.pc-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pc-bar { width: 100%; border-radius: 3px 3px 0 0; }
.pc-label { font-size: 9px; color: var(--muted); }
.pattern-insight {
  background: var(--surface2); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px;
  border-left: 3px solid var(--accent);
  font-size: 12px; line-height: 1.7; color: var(--muted);
}
.pattern-insight strong { color: var(--text); }
.pattern-insight.warn { border-color: var(--transient); }
.pattern-insight.good { border-color: var(--accept); }
.pattern-strategy {
  background: var(--surface2); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 8px;
}
.ps-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.ps-row { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); line-height: 1.6; margin-bottom: 6px; }
.ps-row .ps-icon { flex-shrink: 0; font-size: 14px; }

/* Tabs */
.rtabs {
  display: flex; background: var(--surface2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.rtab {
  flex: none; padding: 12px 14px; white-space: nowrap;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.rtab.active { color: var(--text); border-bottom-color: var(--accent); }

.rpanel { padding: 16px; }

/* Summary */
.summary-kpi {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 16px;
}
.kpi-box {
  background: var(--surface2); border-radius: 12px;
  padding: 14px; text-align: center;
}
.kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi-val   { font-size: 22px; font-weight: 800; margin-top: 5px; }
.kpi-val.good { color: var(--accept); }
.kpi-val.bad  { color: var(--reject); }
.kpi-val.neutral { color: var(--text); }

.seg-bars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.seg-bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.seg-bar-label { width: 80px; color: var(--muted); flex-shrink: 0; }
.seg-bar-track { flex: 1; height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.seg-bar-fill  { height: 100%; border-radius: 4px; }
.seg-bar-fill.corporate { background: var(--corporate); }
.seg-bar-fill.leisure   { background: var(--leisure); }
.seg-bar-fill.transient { background: var(--transient); }
.seg-bar-fill.walkin    { background: #666; }
.seg-bar-val { width: 64px; text-align: right; font-weight: 700; font-size: 12px; }

/* Displacement */
.disp-alert {
  padding: 14px 16px; border-radius: 12px; margin-bottom: 14px;
  font-size: 13px; line-height: 1.7;
}
.disp-alert.has-cost {
  background: rgba(231,76,60,.1);
  border: 1px solid rgba(231,76,60,.25);
}
.disp-alert.no-cost {
  background: rgba(46,204,113,.1);
  border: 1px solid rgba(46,204,113,.25);
  color: var(--accept);
}
.disp-alert strong { color: var(--reject); }

.disp-item {
  background: var(--surface2); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px; font-size: 12px;
}
.disp-item-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.disp-item-cost   { color: var(--reject); font-weight: 800; font-size: 14px; }
.disp-item-detail { color: var(--muted); line-height: 1.6; }

/* Decisions review */
.decision-review-item {
  background: var(--surface2); border-radius: 12px;
  padding: 14px; margin-bottom: 10px;
  border-left: 4px solid transparent;
}
.decision-review-item.accepted-good { border-color: var(--accept); }
.decision-review-item.accepted-trap { border-color: var(--transient); }
.decision-review-item.rejected-good { border-color: var(--accept); }
.decision-review-item.rejected-bad  { border-color: var(--reject); }
.decision-review-item.no-room       { border-color: var(--muted); }

.dr-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.dr-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 12px; }
.dr-badge.accept { background: rgba(46,204,113,.2); color: var(--accept); }
.dr-badge.reject { background: rgba(231,76,60,.15);  color: var(--reject); }
.dr-badge.noroom { background: rgba(245,166,35,.2);  color: var(--transient); }
.dr-verdict { font-size: 11px; color: var(--muted); text-align: right; }
.dr-inq-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.dr-comment { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Results actions */
.results-actions {
  padding: 0 16px;
}
.submit-status {
  text-align: center; font-size: 13px;
  padding: 10px; border-radius: 8px; margin-top: 8px;
}
.submit-status.success {
  background: rgba(46,204,113,.1); color: var(--accept);
}
.submit-status.error {
  background: rgba(231,76,60,.1); color: var(--reject);
}

/* ── Leaderboard page ─────────────────────────── */
.lb-wrap {
  max-width: 480px; margin: 0 auto;
  padding: 24px 16px 48px;
}
.lb-header {
  text-align: center; margin-bottom: 20px;
}
.lb-header h1 { font-size: 22px; font-weight: 800; }
.lb-header p  { color: var(--muted); font-size: 13px; margin-top: 4px; }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; padding: 8px 10px;
  border-bottom: 1px solid var(--border); text-align: left;
}
.lb-table td { padding: 10px; font-size: 14px; border-bottom: 1px solid var(--border); }
.lb-table tr.rank-1 td { background: rgba(245,197,24,.06); }
.lb-revpar { font-weight: 800; font-size: 16px; color: var(--accept); }
.lb-medal  { font-size: 18px; }
.lb-empty  { text-align: center; color: var(--muted); padding: 32px; font-size: 14px; }
.lb-reset  {
  margin-top: 24px; padding: 10px 20px;
  background: none; border: 1px solid var(--border);
  border-radius: 8px; color: var(--muted); cursor: pointer;
  font-size: 13px; display: block; margin-left: auto;
}
.lb-reset:hover { color: var(--reject); border-color: var(--reject); }
.lb-updated { text-align: center; font-size: 11px; color: var(--muted); margin-top: 12px; }

/* ─── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
