*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #f4f4f6;
  --panel: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #e2e2e6;
  --accent: #0a84ff;
  color-scheme: light;
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}

body[data-scheme="dark"] {
  --bg: #111113;
  --panel: #1c1c1f;
  --text: #f2f2f4;
  --muted: #9a9aa2;
  --line: #2e2e33;
  color-scheme: dark;
}

body { margin: 0; background: var(--bg); color: var(--text); }
button { font: inherit; color: inherit; cursor: pointer; }

/* --- Connexion --- */

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 30% 20%, #dbe9ff, var(--bg) 60%); }
.login-card { background: var(--panel); border-radius: 24px; padding: 40px 36px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgb(0 0 0 / .08); }
.login-card h1 { margin: 16px 0 8px; font-size: 24px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.google-btn { display: flex; justify-content: center; min-height: 44px; }
.error { color: #d70015 !important; margin: 16px 0 0 !important; }

/* --- Barre du haut --- */

.shell { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand div { display: flex; flex-direction: column; }
.version { color: var(--muted); font-size: 12px; }

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.segmented { display: inline-flex; background: var(--bg); border-radius: 9px; padding: 2px; }
.segmented button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; color: var(--muted); }
.segmented button[aria-checked="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .15); font-weight: 600; }
.icon-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 5px 12px; }
.icon-btn:hover { border-color: var(--muted); }

.user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 600; }
.link-btn { border: 0; background: none; color: var(--muted); padding: 0; }
.link-btn:hover { color: var(--text); text-decoration: underline; }

/* --- Scène et téléphones --- */

.stage {
  --scale: 1;
  flex: 1; min-height: 0; display: flex; align-items: flex-start; justify-content: center;
  gap: calc(64px * var(--scale)); padding: 20px 16px 0; overflow: auto;
}

.device { width: calc(var(--w) * var(--scale) * 1px); flex: none; }
.device[hidden] { display: none; }
.device.ios { --w: 417; --h: 876; --sw: 393px; --sh: 852px; --bezel: 12px; --radius: 62px; }
.device.android { --w: 432; --h: 935; --sw: 412px; --sh: 915px; --bezel: 10px; --radius: 44px; }

.phone {
  width: calc(var(--w) * 1px); height: calc(var(--h) * 1px);
  transform: scale(var(--scale)); transform-origin: top left;
  margin-bottom: calc((var(--scale) - 1) * var(--h) * 1px);
  padding: var(--bezel); border-radius: var(--radius); background: #0b0b0c;
  box-shadow: 0 0 0 2px #3a3a3e, 0 30px 80px rgb(0 0 0 / .25);
}
.android .phone { box-shadow: 0 0 0 2px #2b2d31, 0 30px 80px rgb(0 0 0 / .25); }

.screen {
  position: relative; width: var(--sw); height: var(--sh);
  border-radius: calc(var(--radius) - var(--bezel)); overflow: hidden; background: #fff;
}
body[data-scheme="dark"] .screen { background: #000; }
.screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }

.statusbar {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  pointer-events: none; color: #000; font-weight: 600;
}
body[data-scheme="dark"] .statusbar, body[data-scheme="dark"] .home-indicator { color: #fff; }
.statusbar .icons { display: flex; align-items: center; gap: 6px; }
.statusbar svg { fill: currentColor; display: block; }

.ios .statusbar { height: 54px; padding: 0 30px 0 52px; font-size: 17px; font-family: -apple-system, "SF Pro Text", system-ui, sans-serif; }
.ios .statusbar .time { width: 54px; text-align: center; }
.ios .island { position: absolute; top: 11px; left: 50%; width: 125px; height: 37px; margin-left: -62.5px; border-radius: 20px; background: #000; }

.android .statusbar { height: 32px; padding: 0 22px; font-size: 14px; font-weight: 500; font-family: Roboto, system-ui, sans-serif; }
.android .camera { position: absolute; top: 9px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: #000; }
.android .statusbar .icons { gap: 5px; }

.home-indicator { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); border-radius: 3px; background: currentColor; pointer-events: none; color: #000; }
.ios .home-indicator { width: 134px; height: 5px; }
.android .home-indicator { width: 108px; height: 4px; bottom: 7px; opacity: .8; }

.caption { text-align: center; color: var(--muted); margin: 14px 0 20px; font-size: 13px; }
.caption code { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-left: 6px; font-size: 12px; color: var(--text); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #1d1d1f; color: #fff; padding: 10px 18px; border-radius: 12px; box-shadow: 0 8px 30px rgb(0 0 0 / .3);
}
.toast[hidden] { display: none; }
