/* Kingdom Connections design harness — outer device presentation only.
   Every variant styles its own interior; this file just puts a believable
   phone in the middle of a desktop screen and gets out of the way. */

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { background: var(--stage, #0e1014); }

body {
  min-height: 100dvh;
  background: var(--stage-bg, radial-gradient(120% 90% at 50% -20%, #1c2230 0%, #0e1014 60%));
  display: flex; align-items: center; justify-content: center;
  padding: 26px 16px;
  font-family: system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* ---- the device ---- */
.device {
  position: relative;
  width: 390px; height: 844px;
  border-radius: 54px;
  padding: 11px;
  background: linear-gradient(160deg, #3a3d47 0%, #14161b 26%, #0b0c10 62%, #2c2f38 100%);
  box-shadow:
    0 2px 0 rgba(255,255,255,.16) inset,
    0 60px 120px -40px rgba(0,0,0,.9),
    0 24px 60px -30px rgba(0,0,0,.7);
  flex: none;
}
.device::after { /* side buttons */
  content: ""; position: absolute; left: -2px; top: 168px; width: 3px; height: 64px;
  border-radius: 3px; background: linear-gradient(180deg,#4a4d57,#22242b);
}

.screen {
  position: relative; width: 100%; height: 100%;
  border-radius: 44px; overflow: hidden;
  background: var(--app-bg, #fff);
  display: flex; flex-direction: column;
  isolation: isolate;
}

/* status bar — every variant colours it via --sb-fg */
.statusbar {
  position: absolute; top: 0; left: 0; right: 0; height: 54px; z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 30px 0; pointer-events: none;
  font: 600 14px/1 -apple-system, system-ui, sans-serif;
  color: var(--sb-fg, #10131a);
  letter-spacing: .01em;
  transition: color .35s ease;
}
.statusbar .sb-icons { display: flex; align-items: center; gap: 5px; }
.statusbar svg { display: block; }
.notch {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 108px; height: 30px; border-radius: 999px; background: #05060a; z-index: 95;
}

/* home indicator */
.homebar {
  position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: 99px; z-index: 96;
  background: var(--hb, rgba(0,0,0,.32)); pointer-events: none;
  transition: background .35s ease;
}

/* ---- screen router ---- */
.view { display: none; flex: 1; min-height: 0; }
.view.on { display: flex; flex-direction: column; }
.scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.scroll::-webkit-scrollbar { display: none; }

/* enter animation, opt-in per variant via .anim */
.view.on.anim > * { animation: kcIn .5s cubic-bezier(.22,.68,0,1) both; }
@keyframes kcIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- generic sheet scaffold (variants skin .sheet-card) ---- */
.sheet-host {
  position: absolute; inset: 0; z-index: 200; display: none;
  align-items: flex-end; justify-content: center;
}
.sheet-host.on { display: flex; }
.sheet-scrim {
  position: absolute; inset: 0; background: rgba(8,10,14,.5);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: kcFade .3s ease both;
}
.sheet-card {
  position: relative; width: 100%; max-height: 88%; overflow-y: auto;
  animation: kcUp .44s cubic-bezier(.22,.72,0,1) both; scrollbar-width: none;
}
.sheet-card::-webkit-scrollbar { display: none; }
.sheet-host.out .sheet-scrim { animation: kcFade .26s ease reverse both; }
.sheet-host.out .sheet-card  { animation: kcUp .3s ease reverse both; }
@keyframes kcFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes kcUp   { from { transform: translateY(100%); } to { transform: none; } }

/* ---- generic toast scaffold ---- */
.toast-host {
  position: absolute; left: 0; right: 0; bottom: 104px; z-index: 300;
  display: flex; justify-content: center; pointer-events: none; padding: 0 20px;
}
.toast {
  animation: kcToast .4s cubic-bezier(.22,.72,0,1) both;
  max-width: 100%;
}
.toast.out { animation: kcToast .3s ease reverse both; }
@keyframes kcToast { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---- back to picker chip (desktop only) ---- */
.picker-back {
  position: fixed; left: 20px; top: 20px; z-index: 500;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px 9px 12px; border-radius: 999px;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16);
  color: #e8eaf2; font: 600 13px/1 system-ui, sans-serif; text-decoration: none;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background .22s, transform .22s;
}
.picker-back:hover { background: rgba(255,255,255,.16); transform: translateX(-2px); }
.variant-tag {
  position: fixed; right: 20px; top: 20px; z-index: 500;
  padding: 9px 15px; border-radius: 999px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  color: #cfd4e2; font: 600 12px/1 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}

/* ---- phone: drop the bezel, go full bleed ---- */
@media (max-width: 620px), (max-height: 900px) and (pointer: coarse) {
  body { padding: 0; }
  .device {
    width: 100%; height: 100dvh; max-width: none; border-radius: 0;
    padding: 0; box-shadow: none; background: none;
  }
  .device::after { display: none; }
  .screen { border-radius: 0; }
  .picker-back, .variant-tag { display: none; }
}
@media (max-height: 900px) and (min-width: 621px) {
  .device { transform: scale(.9); transform-origin: center; }
}
@media (max-height: 800px) and (min-width: 621px) {
  .device { transform: scale(.8); }
}
