:root {
  --bg: #1c1c1e;
  --surface: #2c2c2e;
  --surface-2: #3a3a3c;
  --text: #f2f2f7;
  --muted: #8e8e93;
  --accent: #0a84ff;
  --danger: #ff453a;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.hidden { display: none !important; }

/* ------------------------------------------------------------------ */
/* Écran de connexion                                                  */
/* ------------------------------------------------------------------ */
.login {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; text-align: center; }
.muted { color: var(--muted); text-align: center; font-size: 14px; margin: 0 0 20px; }
.login input[type="password"] {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid var(--surface-2);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 12px;
}
.login button {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.error { color: var(--danger); text-align: center; font-size: 14px; margin-top: 10px; }

/* ------------------------------------------------------------------ */
/* Navigateur                                                          */
/* ------------------------------------------------------------------ */
.browser {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.topbar {
  background: var(--surface);
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 1px solid #000;
}

.urlbar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
}
.urlbar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 0 12px;
  height: 40px;
}
.urlbar .lock { font-size: 13px; opacity: 0.8; }
.urlbar input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  outline: none;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  border-radius: 10px;
  flex-shrink: 0;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn:disabled { opacity: 0.35; }

.tabbar {
  display: flex;
  overflow-x: auto;
  padding: 4px 8px 8px;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
}
.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  max-width: 160px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}
.tab.active { background: var(--accent); }
.tab .tab-title { overflow: hidden; text-overflow: ellipsis; }
.tab .tab-close { font-size: 16px; opacity: 0.7; }

.viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
}
.viewport iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  touch-action: none;
}

.status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text);
  font-size: 15px;
  text-align: center;
  padding: 24px;
}

.bottombar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--surface);
  padding: 6px 8px calc(6px + var(--safe-bottom));
  border-top: 1px solid #000;
}
