/* Téléphone (page publique) : appareil, barre d'état, accueil, fenêtre d'application */

.phone {
  position: relative;
  width: min(408px, 100%);
  height: min(868px, calc(100vh - 40px));
  min-height: 640px;
  padding: 11px;
  border-radius: 58px;
  background: linear-gradient(150deg, #34353a 0%, #18191c 40%, #0d0e10 100%);
  box-shadow:
    inset 0 0 0 2px #3c3d42,
    inset 0 2px 1px rgba(255, 255, 255, 0.1),
    0 40px 90px rgba(0, 0, 0, 0.75),
    0 0 140px rgba(227, 36, 43, 0.12);
}
/* boutons latéraux */
.phone::before, .phone::after {
  content: "";
  position: absolute;
  width: 4px;
  border-radius: 2px;
  background: #2b2c30;
}
.phone::before { right: -3px; top: 190px; height: 92px; }
.phone::after { left: -3px; top: 160px; height: 120px; background: linear-gradient(#2b2c30 0 44%, transparent 44% 56%, #2b2c30 56%); }

.phone__screen {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 47px;
  background: var(--bg);
  box-shadow: 0 0 0 1px #000;
  isolation: isolate;
}
/* fond d'écran de l'accueil */
.phone__screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 70% at 85% 0%, rgba(227, 36, 43, 0.55) 0%, transparent 60%),
    radial-gradient(90% 60% at 0% 100%, rgba(120, 12, 18, 0.6) 0%, transparent 65%),
    linear-gradient(170deg, #1e0a0c 0%, #0c0c0e 55%, #08080a 100%);
}

/* barre d'état */
.sbar {
  position: relative;
  z-index: 2;
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 52px;
  padding: 6px 26px 0 34px;
  font-size: 0.9375rem;
  transition: background-color 0.3s ease;
}
.sbar__time { font-weight: 700; letter-spacing: 0.01em; }
.sbar__island { width: 112px; height: 32px; border-radius: 20px; background: #000; }
.sbar__icons { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.sbar .net { font-size: 0.8125rem; }
.sbar .sys { width: 18px; height: 18px; stroke: var(--text); }
.sbar .sys__fill { fill: var(--text); }
.phone__screen:not([data-app="home"]) .sbar { background: var(--bg); }

/* accueil */
.home {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 44px;
  gap: 22px;
}
.home__clock { text-align: center; }
.home__time {
  margin: 0;
  font-family: var(--head);
  font-weight: 600;
  font-size: 5.25rem;
  line-height: 0.9;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.45);
}
.home__date { margin: 6px 0 0; font-weight: 600; color: rgba(236, 236, 238, 0.82); text-transform: capitalize; }

.widget {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 14px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background: rgba(20, 21, 24, 0.62);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s;
}
.widget:hover { background: rgba(28, 30, 34, 0.72); }
.widget:active { transform: scale(0.98); }

.apps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 8px; }
.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 16px;
}
.app__icon {
  position: relative;
  width: 62px; height: 62px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: var(--icon, #2a2c31);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -2px 6px rgba(0, 0, 0, 0.25), 0 6px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s;
}
.app__icon svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.app:hover .app__icon { filter: brightness(1.12); }
.app:active .app__icon { transform: scale(0.9); }
.app:focus-visible { outline: none; }
.app:focus-visible .app__icon { outline: 2px solid #fff; outline-offset: 3px; }
.app__name { font-size: 0.75rem; font-weight: 600; color: var(--text); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }

.app__icon--chrono { --icon: linear-gradient(160deg, #6f7cff, #2f37a3); }

.app__icon--ennemis { --icon: linear-gradient(160deg, #3a1114, #12060a); }
.app__icon--ennemis svg { stroke: #ff4d53; }
.app__icon--caisses { --icon: linear-gradient(160deg, #4ea3ef, #1c5591); }
.app__icon--stats { --icon: linear-gradient(160deg, #a77dff, #5530b0); }

/* fenêtre d'application */
.appwin {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  transform-origin: 50% 60%;
}
.appwin[hidden] { display: none; }
.appwin:not([hidden]) { animation: app-open 0.38s cubic-bezier(0.16, 1, 0.3, 1); }
.home:not([hidden]) { animation: home-back 0.38s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes app-open { from { opacity: 0.2; transform: scale(0.88); border-radius: 40px; } }
@keyframes home-back { from { opacity: 0.4; transform: scale(1.06); } }
.appbar { flex: none; padding: 2px 10px 0; }
.appbar__back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 8px 10px 8px 4px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #ff5a60;
  font-size: 1.0625rem;
  font-weight: 600;
  cursor: pointer;
}
.appbar__back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.appbar__back:hover { background: rgba(255, 255, 255, 0.05); }
.phone .screen { flex: 1; min-height: 0; padding: 6px 16px 48px; }
.phone .view__head h2 { font-size: 2.25rem; }

/* barre d'accueil en bas de l'écran */
.phone__home {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 0;
  width: 160px;
  height: 26px;
  margin-left: -80px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.phone__home::before {
  content: "";
  position: absolute;
  left: 13px; right: 13px; bottom: 8px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.7);
  transition: background-color 0.2s;
}
.phone__home:hover::before { background: #fff; }

/* fiches */
body[data-mode="public"] .member { width: min(384px, calc(100vw - 24px)); border-radius: 28px; padding: 20px; }

/* Petit écran : plein écran, sans cadre */
@media (max-width: 520px) {
  body[data-mode="public"] { padding: 0; display: block; background: var(--desk); }
  .phone { width: 100%; height: 100vh; height: 100dvh; min-height: 0; padding: 0; border-radius: 0; box-shadow: none; background: none; }
  .phone::before, .phone::after { display: none; }
  .phone__screen { border-radius: 0; box-shadow: none; }
  .sbar { padding: 4px 18px 0 22px; height: 44px; }
  .sbar__island { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .appwin:not([hidden]), .home:not([hidden]) { animation: none; }
}
