/* ============================================================
   Gardenz — UI styling (HUD, phone, creator, cutscene)
   ============================================================ */
:root {
  --ink: #f3f5ff;
  --dark: rgba(7, 10, 22, 0.72);
  --line: rgba(255, 255, 255, 0.14);
  --green: #4ade80;
  --gold: #ffd75e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body {
  height: 100%;
  overflow: hidden;
  background: #071018;
  font-family: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
#game { position: fixed; inset: 0; display: block; touch-action: none; }
button, .chip, .pill { touch-action: manipulation; }
button { font-family: inherit; cursor: pointer; }
kbd {
  font: 700 10px/1 system-ui;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.2);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 5px 1px;
  color: #cfd6f5;
}

/* ================= HUD ================= */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
.hud-tl { position: absolute; top: 14px; left: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.hud-tr { position: absolute; top: 14px; right: 14px; }
.hud-bl { position: absolute; bottom: 14px; left: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.hud-br { position: absolute; bottom: 14px; right: 14px; display: flex; gap: 10px; align-items: center; }

.pill, .chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--dark);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(0,0,0,0.35);
}
.pill b { font-weight: 800; }
.pill-lab { color: #aab0d8; font-size: 12px; }
.pill.money b { color: var(--gold); font-size: 16px; }
.pico { width: 18px; height: 18px; }
.coin {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #ffd75e 55%, #d9a520);
  box-shadow: 0 0 8px rgba(255, 215, 94, 0.6);
}
#raidPill.danger { border-color: rgba(255, 94, 106, 0.6); animation: throb 1.1s infinite; }
#raidPill.danger b { color: #ff8b95; }
@keyframes throb { 50% { box-shadow: 0 0 18px rgba(255, 60, 80, 0.5); } }

.trailer-wrap { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.trailer-bar {
  width: 210px; height: 14px;
  background: var(--dark);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
#trailerFill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #86efac, var(--gold));
  border-radius: 999px;
  transition: width 0.25s ease;
  box-shadow: 0 0 12px rgba(255, 215, 94, 0.5);
}
#trailerTxt { font-size: 12px; color: #cfd6f5; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }

.chip.tappable { cursor: pointer; }
.chip.tappable:active { transform: scale(0.96); }

/* touch devices: no keyboard badges, finger-sized targets */
body.is-touch kbd { display: none; }
body.is-touch .pill, body.is-touch .chip { padding: 11px 16px; font-size: 15px; }
body.is-touch .round-btn { width: 60px; height: 60px; }
body.is-touch .phone-btn { width: 68px; height: 68px; }
body.is-touch .round-btn:hover { transform: none; }
body.is-touch .round-btn:active { transform: scale(1.08); }
/* keep the HUD clear of the notch / home indicator */
body.is-touch .hud-tl { top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); }
body.is-touch .hud-tr { top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); }
body.is-touch .hud-bl { bottom: max(14px, env(safe-area-inset-bottom)); left: max(14px, env(safe-area-inset-left)); }
body.is-touch .hud-br { bottom: max(14px, env(safe-area-inset-bottom)); right: max(14px, env(safe-area-inset-right)); }

.chip .dot { width: 13px; height: 13px; border-radius: 50%; background: #e8c96a; box-shadow: 0 0 8px currentColor; }
.chip b { font-weight: 800; }
#weaponChip { --wc: #b0876a; border-color: color-mix(in srgb, var(--wc) 55%, transparent); }
#weaponChip .wdot { background: var(--wc); }

.round-btn {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--dark);
  color: var(--ink);
  display: grid; place-items: center;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(0,0,0,0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  position: relative;
}
.round-btn:hover { transform: scale(1.08); }
.round-btn svg { width: 24px; height: 24px; }
.round-btn kbd { position: absolute; bottom: -4px; right: -2px; }
.phone-btn { width: 62px; height: 62px; border-color: rgba(74, 222, 128, 0.5); color: var(--green); box-shadow: 0 0 22px rgba(74, 222, 128, 0.28); }
#muteBtn .snd-x { display: none; }
#muteBtn.is-muted .snd-x { display: block; }
#muteBtn.is-muted .snd-waves { display: none; }

/* banner + hint */
.banner {
  position: absolute; top: 76px; left: 50%;
  transform: translateX(-50%) translateY(-16px) scale(0.9);
  background: var(--dark);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 26px;
  font-size: 20px; font-weight: 800;
  letter-spacing: 0.4px;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.2, 1.6, 0.4, 1);
  backdrop-filter: blur(8px);
  white-space: nowrap;
  max-width: 92vw;
}
.banner.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.banner.good { border-color: rgba(74, 222, 128, 0.6); color: #a7f3c3; box-shadow: 0 0 30px rgba(74, 222, 128, 0.25); }
.banner.danger { border-color: rgba(255, 94, 106, 0.7); color: #ff9aa3; box-shadow: 0 0 30px rgba(255, 60, 80, 0.35); animation: throb 0.8s infinite; }

#hint {
  position: absolute; bottom: 88px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--dark);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 14px;
  color: #dfe5ff;
  opacity: 0;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  max-width: min(560px, 92vw);
  text-align: center;
  pointer-events: none;
}
#hint.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ================= cutscene ================= */
.cutbar {
  position: fixed; left: 0; right: 0; height: 11vh;
  background: #02030a;
  z-index: 20;
  transition: transform 0.7s cubic-bezier(0.7, 0, 0.3, 1);
}
.cutbar-t { top: 0; transform: translateY(-100%); }
.cutbar-b { bottom: 0; transform: translateY(100%); }
body.cinema .cutbar-t { transform: translateY(0); }
body.cinema .cutbar-b { transform: translateY(0); }
body.cinema #hud { opacity: 0; transition: opacity 0.4s; }

#saleTally {
  position: fixed; top: 20vh; left: 50%;
  transform: translateX(-50%) scale(0.7);
  z-index: 21;
  text-align: center;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.2, 1.8, 0.4, 1);
  pointer-events: none;
}
#saleTally.show { opacity: 1; transform: translateX(-50%) scale(1); }
#saleTally small { display: block; letter-spacing: 4px; font-weight: 700; color: #aab0d8; font-size: 13px; }
#saleTally b {
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(255, 215, 94, 0.55), 0 4px 0 rgba(0,0,0,0.4);
}

/* ================= how to play ================= */
#howto {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background: rgba(4, 7, 16, 0.78);
  backdrop-filter: blur(6px);
  padding: 18px;
  overflow: auto;
}
.ht-card {
  width: min(640px, 96vw);
  max-height: 94vh;
  overflow-y: auto;
  background: rgba(16, 20, 42, 0.92);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 26px 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.55);
}
.ht-card h1 { font-size: clamp(24px, 5vw, 34px); margin: 4px 0 16px; }
.ht-steps { display: flex; flex-direction: column; gap: 12px; }
.ht-step {
  display: flex; gap: 14px; align-items: flex-start;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
}
.ht-num {
  flex: 0 0 30px; height: 30px; margin-top: 2px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #4ade80, #16a34a);
  color: #06240f; font-weight: 800; font-size: 15px;
  border-radius: 50%;
}
.ht-step h3 { font-size: 15px; margin-bottom: 3px; color: var(--green); }
.ht-step p { font-size: 14px; line-height: 1.45; color: #d9def5; }
.ht-step p b, .ht-step p kbd { color: var(--ink); }
.ht-again { text-align: center; margin-top: 12px; font-size: 12.5px; color: #aab0d8; }
.ht-nav { display: flex; justify-content: center; margin-top: 16px; }

/* ================= character creator ================= */
#creator {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  background:
    radial-gradient(900px 600px at 50% -10%, #1c1046 0%, transparent 60%),
    linear-gradient(180deg, #0a0b2e 0%, #071018 100%);
  padding: 18px;
  overflow: auto;
}
.cc-card {
  width: min(720px, 96vw);
  background: rgba(16, 20, 42, 0.85);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 28px 30px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
}
.cc-eyebrow { letter-spacing: 5px; font-size: 12px; font-weight: 700; color: var(--green); }
.cc-card h1 { font-size: clamp(26px, 5vw, 38px); margin: 4px 0 18px; }
.cc-cols { display: flex; gap: 26px; align-items: stretch; }
.cc-preview {
  flex: 0 0 260px;
  background: radial-gradient(circle at 50% 30%, #1a2b4a, #0d1526 75%);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid; place-items: center;
  min-height: 260px;
}
.cc-form { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cc-form h2 { font-size: 19px; margin: 10px 0 14px; }
.cc-dots { display: flex; gap: 7px; }
.ccdot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.16); transition: all 0.2s; }
.ccdot.on { background: var(--green); transform: scale(1.3); box-shadow: 0 0 8px var(--green); }
.ccdot.done { background: rgba(74, 222, 128, 0.5); }
.ccname {
  width: 100%;
  font: 700 22px "Sora", system-ui;
  color: var(--ink);
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  outline: none;
}
.ccname:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.22); }
.ccgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.ccswatch {
  aspect-ratio: 1; border-radius: 14px;
  background: var(--c);
  border: 3px solid transparent;
  transition: transform 0.12s ease;
}
.ccswatch:hover { transform: scale(1.1); }
.ccswatch.on { border-color: #fff; box-shadow: 0 0 14px var(--c); transform: scale(1.12); }
.ccopts { display: flex; flex-wrap: wrap; gap: 10px; }
.ccopt {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 15px; font-weight: 600;
  transition: all 0.12s ease;
}
.ccopt:hover { background: rgba(255,255,255,0.13); transform: translateY(-1px); }
.ccopt.on { border-color: var(--green); background: rgba(74, 222, 128, 0.16); box-shadow: 0 0 12px rgba(74, 222, 128, 0.25); }
.cc-nav { display: flex; gap: 10px; margin-top: auto; padding-top: 20px; }
.cc-btn {
  border: none; border-radius: 999px;
  padding: 12px 22px;
  font-size: 15px; font-weight: 700;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #fff;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.cc-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(80, 120, 255, 0.4); }
.cc-btn.ghost { background: rgba(255,255,255,0.09); border: 1px solid var(--line); }
.cc-btn.go { background: linear-gradient(135deg, #4ade80, #16a34a); margin-left: auto; box-shadow: 0 0 22px rgba(74, 222, 128, 0.35); }
#ccNext { margin-left: auto; }

/* ================= phone ================= */
#phone {
  position: fixed; right: 22px; bottom: -720px;
  z-index: 25;
  transition: bottom 0.45s cubic-bezier(0.3, 1.3, 0.4, 1);
  filter: drop-shadow(0 30px 50px rgba(0,0,0,0.6));
}
#phone.open { bottom: 20px; }
.ph-body {
  width: min(360px, 94vw); height: min(640px, 84vh);
  background: linear-gradient(180deg, #10142a, #0b0e20);
  border: 2px solid #2a3152;
  border-radius: 34px;
  padding: 14px 12px 12px;
  display: flex; flex-direction: column;
  position: relative;
}
.ph-notch {
  width: 110px; height: 18px;
  background: #05060f;
  border-radius: 0 0 12px 12px;
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
}
.ph-status {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px 8px;
  font-weight: 800; color: var(--gold);
}
#phoneClose {
  background: rgba(255,255,255,0.1);
  border: none; color: var(--ink);
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 14px;
}
#phoneScreen { flex: 1; overflow-y: auto; border-radius: 20px; background: rgba(255,255,255,0.03); scrollbar-width: thin; }

.ph-clock { text-align: center; font-size: 30px; font-weight: 800; padding: 26px 0 4px; }
.ph-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 18px; }
.ph-app {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  padding: 16px 10px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-weight: 700; font-size: 14px;
  transition: all 0.12s ease;
}
.ph-app:hover { transform: translateY(-2px); background: rgba(255,255,255,0.1); }
.ph-app small { font-weight: 500; color: #aab0d8; font-size: 11px; }
.ph-ico { width: 44px; height: 44px; border-radius: 13px; }
.ph-ico-seed { background: linear-gradient(135deg, #4ade80, #16a34a); box-shadow: 0 4px 14px rgba(74,222,128,0.4); }
.ph-ico-wep  { background: linear-gradient(135deg, #f87171, #b91c1c); box-shadow: 0 4px 14px rgba(248,113,113,0.4); }
.ph-ico-fort { background: linear-gradient(135deg, #38bdf8, #1d4ed8); box-shadow: 0 4px 14px rgba(56,189,248,0.4); }
.ph-ico-bug  { background: linear-gradient(135deg, #c084fc, #7e22ce); box-shadow: 0 4px 14px rgba(192,132,252,0.4); }
.ph-stats {
  display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center;
  padding: 10px 16px; font-size: 12px; color: #aab0d8;
}

.ph-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: rgba(13, 16, 34, 0.95);
  backdrop-filter: blur(6px);
  font-size: 16px;
}
.ph-head span { margin-left: auto; color: var(--gold); font-weight: 800; font-size: 14px; }
.ph-back {
  background: rgba(255,255,255,0.1); border: none; color: var(--ink);
  width: 30px; height: 30px; border-radius: 50%; font-size: 18px; line-height: 1;
}
.ph-tabs {
  position: sticky; top: 54px; z-index: 2;
  display: flex; gap: 6px; overflow-x: auto;
  padding: 4px 12px 10px;
  background: rgba(13, 16, 34, 0.95);
  scrollbar-width: none;
}
.ph-tab {
  flex: 0 0 auto;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--line);
  color: #cfd6f5;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12px; font-weight: 700;
}
.ph-tab.on { background: rgba(74, 222, 128, 0.18); border-color: var(--green); color: #b9f6cf; }
.ph-list { padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.ph-section { font-size: 12px; font-weight: 800; letter-spacing: 1.5px; color: #aab0d8; padding: 10px 4px 2px; text-transform: uppercase; }
.ph-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}
.ph-card.sel { border-color: var(--green); background: rgba(74, 222, 128, 0.08); }
.ph-card.owned { opacity: 0.75; }
.ph-card.locked { opacity: 0.42; }
.ph-packet {
  flex: 0 0 34px; height: 40px; border-radius: 8px 8px 10px 10px;
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: inset 0 -8px 12px rgba(0,0,0,0.25);
}
.ph-dot { flex: 0 0 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.ph-info { flex: 1; min-width: 0; }
.ph-info b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-info small { color: #aab0d8; font-size: 11.5px; }
.ph-info em { color: var(--gold); font-style: normal; font-weight: 700; }
.ph-buy {
  flex: 0 0 auto;
  background: linear-gradient(135deg, #4ade80, #16a34a);
  border: none; color: #06240f;
  font-weight: 800; font-size: 12.5px;
  border-radius: 999px; padding: 8px 13px;
  transition: transform 0.1s ease;
}
.ph-buy:hover:not(:disabled) { transform: scale(1.06); }
.ph-buy:disabled { background: rgba(255,255,255,0.12); color: #7c85ab; cursor: not-allowed; }
.ph-sel {
  flex: 0 0 auto;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--line); color: var(--ink);
  font-weight: 700; font-size: 11.5px;
  border-radius: 999px; padding: 7px 11px;
}
.ph-owned, .ph-lock { font-size: 11px; font-weight: 800; color: #7c85ab; letter-spacing: 1px; }
.ph-owned { color: #86efac; }

@media (max-width: 640px) {
  .cc-cols { flex-direction: column; }
  .cc-preview { flex-basis: auto; }
  .hud-bl { bottom: 90px; }
}
