/* Shell = prezentační stránka s iPhone 17 Pro rámem.
   Logické rozlišení displeje: 402 x 874 pt, radius ~55pt. */
:root {
  --screen-w: 402px;
  --screen-h: 874px;
  --bezel: 12px;
  --screen-radius: 55px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  background: #0f1014;
  color: #e8e9ee;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 260px; flex: none; padding: 24px 16px;
  border-right: 1px solid #23252d; display: flex; flex-direction: column; gap: 20px;
  overflow-y: auto;
}
.sidebar h1 { font-size: 15px; margin: 0; letter-spacing: .02em; }
.sidebar h1 span { color: #7b7f8e; font-weight: 400; }
#app-list { display: flex; flex-direction: column; gap: 6px; }
#app-list button {
  all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 10px; font-size: 14px;
}
#app-list button:hover { background: #1a1c23; }
#app-list button.active { background: #262a36; }
#app-list .icon {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: 16px; background: #333;
}
#app-list small { display: block; color: #7b7f8e; font-size: 11px; }
.controls { display: flex; flex-direction: column; gap: 14px; margin-top: auto; }
.controls label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: #7b7f8e; text-transform: uppercase; letter-spacing: .06em; }
.controls select { padding: 8px; border-radius: 8px; background: #1a1c23; color: #e8e9ee; border: 1px solid #2c2f3a; font-size: 13px; }
.seg { display: flex; border: 1px solid #2c2f3a; border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; padding: 8px 4px; background: transparent; color: inherit; border: 0; cursor: pointer; font-size: 12px; }
.seg button.active { background: #262a36; color: #fff; }
.device.no-island .island, .device.no-island .home-indicator { display: none; }
.tools { display: flex; gap: 8px; }
.tools button {
  flex: 1; padding: 8px; border-radius: 8px; border: 1px solid #2c2f3a;
  background: transparent; color: inherit; cursor: pointer; font-size: 13px;
}
.tools button:hover { background: #1a1c23; }

/* ---------- Stage + device ---------- */
.stage { flex: 1; display: grid; place-items: center; overflow: hidden; }
.device {
  position: relative;
  width: calc(var(--screen-w) + var(--bezel) * 2);
  height: calc(var(--screen-h) + var(--bezel) * 2);
  transform-origin: center center;
  flex: none;
}
.bezel {
  position: absolute; inset: 0;
  background: #000;
  border-radius: calc(var(--screen-radius) + var(--bezel));
  padding: var(--bezel);
  box-shadow:
    0 0 0 2px #3a3c44,
    0 0 0 4px #1b1c21,
    0 40px 100px rgba(0,0,0,.6);
}
.screen {
  position: relative; width: 100%; height: 100%;
  border-radius: var(--screen-radius); overflow: hidden; background: #fff;
  isolation: isolate;
}
#app-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }

/* boční tlačítka */
.device-buttons::before, .device-buttons::after {
  content: ""; position: absolute; background: #2b2d33; width: 4px; border-radius: 2px;
}
.device-buttons::before { left: -6px; top: 180px; height: 60px; box-shadow: 0 80px 0 #2b2d33, 0 -70px 0 -0px #2b2d33; }
.device-buttons::after { right: -6px; top: 240px; height: 100px; }

/* Dynamic Island */
.island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 126px; height: 37px; background: #000; border-radius: 20px; z-index: 30;
  pointer-events: none;
}

/* Status bar */
.statusbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  height: var(--sb-h, 54px);
  padding: var(--sb-pt, 6px) var(--sb-px-r, 30px) 0 var(--sb-px-l, 44px); pointer-events: none;
  color: #000; transition: color .2s;
}
.statusbar.light { color: #fff; }
.sb-left { font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.sb-right { display: flex; align-items: center; gap: 6px; }

/* Home indicator */
.home-indicator {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 139px; height: 5px; border-radius: 3px; background: #000; z-index: 20;
  pointer-events: none; transition: background .2s;
}
.home-indicator.light { background: #fff; }

/* ---------- Nahrávání / exporty ---------- */
.capture { display: flex; flex-direction: column; gap: 8px; }
.capture button {
  padding: 9px; border-radius: 8px; border: 1px solid #2c2f3a; background: transparent;
  color: inherit; cursor: pointer; font-size: 13px;
}
.capture button:hover { background: #1a1c23; }
.capture .rec.on { background: #e5322d; border-color: #e5322d; color: #fff; animation: pulse 1.2s infinite; }
.chk { font-size: 12px; color: #9a9eae; display: flex; gap: 6px; align-items: center; }
@keyframes pulse { 50% { opacity: .65; } }
#toast {
  position: fixed; left: 280px; bottom: 20px; margin: 0; max-width: 520px;
  background: #1a1c23; border: 1px solid #2c2f3a; border-radius: 10px; padding: 10px 14px;
  font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 100;
}
#toast.show { opacity: 1; }

.touch-dot {
  position: absolute; z-index: 40; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; background: rgba(120,120,128,.45); border: 2px solid rgba(255,255,255,.7);
  pointer-events: none; animation: tap .55s ease-out forwards;
}
@keyframes tap { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }

/* ---------- Clean režim (exporty): jen telefon, průhledné pozadí ---------- */
body.clean { background: transparent; display: block; overflow: hidden; }
body.clean .sidebar, body.clean #toast { display: none; }
body.clean .stage { display: block; }
body.clean .device { position: absolute; transform-origin: 0 0; }
body.clean:not(.shadow) .bezel { box-shadow: 0 0 0 2px #3a3c44, 0 0 0 4px #1b1c21; }
html:has(body.clean) { background: transparent; }
