/* style.css - dark crypto theme for Satoshi Tycoon.
 * Written for old Safari (iOS 12): no flex gap, no inset, no aspect-ratio, no min(),
 * grid gaps use both grid-gap and gap, safe-area insets use constant() then env().
 */
:root {
  --bg: #0a0d14; --panel: #131925; --panel2: #1a2232; --line: #2a3550; --text: #e6ebf5; --mute: #8a96b0;
  --btc: #f7931a; --up: #2ecc71; --down: #ff5d5d; --blue: #5aa9ff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% -10%, #1b2236, var(--bg) 60%); color: var(--text);
       font: 14px/1.4 -apple-system, system-ui, "Segoe UI", sans-serif;
       padding-left: constant(safe-area-inset-left); padding-left: env(safe-area-inset-left);
       padding-right: constant(safe-area-inset-right); padding-right: env(safe-area-inset-right); }
h1, h2, h3 { margin: 0 0 8px; }
h1 { font-size: 20px; white-space: nowrap; } .btc { color: var(--btc); }
.sub { color: var(--mute); font-size: 12px; }
.grow { flex: 1; }

/* top bar */
.top { position: -webkit-sticky; position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center;
       padding: 10px 20px 4px; background: rgba(10, 13, 20, 0.95); border-bottom: 1px solid var(--line);
       -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
       padding-top: calc(10px + constant(safe-area-inset-top)); padding-top: calc(10px + env(safe-area-inset-top)); }
.top h1 { margin: 0 24px 6px 0; }
.stats { display: flex; flex: 1; flex-wrap: wrap; }
.stat { margin: 0 20px 6px 0; }
.stat small { display: block; color: var(--mute); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.stat b { font-size: 18px; color: var(--btc); font-variant-numeric: tabular-nums; }
.tools { display: flex; flex-wrap: wrap; justify-content: flex-end; padding: 8px 20px 0; max-width: 1180px; margin: 0 auto; }
.tools button { margin: 0 0 6px 6px; }
#ver { -ms-flex-item-align: center; align-self: center; margin: 0 0 6px 10px; }

button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
         padding: 6px 12px; cursor: pointer; -webkit-appearance: none; appearance: none; touch-action: manipulation;
         transition: background .15s, transform .05s; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: linear-gradient(#ffa42e, var(--btc)); color: #1a1000; border-color: var(--btc); font-weight: 700; }
button.danger { border-color: #7a2c2c; color: #ff9a9a; }
button.big { padding: 10px 22px; font-size: 15px; margin: 8px 0 18px; }
@media (hover: hover) {
  button:hover:not(:disabled) { background: #26324b; }
  button.primary:hover:not(:disabled) { filter: brightness(1.1); background: linear-gradient(#ffa42e, var(--btc)); }
}

/* ticker */
#ticker { overflow: hidden; white-space: nowrap; background: #0d1220; border-bottom: 1px solid var(--line); padding: 6px 0; }
#ticker-text { display: inline-block; padding-left: 100%; animation: scroll 30s linear infinite; }
#ticker-text span { margin-right: 60px; }
.up { color: var(--up); } .down { color: var(--down); }
@keyframes scroll { to { -webkit-transform: translateX(-100%); transform: translateX(-100%); } }

/* tabs */
#tabs { display: flex; flex-wrap: wrap; padding: 12px 20px 0; }
#tabs button { border-radius: 8px 8px 0 0; padding: 8px 16px; margin-right: 6px; }
#tabs button.on { background: var(--btc); color: #1a1000; border-color: var(--btc); font-weight: 700; }
main { max-width: 1180px; margin: 0 auto; padding: 16px 20px 60px; padding-bottom: calc(60px + constant(safe-area-inset-bottom)); padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
.panel { display: none; } .panel.on { display: block; }

/* click button */
.click-zone { text-align: center; margin-bottom: 14px; }
#click-btn { position: relative; width: 150px; height: 150px; border-radius: 50%; font-size: 20px; font-weight: 800; line-height: 1.15;
             color: #1a1000; background: radial-gradient(circle at 35% 30%, #ffc766, var(--btc) 60%, #c9700a); border: 4px solid #ffb84d;
             box-shadow: 0 0 40px rgba(247, 147, 26, .45); padding: 0; }
#click-btn:active:not(:disabled) { -webkit-transform: scale(.94); transform: scale(.94); }
.float { position: absolute; pointer-events: none; color: #fff; font-weight: 700; text-shadow: 0 0 4px #000; animation: rise .7s ease-out forwards; }
@keyframes rise { to { -webkit-transform: translateY(-50px); transform: translateY(-50px); opacity: 0; } }

.modes { display: flex; align-items: center; margin: 10px 0 4px; flex-wrap: wrap; color: var(--mute); }
.modes > span, .modes > button, #trade-pcts button { margin: 0 6px 6px 0; }
.modes button.on, .chip.on { background: var(--btc); color: #1a1000; border-color: var(--btc); font-weight: 700; }
.warn { background: rgba(255, 93, 93, 0.12); border: 2px solid var(--down); color: #ffb3b3; border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; line-height: 1.5; }
.warn b { color: var(--down); }
#halve-btn:not(:disabled) { background: linear-gradient(#ff7a7a, var(--down)); border-color: var(--down); color: #2a0000; }
.news-live { font-size: 12px; font-weight: 700; min-height: 0; }
.news-live:empty { display: none; }
#sell-everything { border-color: var(--down); }
.summary { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); grid-gap: 12px; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); min-width: 0; }
.card.locked { opacity: .45; }
.card.done { opacity: .55; }
.card.ach.done { opacity: 1; border-color: #e0b341; box-shadow: 0 0 14px rgba(224, 179, 65, .25); }
.card.ach:not(.done) { opacity: .7; }
.card.up.can { border-color: var(--btc); }
.row { display: flex; flex-wrap: wrap; margin: 8px -6px 0 0; }
.row > * { margin: 0 6px 6px 0; }
.ico { font-size: 26px; margin-right: 10px; }
.coin-logo { width: 28px; height: 28px; border-radius: 50%; vertical-align: middle; display: inline-block; }
h1 .coin-logo { width: 22px; height: 22px; margin: -3px 2px 0 0; }
.biz-top, .coin-top { display: flex; align-items: center; flex-wrap: wrap; }
.biz-top > *, .coin-top > * { margin-right: 4px; }
.gain { color: var(--up); font-weight: 700; white-space: nowrap; }
.own { color: var(--btc); font-weight: 700; margin-left: 4px; }

.bar { position: relative; height: 20px; margin-top: 8px; background: #0c111b; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; touch-action: manipulation; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c9700a, var(--btc)); }
.bar span { position: absolute; top: 0; right: 0; bottom: 0; left: 0; text-align: center; font-size: 12px; line-height: 18px; text-shadow: 0 0 3px #000; }

/* market */
.price { font-weight: 700; font-variant-numeric: tabular-nums; }
.chg { font-size: 12px; margin-left: 6px; }
canvas { display: block; width: 100%; height: 56px; margin: 8px 0; }
.role { background: #101a2c; border-left: 3px solid var(--blue); padding: 6px 8px; border-radius: 4px; font-size: 12px; margin-bottom: 6px; }
.live { color: var(--blue); font-weight: 600; }

/* skills */
.tree { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 14px; gap: 14px; }
.skill { margin-bottom: 8px; cursor: pointer; }
.skill.locked { opacity: .4; } .skill.open { border-color: var(--btc); } .skill.learned { border-color: var(--up); background: #102018; }

/* account form */
.lbl { display: block; margin: 10px 0 4px; color: var(--mute); font-size: 12px; }
.field { display: block; width: 100%; min-height: 44px; padding: 8px 10px; font: inherit; font-size: 16px; color: var(--text);
         background: #0c111b; border: 1px solid var(--line); border-radius: 8px; -webkit-appearance: none; appearance: none; }

/* modals & toasts */
.modal { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .7); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal.hidden { display: none; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: 92vw; max-width: 560px; max-height: 88vh; overflow: auto; -webkit-overflow-scrolling: touch; }
textarea { width: 100%; height: 170px; background: #0c111b; color: var(--text); border: 1px solid var(--line); border-radius: 8px; font-family: Consolas, Menlo, monospace; font-size: 12px; }
#toasts { position: fixed; right: 16px; bottom: 16px; bottom: calc(16px + constant(safe-area-inset-bottom)); bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; z-index: 60; pointer-events: none; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--blue); padding: 8px 14px; border-radius: 8px; animation: fade .25s; max-width: 320px; margin-top: 8px; }
.toast.good { border-left-color: var(--up); } .toast.bad { border-left-color: var(--down); } .toast.news { border-left-color: var(--btc); }
@keyframes fade { from { opacity: 0; -webkit-transform: translateX(20px); transform: translateX(20px); } }

@media (max-width: 800px) {
  .tree { grid-template-columns: minmax(0, 1fr); }
  .grid { grid-template-columns: minmax(0, 1fr); }
}

/* phones: single column, 44px tap targets, nothing wider than the screen */
@media (max-width: 600px) {
  body { font-size: 15px; }
  h1 { font-size: 18px; }
  .top { padding: 6px 12px 2px; padding-top: calc(6px + constant(safe-area-inset-top)); padding-top: calc(6px + env(safe-area-inset-top)); }
  .top h1 { margin: 0 0 4px; width: 100%; }
  .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-gap: 0 8px; gap: 0 8px; width: 100%; flex: none; }
  .stat { margin: 0 0 4px; min-width: 0; }
  .stat b { font-size: 15px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tools { padding: 8px 12px 0; justify-content: stretch; }
  .tools button { flex: 1 1 22%; margin: 0 6px 6px 0; }
  button { min-height: 44px; min-width: 44px; }
  #tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-gap: 6px; gap: 6px; padding: 8px 12px 0; }
  #tabs button { margin: 0; padding: 4px 2px; font-size: 13px; border-radius: 8px; }
  main { padding: 12px 12px 40px; padding-bottom: calc(40px + constant(safe-area-inset-bottom)); padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  #click-btn { width: 160px; height: 160px; }
  .row > button { flex: 1 1 auto; }
  .bar { height: 44px; border-radius: 12px; }
  .bar span { line-height: 42px; font-size: 14px; }
  .modes > button, #trade-pcts button { min-width: 52px; }
  .skill, .card.up { min-height: 44px; }
  .box { padding: 16px; }
  textarea { font-size: 16px; } /* 16px stops iOS from zooming in on focus */
  #toasts { left: 12px; right: 12px; bottom: 12px; bottom: calc(12px + constant(safe-area-inset-bottom)); bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
}

/* Easter eggs */
.top h1 { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; cursor: default; }
.top h1.glow { text-shadow: 0 0 14px var(--btc); }
.rain { position: fixed; top: -40px; z-index: 55; color: var(--btc); pointer-events: none;
  -webkit-animation: fall 2s linear forwards; animation: fall 2s linear forwards; }
@-webkit-keyframes fall { to { -webkit-transform: translateY(110vh) rotate(360deg); } }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); } }

/* victory screen */
.modal.win { z-index: 60; background: radial-gradient(circle at 50% 40%, rgba(247, 147, 26, .35), rgba(10, 13, 20, .96) 70%); }
#win-fx { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.win-box { position: relative; text-align: center; border: 2px solid var(--btc); box-shadow: 0 0 40px rgba(247, 147, 26, .45);
  -webkit-animation: pop .7s cubic-bezier(.2, 1.6, .4, 1); animation: pop .7s cubic-bezier(.2, 1.6, .4, 1); }
.win-coin { display: inline-block; font-size: 72px; line-height: 1; color: var(--btc); text-shadow: 0 0 24px var(--btc);
  -webkit-animation: coinspin 2.4s linear infinite; animation: coinspin 2.4s linear infinite; }
.win-box h2 { font-size: 28px; margin: 8px 0; background: linear-gradient(90deg, #ffd27a, var(--btc), #ffd27a);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
#win-stats { list-style: none; padding: 0; margin: 12px auto; display: inline-block; text-align: left; line-height: 1.7; }
#win-stats b { color: var(--btc); font-variant-numeric: tabular-nums; }
.win-box .row { justify-content: center; }
button.link { background: none; border: none; color: var(--mute); text-decoration: underline; margin-top: 8px; }
@-webkit-keyframes pop { from { -webkit-transform: scale(.3); opacity: 0; } }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
@-webkit-keyframes coinspin { to { -webkit-transform: rotateY(360deg); } }
@keyframes coinspin { to { transform: rotateY(360deg); } }
@media (prefers-reduced-motion: reduce) { .win-box, .win-coin { -webkit-animation: none; animation: none; } }

/* stats panel */
/* stats: themed cards, well clear of the last achievement */
.stats-box { margin: 32px 0 16px; padding: 16px; border: 1px solid var(--line); border-radius: 14px;
             background: linear-gradient(160deg, rgba(247, 147, 26, .10), rgba(19, 25, 37, .2) 45%), var(--panel);
             box-shadow: 0 0 0 1px rgba(247, 147, 26, .06), 0 8px 24px rgba(0, 0, 0, .25); }
.stats-box h3 { margin: 0 0 12px; color: var(--btc); letter-spacing: .02em; }
.stats-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); grid-gap: 10px; gap: 10px; }
.stats-list li { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--btc); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.stats-list small { display: block; color: var(--mute); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.stats-list b { display: block; color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* settings */
.settings-box h2 { margin-bottom: 14px; }
.set-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; background: var(--panel2); }
.set-group h3 { font-size: 15px; margin: 0 0 8px; }
.set-group .sub { margin: 6px 0 0; }
.set-row { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.set-row > :first-child { margin-right: 12px; }
.slider { -webkit-flex: 1; flex: 1; max-width: 240px; min-height: 32px; accent-color: var(--btc); }
.danger-zone { border-color: #7a2c2c; background: rgba(255, 93, 93, .06); }
.danger-zone h3 { color: #ff9a9a; }
.danger-zone .danger { margin-top: 10px; }
button.danger.solid { background: #b83232; border-color: #ff5d5d; color: #fff; font-weight: 700; }
.reset-box { border-color: #b83232; box-shadow: 0 0 0 1px rgba(255, 93, 93, .25), 0 10px 40px rgba(184, 50, 50, .35); }
.reset-box h2 { color: #ff9a9a; }
.reset-box ul { margin: 6px 0 10px; padding-left: 20px; color: var(--mute); }
@media (hover: hover) { button.danger.solid:hover:not(:disabled) { background: #d23c3c; } }

/* tab badges: absolutely placed so the tab never changes size */
#tabs button { position: relative; }
#tabs button.dot::after { content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 2px var(--panel); }

/* Lucky Block: drifts across the Business tab inside a clipped lane, so it never adds scroll or shifts layout */
#p-biz { position: relative; }
#lucky-lane { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.lucky { position: absolute; left: 0; width: 48px; height: 48px; padding: 0; border-radius: 10px; font-size: 26px; font-weight: 700;
  color: #1a1000; background: var(--btc); border: 2px solid #ffd27a; box-shadow: 0 0 18px rgba(247, 147, 26, .7); pointer-events: auto;
  -webkit-animation: drift 12s linear forwards; animation: drift 12s linear forwards; }
@-webkit-keyframes drift { from { -webkit-transform: translateX(-60px) rotate(0); } to { -webkit-transform: translateX(110vw) rotate(360deg); } }
@keyframes drift { from { transform: translateX(-60px) rotate(0); } to { transform: translateX(110vw) rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .lucky { left: 50%; margin-left: -24px; -webkit-animation: none; animation: none; } }

/* hidden pizza (Two Pizzas secret) */
.stats-box { position: relative; }
.pizza-egg { position: absolute; right: 8px; bottom: 6px; padding: 2px; border: 0; background: none; font-size: 13px; line-height: 1;
  opacity: .16; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pizza-egg:hover, .pizza-egg:focus-visible { opacity: .5; }
.pizza-egg.bite { -webkit-animation: bite .25s; animation: bite .25s; }
@-webkit-keyframes bite { 50% { -webkit-transform: scale(1.4) rotate(-12deg); opacity: .6; } }
@keyframes bite { 50% { transform: scale(1.4) rotate(-12deg); opacity: .6; } }
