/* game.css — landscape shell, theme tokens and game screens. Loaded after builder.css */
:root {
  --bg: #1b1815; --panel: #24201c; --panel2: #2c2721; --line: #3a342c; --line2: #4a4338;
  --text: #f0e9dc; --mut: #b0a695; --dim: #9a9080;
  --acc: #d97b4a; --acc2: #e0b05a; --good: #8fb573; --bad: #d1665b; --blue: #a79985;
  --rail: 60px; --hud: 44px; --lp: clamp(220px, 30vw, 300px);
  --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px);
  --display: 'Bricolage Grotesque', 'Source Sans 3', sans-serif;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); overscroll-behavior: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font-family: inherit; }
#app {
  position: fixed; inset: 0; display: grid;
  grid-template-columns: calc(var(--rail) + var(--sal)) minmax(0, 1fr);
  grid-template-rows: calc(var(--hud) + var(--sat)) minmax(0, 1fr);
  padding-right: var(--sar); padding-bottom: var(--sab);
}

/* ---------- HUD ---------- */
#hud {
  grid-column: 1 / 3; display: flex; align-items: center; gap: 14px;
  padding: var(--sat) 10px 0 calc(var(--sal) + 10px); background: var(--panel); border-bottom: 1px solid var(--line); z-index: 100;
}
.hud-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hud-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--acc); color: #2a160c; display: grid; place-items: center; font-size: 12px; flex: none; }
.hud-name { font: 700 14px var(--display); letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.hud-date { font: 700 12px var(--num); color: var(--acc2); padding: 5px 10px; border: 1px solid var(--line2); border-radius: 8px; white-space: nowrap; }
.hud-stats { display: flex; gap: 14px; margin-left: auto; }
.hud-stat { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.hud-stat > i { font-size: 12px; color: var(--mut); width: 14px; text-align: center; }
.hud-stat b { display: block; font: 700 13px var(--num); line-height: 1.05; }
.hud-stat span { display: block; font-size: 11px; color: var(--dim); font-weight: 700; }
.hud-stat b.neg { color: var(--bad); }
.hud-time { display: flex; gap: 3px; }
.hud-btn { min-width: 32px; height: 30px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); color: var(--mut); font-size: 11px; display: grid; place-items: center; padding: 0 8px; font-weight: 700; }
.hud-btn.wide { font: 700 11px var(--num); }
.hud-btn.on { background: var(--acc); border-color: var(--acc); color: #2a160c; }
.hud-btn:active { transform: scale(.95); }

/* ---------- RAIL ---------- */
#rail { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px 6px calc(var(--sal) + 4px); background: var(--panel); border-right: 1px solid var(--line); z-index: 90; overflow-y: auto; }
.rail-btn { flex: 1 1 0; min-height: 42px; max-height: 64px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--dim); position: relative; }
.rail-btn i { font-size: 16px; }
.rail-btn span { font-size: 7.5px; font-weight: 800; }
.rail-btn.active { color: var(--acc); background: rgba(217, 123, 74, .1); }
.rail-btn.active::before { content: ''; position: absolute; left: -4px; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: var(--acc); }
.rail-btn .dot { position: absolute; top: 6px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

/* ---------- SCREENS ---------- */
#main { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.screen { position: absolute; inset: 0; display: none; overflow: hidden; }
.screen.active { display: block; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
#screen-studio.active { display: grid; grid-template-columns: var(--lp) minmax(0, 1fr); }
#screen-studio .left-panel, #screen-studio .stage-area, #screen-studio .right-panel { grid-area: auto; min-height: 0; }
#screen-studio .stage-area { min-width: 0; }
#screen-studio .right-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(270px, 62%); z-index: 80; transform: translateX(102%);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1); box-shadow: -18px 0 40px rgba(0, 0, 0, .5);
}
#screen-studio.rp-open .right-panel { transform: none; }
#screen-studio.lab-mode.active { grid-template-columns: minmax(0, 1fr); }
#screen-studio.lab-mode .left-panel, #screen-studio.lab-mode .right-panel, #screen-studio.lab-mode #btn-specs, #screen-studio.lab-mode #launch-bar { display: none; }
@media (min-width: 1180px) {
  #screen-studio.active:not(.lab-mode) { grid-template-columns: var(--lp) minmax(0, 1fr) 270px; }
  #screen-studio .right-panel { position: static; transform: none; box-shadow: none; width: auto; }
  #btn-specs { display: none; }
}
#phone-fit { transform-origin: center center; flex: none; }
.stage-area { background: radial-gradient(ellipse at 50% 42%, #2c2721 0%, #1b1815 78%); }
.stage-area::before { background-size: 40px 40px; }
#btn-specs { position: absolute; top: 8px; left: 8px; z-index: 60; }
#launch-bar { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; gap: 6px; align-items: center; background: rgba(36, 32, 28, .86); backdrop-filter: blur(10px); border: 1px solid var(--line2); border-radius: 12px; padding: 4px; }
#launch-bar input { background: transparent; border: 0; outline: 0; color: var(--text); font: 700 13px var(--display); width: 130px; padding: 0 8px; }
#launch-bar .rd-btn { margin: 0; padding: 8px 14px; border-radius: 9px; font-size: 11px; box-shadow: none; }
.view-controls { top: 8px; right: 8px; gap: 4px; flex-direction: column; }
.view-btn { width: 32px; height: 32px; }
.dimension-display { bottom: auto; top: 12px; font-size: 11px; padding: 4px 10px; }
.zoom-container { bottom: 8px; right: 8px; padding: 5px 10px; }
.stage-area .rd-layout { padding: 12px 16px 18px; }
.rd-title { font-family: var(--display); font-size: 18px; }
.rd-title-icon { background: var(--acc); box-shadow: none; color: #2a160c; }
.rd-pill { background: rgba(217, 123, 74, .1); }
.rd-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.rd-btn { background: var(--acc); color: #2a160c; box-shadow: none; }
.rd-btn:hover { background: #e08a5a; box-shadow: none; }
.rd-btn.secondary { background: var(--panel2); color: var(--mut); border: 1px solid var(--line2); }
.app-logo-mark { background: var(--acc); box-shadow: none; }

/* ---------- builder locks ---------- */
.opt-btn, .feature-chip, .part-chip { position: relative; min-height: 34px; }
.locked { opacity: .36; filter: grayscale(.7); }
.locked::after { content: attr(data-lock); position: absolute; top: 2px; right: 4px; font: 700 11px var(--num); color: var(--acc2); }
.feature-chip.locked::after { top: 50%; transform: translateY(-50%); right: 8px; }
.feature-chip.locked .feature-status { visibility: hidden; }

/* ---------- common ---------- */
.pad { padding: 12px 14px 18px; }
.scr-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.scr-head h2 { font: 700 19px var(--display); letter-spacing: -.2px; }
.scr-head .sub { font-size: 11px; color: var(--mut); }
.scr-head .grow { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.card h3 { font: 700 11px 'Source Sans 3'; color: var(--mut); margin-bottom: 8px; display: flex; align-items: center; gap: 7px; }
.btn { padding: 8px 14px; border-radius: 9px; font-size: 11px; font-weight: 700; background: var(--panel2); border: 1px solid var(--line2); color: var(--text); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; justify-content: center; min-height: 34px; }
.btn.pri { background: var(--acc); border-color: var(--acc); color: #2a160c; }
.btn.good { background: rgba(143, 181, 115, .14); border-color: rgba(143, 181, 115, .4); color: var(--good); }
.btn.bad { background: rgba(209, 102, 91, .12); border-color: rgba(209, 102, 91, .4); color: var(--bad); }
.btn.sm { padding: 5px 9px; min-height: 28px; font-size: 11px; }
.btn[disabled], .btn.off { opacity: .4; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 6px; font: 700 11px var(--num); background: var(--panel2); border: 1px solid var(--line2); color: var(--mut); white-space: nowrap; }
.chip.acc { color: var(--acc); border-color: rgba(217, 123, 74, .4); background: rgba(217, 123, 74, .08); }
.chip.good { color: var(--good); border-color: rgba(143, 181, 115, .35); background: rgba(143, 181, 115, .07); }
.chip.bad { color: var(--bad); border-color: rgba(209, 102, 91, .35); background: rgba(209, 102, 91, .07); }
.chip.blue { color: var(--blue); border-color: rgba(167, 153, 133, .35); background: rgba(167, 153, 133, .07); }
.chip.gold { color: var(--acc2); border-color: rgba(224, 176, 90, .35); background: rgba(224, 176, 90, .07); }
.bar { height: 6px; background: #332e27; border-radius: 3px; overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; background: var(--acc); border-radius: 3px; transition: width .35s; }
.bar.good > i { background: var(--good); } .bar.blue > i { background: var(--blue); } .bar.gold > i { background: var(--acc2); } .bar.bad > i { background: var(--bad); }
.mono { font-family: var(--num); }
.mut { color: var(--mut); } .dim { color: var(--dim); } .good-t { color: var(--good); } .bad-t { color: var(--bad); } .acc-t { color: var(--acc); }
.row { display: flex; align-items: center; gap: 8px; } .row.sp { justify-content: space-between; } .col { display: flex; flex-direction: column; gap: 6px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.kv { display: flex; justify-content: space-between; font-size: 11px; padding: 4px 0; border-bottom: 1px solid var(--panel2); }
.kv:last-child { border-bottom: 0; } .kv span:first-child { color: var(--mut); } .kv b { font-family: var(--num); font-weight: 600; font-size: 11px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.tab { padding: 6px 12px; border-radius: 8px; font-size: 11px; font-weight: 700; color: var(--mut); background: var(--panel); border: 1px solid var(--line); }
.tab.active { color: var(--acc); border-color: rgba(217, 123, 74, .5); background: rgba(217, 123, 74, .08); }
.empty { padding: 28px 12px; text-align: center; color: var(--dim); font-size: 12px; }
.empty i { font-size: 26px; display: block; margin-bottom: 8px; opacity: .6; }

/* ---------- research ---------- */
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px; }
.tech { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 10px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.tech .t-name { font: 700 12px var(--display); }
.tech .t-desc { font-size: 11px; color: var(--mut); line-height: 1.35; min-height: 26px; }
.tech.done { border-color: rgba(143, 181, 115, .35); } .tech.done .t-name { color: var(--good); }
.tech.active { border-color: rgba(217, 123, 74, .6); }
.tech.future, .tech.locked-t { opacity: .5; }
.active-research { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; margin-bottom: 12px; }

/* ---------- factory ---------- */
.model-card { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.model-card .mc-main { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.model-card h4 { font: 700 14px var(--display); }
.stats-line { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--mut); }
.stats-line b { color: var(--text); font-family: var(--num); font-weight: 600; }
.ctrl-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--mut); flex-wrap: wrap; }
.ctrl-row input[type=range] { flex: 1; min-width: 110px; }
.thumb { width: 74px; height: 130px; position: relative; display: grid; place-items: center; }
.thumb .tb { width: 54px; height: 112px; border-radius: 15px; position: relative; box-shadow: 0 6px 16px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(255, 255, 255, .1); overflow: hidden; }
.thumb .tb .isl { position: absolute; background: #403b33; box-shadow: inset 0 1px 1px rgba(255, 255, 255, .15); }
.thumb .tb .ln { position: absolute; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #544d43, #0d0c0a); box-shadow: 0 0 0 1px rgba(186, 170, 148, .55); }
.cap-bar { height: 10px; border-radius: 5px; background: #332e27; overflow: hidden; display: flex; }
.cap-bar i { display: block; height: 100%; }

/* ---------- market ---------- */
table.t { width: 100%; border-collapse: collapse; font-size: 11px; }
table.t th { text-align: left; font-size: 11px; color: var(--dim); padding: 6px 8px; border-bottom: 1px solid var(--line); font-weight: 700; }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--panel2); }
table.t tr.me td { background: rgba(217, 123, 74, .07); }
table.t td.n { font-family: var(--num); text-align: right; } table.t th.n { text-align: right; }
.dotc { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
svg.chart { width: 100%; height: 110px; display: block; }

/* ---------- company ---------- */
.staff-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--panel2); }
.staff-row:last-child { border-bottom: 0; }
.staff-row .sr-n { flex: 1; font-size: 12px; font-weight: 600; } .staff-row .sr-n small { display: block; color: var(--mut); font-weight: 400; font-size: 11px; }
.cnt { font: 700 14px var(--num); min-width: 22px; text-align: center; }
.log-item { font-size: 11px; padding: 6px 0; border-bottom: 1px solid var(--panel2); display: flex; gap: 8px; }
.log-item time { color: var(--dim); font: 600 11px var(--num); padding-top: 2px; white-space: nowrap; }
.log-item.good { color: var(--good); } .log-item.bad { color: var(--bad); }
.goal { display: flex; gap: 8px; align-items: center; font-size: 11px; padding: 5px 0; }
.goal i { width: 16px; text-align: center; color: var(--dim); } .goal i.acc-t { color: var(--acc); } .goal.done { color: var(--good); } .goal.done i { color: var(--good); }

/* ---------- game-value panel in specs ---------- */
#game-value { padding: 0 0 16px; }
#game-value .gv-big { font: 700 26px var(--display); color: var(--acc); letter-spacing: -.5px; }
.fit-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 7px 14px; border-bottom: 1px solid var(--panel2); font-size: 11px; }
.fit-row small { color: var(--mut); font-size: 11px; grid-column: 1 / 3; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 500; background: rgba(5, 6, 8, .74); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: calc(var(--sat) + 8px) calc(var(--sar) + 10px) calc(var(--sab) + 8px) calc(var(--sal) + 10px); animation: fadein .18s; }
@keyframes fadein { from { opacity: 0; } }
.modal { width: min(760px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: popin .22s cubic-bezier(.2, .9, .3, 1.1); overflow: hidden; }
@keyframes popin { from { transform: translateY(14px) scale(.97); opacity: 0; } }
.modal.sm { width: min(460px, 100%); }
.modal-h { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-h h2 { font: 700 17px var(--display); flex: 1; }
.modal-b { padding: 14px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-f { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; background: rgba(0, 0, 0, .15); }
.score-big { font: 700 44px var(--display); color: var(--acc2); line-height: 1; }
.opt-card { border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 11px; display: flex; flex-direction: column; gap: 2px; }
.opt-card.sel { border-color: var(--acc); background: rgba(217, 123, 74, .08); }
.opt-card b { font-size: 11px; } .opt-card small { color: var(--mut); font-size: 11px; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; }
.start-hero { text-align: center; padding: 10px 0 4px; }
.start-hero h1 { font: 700 34px var(--display); letter-spacing: -1px; line-height: 1; }
.start-hero p { color: var(--mut); font-size: 12px; margin: 8px 0 14px; }
.name-in { background: var(--panel2); border: 1px solid var(--line2); border-radius: 9px; padding: 9px 12px; color: var(--text); font: 700 14px var(--display); width: 100%; outline: 0; }
.name-in:focus { border-color: var(--acc); }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: calc(var(--hud) + var(--sat) + 8px); right: calc(var(--sar) + 10px); z-index: 400; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; width: min(300px, 50vw); }
.toast { background: rgba(44, 39, 33, .96); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 14px; font-size: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: popin .2s; display: flex; gap: 8px; align-items: center; }
.toast.good { border-color: rgba(143, 181, 115, .5); } .toast.bad { border-color: rgba(209, 102, 91, .5); } .toast i { color: var(--acc); }
.toast.good i { color: var(--good); } .toast.bad i { color: var(--bad); }

/* ---------- rotate overlay ---------- */
#rotate-overlay { display: none; position: fixed; inset: 0; z-index: 9999; background: var(--bg); color: var(--text); flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 20px; }
#rotate-overlay i { font-size: 44px; color: var(--acc); animation: rot 2s ease-in-out infinite; }
#rotate-overlay b { font: 700 22px var(--display); } #rotate-overlay span { color: var(--mut); font-size: 13px; }
@keyframes rot { 0%, 30% { transform: rotate(0); } 70%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 760px) { #rotate-overlay { display: flex; } }

/* ---------- touch + compact landscape ---------- */
@media (pointer: coarse) {
  input[type=range] { height: 5px; margin: 6px 0; }
  input[type=range]::-webkit-slider-thumb { width: 22px; height: 22px; }
}
@media (max-height: 460px) {
  :root { --hud: 38px; --rail: 54px; }
  .rail-btn span { font-size: 7px; } .rail-btn i { font-size: 14px; }
  .hud-name { display: none; }
  .zoom-container { display: none; }
  .left-panel .section-title { padding: 10px 14px 6px; }
  .control-row { padding: 6px 14px; }
  .scr-head h2 { font-size: 16px; }
}
@media (max-width: 820px) {
  .hud-stats { gap: 9px; } .hud-stat span { display: none; } .hud-name { display: none; }
}

/* lab layout: let content flow and scroll instead of shrinking */
.stage-area .rd-layout { display: block; height: 100%; }
.rd-grid { flex: none; min-height: auto; }
.rd-panel { overflow: visible; }
.rd-header { flex-wrap: wrap; gap: 8px; }
#saved-components-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important; }
.component-list { max-height: 200px; }
.dimension-display { white-space: nowrap; }

/* ================= polish: charts ================= */
.chartbox { position: relative; }
.chart2 { width: 100%; height: auto; display: block; touch-action: none; }
.chart2 .gl { stroke: #2c2721; stroke-width: 1; }
.chart2 .zl { stroke: #6a6254; stroke-width: 1; stroke-dasharray: 3 3; }
.chart2 .ax { fill: #9a9080; font: 600 11px var(--num); }
.chart2 .cur { stroke: #f0e9dc; stroke-width: 1; opacity: 0; stroke-dasharray: 2 2; }
.ctip { position: absolute; top: 4px; left: 0; opacity: 0; pointer-events: none; background: rgba(12, 13, 16, .94); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 9px; font-size: 11px; white-space: nowrap; transition: opacity .1s; z-index: 5; }
.ctip > b { display: block; font: 700 11px var(--num); color: var(--acc2); margin-bottom: 3px; }
.ctip div { display: flex; align-items: center; gap: 5px; color: var(--mut); } .ctip div b { color: var(--text); font-family: var(--num); margin-left: auto; padding-left: 8px; }
.ctip i, .clegend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.clegend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 11px; color: var(--mut); }
.clegend span { display: inline-flex; align-items: center; gap: 5px; }

/* ================= polish: hint cards ================= */
.hint { display: flex; align-items: flex-start; gap: 10px; background: rgba(224, 176, 90, .07); border: 1px solid rgba(224, 176, 90, .3); border-radius: 11px; padding: 9px 10px 9px 12px; margin-bottom: 10px; font-size: 11px; line-height: 1.45; color: #d9cdb4; }
.hint > i { color: var(--acc2); margin-top: 2px; } .hint > span { flex: 1; } .hint b { color: var(--text); }
.hint .hud-btn { min-width: 26px; height: 26px; flex: none; }

/* ================= polish: launch day reveal ================= */
.modal.launch { overflow: visible; }
.reveal { position: relative; text-align: center; }
.rv-glow { position: absolute; left: 50%; top: 0; width: 420px; height: 260px; transform: translateX(-50%); background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--c) 40%, transparent) 0%, transparent 65%); opacity: 0; animation: glowin 1.2s .3s forwards; pointer-events: none; }
@keyframes glowin { to { opacity: 1; } }
.rv-top { position: relative; display: flex; justify-content: center; align-items: center; gap: 22px; }
.rv-phone { position: relative; transform: scale(1.5); transform-origin: center; animation: rise .9s cubic-bezier(.2, .9, .25, 1.1) both; filter: drop-shadow(0 16px 24px rgba(0, 0, 0, .5)); overflow: hidden; border-radius: 16px; }
@keyframes rise { from { transform: translateY(70px) scale(1.1) rotate(-6deg); opacity: 0; } to { transform: scale(1.5); opacity: 1; } }
.rv-shine { position: absolute; top: -20%; bottom: -20%; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent); transform: skewX(-18deg); animation: shine 1.1s .9s ease-out both; }
@keyframes shine { to { left: 130%; } }
.rv-scorebox { position: relative; width: 104px; height: 104px; display: grid; place-items: center; }
.rv-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.rv-track { fill: none; stroke: #2c2721; stroke-width: 8; }
.rv-arc { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1.4s cubic-bezier(.2, .8, .2, 1); filter: drop-shadow(0 0 6px currentColor); }
.rv-num { font: 700 32px var(--display); line-height: 1; margin-top: -8px; }
.rv-of { position: absolute; bottom: 24px; font-size: 11px; color: var(--mut); font-weight: 700; }
.rv-head { margin-top: 22px; font: 700 20px var(--display); opacity: 0; animation: fadeup .5s 1.5s forwards; }
.rv-text { margin: 4px auto 12px; max-width: 360px; font-size: 11.5px; color: var(--mut); line-height: 1.45; opacity: 0; animation: fadeup .5s 1.65s forwards; }
@keyframes fadeup { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.rv-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; text-align: left; margin-bottom: 12px; }
.rv-bar { display: grid; grid-template-columns: 78px 1fr 26px; align-items: center; gap: 8px; font-size: 11px; color: var(--mut); }
.rv-bar b { color: var(--text); text-align: right; } .rv-bar .bar i { transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.rv-chips { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; opacity: 0; animation: fadeup .5s 1.85s forwards; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 20; }
.confetti i { position: absolute; top: -12px; border-radius: 2px; animation: conf 2.2s ease-in forwards; }
@keyframes conf { to { transform: translate(var(--dx), 420px) rotate(var(--rot)); opacity: .2; } }
@media (max-height: 460px) { .rv-phone { transform: scale(1.1); } @keyframes rise { from { transform: translateY(50px) scale(.9); opacity: 0; } to { transform: scale(1.1); opacity: 1; } } .rv-top { margin: 14px 0 0; } .rv-head { margin-top: 14px; } }

/* ================= polish: guided tour ================= */
.tour { position: fixed; inset: 0; z-index: 800; }
.tour-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(5, 6, 8, .78), 0 0 0 2px var(--acc), 0 0 24px rgba(217, 123, 74, .5); transition: all .3s cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
.tour-dim { position: fixed; inset: 0; background: rgba(5, 6, 8, .78); }
.tour-card { position: fixed; width: min(280px, 84vw); background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 12px 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .6); animation: popin .25s; }
.tour-card b { font: 700 14px var(--display); } .tour-card p { font-size: 11.5px; line-height: 1.5; color: var(--mut); margin: 5px 0 10px; }
.tour-step { font: 700 11px var(--num); color: var(--acc2); margin-bottom: 4px; }

/* launch reveal: landscape two-column layout */
.modal.launch { width: min(640px, 100%); }
.reveal { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 20px; align-items: center; text-align: left; }
.rv-left { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rv-phone { transform: scale(1.05); margin: 4px 0 0; }
@keyframes rise { from { transform: translateY(60px) scale(.9) rotate(-6deg); opacity: 0; } to { transform: scale(1.05); opacity: 1; } }
.rv-scorebox { width: 92px; height: 92px; margin-top: -4px; }
.rv-num { font-size: 28px; } .rv-of { bottom: 20px; }
.rv-head { margin-top: 0; font-size: 22px; } .rv-text { margin: 4px 0 10px; max-width: none; }
.rv-bars { grid-template-columns: 1fr; gap: 5px; margin-bottom: 10px; }
.rv-chips { justify-content: flex-start; }
.rv-glow { left: 95px; width: 300px; }

/* ================= depth: regions, skills, suppliers, achievements ================= */
.reg-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--panel2); }
.reg-row:last-of-type { border-bottom: 0; }
.reg-row > i { width: 22px; text-align: center; color: var(--blue); font-size: 15px; }
.rg-n { flex: 1; min-width: 0; } .rg-n b { font-size: 12px; display: block; } .rg-n small { font-size: 11px; color: var(--mut); }
.pips { display: flex; gap: 3px; } .pips u { width: 7px; height: 14px; border-radius: 2px; background: #2c2721; } .pips u.on { background: var(--acc); }
.stars { display: block; font-size: 11px; color: var(--acc2); margin-top: 2px; } .stars s { text-decoration: none; color: #3a342c; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.ach { display: flex; gap: 9px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); opacity: .5; filter: grayscale(.8); }
.ach i { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: #2c2721; color: var(--dim); font-size: 13px; }
.ach b { font-size: 11px; display: block; } .ach small { font-size: 11px; color: var(--mut); line-height: 1.3; display: block; }
.ach.got { opacity: 1; filter: none; border-color: rgba(224, 176, 90, .4); background: rgba(224, 176, 90, .06); }
.ach.got i { background: var(--acc2); color: #1a1204; }
.opt-card .btn { margin-top: 4px; align-self: flex-start; }

/* ================= real-device pass: touch, iOS, motion ================= */
html, body { overflow: hidden; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
.left-panel, .right-panel, .scroll, .modal-b, .rd-layout, .component-list { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.chart2 { touch-action: pan-y; }
.hint .hud-btn { flex: none; }
@media (hover: none) {
  .opt-btn:hover, .preset-card:hover, .swatch:hover, .app-icon:hover, .btn:hover, .component-item:hover { transform: none; }
}
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }              /* stops iOS zooming on focus */
  .name-in { font-size: 16px; } #launch-bar input { font-size: 16px; width: 140px; }
  .btn { min-height: 40px; } .btn.sm { min-height: 38px; padding: 6px 12px; }
  .hud-btn { min-width: 38px; height: 34px; }
  .tab { min-height: 38px; display: inline-flex; align-items: center; }
  .opt-btn { min-height: 42px; justify-content: center; } .feature-chip { min-height: 42px; } .part-chip { min-height: 38px; }
  .view-btn { width: 38px; height: 38px; }
  .rail-btn { min-height: 46px; }
  .component-item { padding: 12px 14px; }
  .opt-card { min-height: 44px; } .staff-row .btn { min-width: 38px; }
  .tour-card .btn { min-height: 40px; }
  .swatch { min-height: 34px; }
  input[type=range] { height: 6px; margin: 9px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .phone-wrapper { animation: none !important; } .rv-phone, .rv-shine, .confetti i, #rotate-overlay i { animation: none !important; }
  .modal, .modal-back, .toast { animation: none !important; } .rv-head, .rv-text, .rv-chips, .rv-glow { opacity: 1 !important; animation: none !important; }
}
/* standalone / installed: use the whole screen, no browser chrome to account for */
@media (display-mode: standalone), (display-mode: fullscreen) { body { background: var(--bg); } }
