/* Téléphone du joueur (ui/phone.js), en bas à droite : une dalle de verre sans bord, style 2045. Le verre floute et
   assombrit la scène derrière lui (backdrop-filter) : le texte reste lisible sur n'importe quel décor. Pas de cadre,
   seulement l'arête du verre qui accroche la lumière. */
.phone-wrap {
  position: fixed; right: 18px; bottom: 18px; z-index: 12; pointer-events: none;
  font-family: 'Rajdhani', system-ui, sans-serif;
  --ph-text: #f2fbff;
  --ph-dim: rgba(226, 244, 255, 0.66);
  --ph-glass: rgba(255, 255, 255, 0.075);
  --ph-edge: rgba(255, 255, 255, 0.11);
  --ph-green: #3dff8a;
}
.phone-wrap.ringing { z-index: 25; } /* un appel entrant passe devant les fenêtres : on peut décrocher */
body.editing .phone-wrap { display: none; }

/* Téléphone rangé : une petite dalle de verre */
.phone-dock {
  pointer-events: auto; position: absolute; right: 0; bottom: 0;
  width: 54px; height: 54px; padding: 0; border: 0; border-radius: 18px;
  display: grid; place-items: center; cursor: pointer; color: #eafcff;
  background:
    radial-gradient(90% 70% at 20% 0%, rgba(255, 255, 255, 0.22), transparent 60%),
    linear-gradient(150deg, rgba(120, 230, 255, 0.20), rgba(255, 79, 216, 0.10) 60%, rgba(8, 14, 34, 0.40));
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 22px rgba(56, 232, 255, 0.16);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.2, 1), opacity 0.2s;
}
.phone-dock svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(56, 232, 255, 0.6)); }
.phone-dock:hover { transform: translateY(-2px); }
.phone-wrap.open .phone-dock { opacity: 0; transform: scale(0.6); pointer-events: none; }
.phone-key {
  position: absolute; left: -6px; bottom: -6px; margin: 0; min-width: 18px; padding: 1px 4px; font-size: 9px;
  background: rgba(8, 14, 34, 0.85); backdrop-filter: blur(6px);
}
.phone-badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  font: 700 11px/20px 'Orbitron', sans-serif; font-style: normal; color: #fff; text-align: center;
  background: linear-gradient(135deg, #ff4fd8, #ff3b6b); box-shadow: 0 0 12px rgba(255, 79, 216, 0.75);
}
.phone-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.phone-dock.call { color: var(--ph-green); animation: ph-dock-call 1.4s ease-in-out infinite; }
.phone-dock.call svg { filter: drop-shadow(0 0 6px rgba(61, 255, 138, 0.8)); }
.phone-dock-call {
  position: absolute; right: 62px; bottom: 14px; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  font: 700 12px 'Orbitron', sans-serif; letter-spacing: 0.06em; color: var(--ph-green);
  background: rgba(4, 18, 12, 0.6); backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px rgba(61, 255, 138, 0.3);
}
@keyframes ph-dock-call { 50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 6px rgba(61, 255, 138, 0.12), 0 0 30px rgba(61, 255, 138, 0.5); } }

/* Téléphone ouvert */
.phone {
  pointer-events: auto; position: absolute; right: 0; bottom: 0;
  width: 340px; height: min(650px, calc(100vh - 96px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 42px; color: var(--ph-text);
  background:
    radial-gradient(110% 55% at 100% 0%, rgba(255, 79, 216, 0.13), transparent 62%),
    radial-gradient(110% 60% at 0% 100%, rgba(56, 232, 255, 0.13), transparent 62%),
    linear-gradient(165deg, rgba(16, 26, 56, 0.30), rgba(5, 9, 24, 0.50));
  backdrop-filter: blur(16px) saturate(170%) brightness(0.85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -40px 70px rgba(56, 232, 255, 0.05),
    0 34px 90px rgba(0, 0, 0, 0.5), 0 0 50px rgba(56, 232, 255, 0.10);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  transform-origin: 100% 100%;
  transform: translateY(26px) scale(0.9); opacity: 0; visibility: hidden;
  transition: transform 0.34s cubic-bezier(0.2, 0.9, 0.2, 1), opacity 0.22s, visibility 0s 0.34s;
  user-select: none;
}
.phone-wrap.open .phone { transform: none; opacity: 1; visibility: visible; transition: transform 0.34s cubic-bezier(0.2, 0.9, 0.2, 1), opacity 0.22s; }
/* Arête du verre : un liseré qui ne fait pas le tour (lumière en haut à gauche, reflet magenta en bas à droite) */
.phone::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.55), rgba(140, 240, 255, 0.22) 18%, transparent 42%, transparent 68%, rgba(255, 79, 216, 0.32));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.ph-glare {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; overflow: hidden;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.015) 26%, transparent 40%);
}
.ph-glare::after { /* reflet holographique qui traverse lentement la dalle */
  content: ''; position: absolute; inset: -20% -60%;
  background: linear-gradient(100deg, transparent 42%, rgba(160, 245, 255, 0.07) 48%, rgba(255, 160, 240, 0.06) 52%, transparent 58%);
  animation: ph-sweep 11s linear infinite;
}
@keyframes ph-sweep { from { transform: translateX(-40%); } to { transform: translateX(40%); } }

.phone svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.phone button { font-family: inherit; }
.phone button:focus-visible, .phone input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* Barre d'état : heure, pastille (réseau ou appel en cours), réseau, ranger */
.ph-status {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px 6px 26px; font: 700 13px 'Orbitron', sans-serif; letter-spacing: 0.05em;
}
.ph-island {
  position: absolute; left: 50%; top: 11px; transform: translateX(-50%);
  height: 25px; min-width: 92px; padding: 0 12px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font: 700 10px 'Orbitron', sans-serif; letter-spacing: 0.16em; color: rgba(230, 248, 255, 0.85);
  background: rgba(0, 0, 0, 0.62); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); text-shadow: none;
  transition: min-width 0.3s, color 0.3s;
}
.ph-island i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.ph-island.call { min-width: 118px; color: var(--ph-green); letter-spacing: 0.08em; }
.ph-island.call i { background: var(--ph-green); box-shadow: 0 0 8px var(--ph-green); animation: ph-blink 1.2s ease-in-out infinite; }
@keyframes ph-blink { 50% { opacity: 0.35; } }
.ph-net { display: flex; align-items: center; gap: 4px; color: var(--ph-dim); }
.ph-net svg { width: 17px; height: 17px; }
.ph-min { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; color: var(--ph-dim); background: none; cursor: pointer; }
.ph-min:hover { color: #fff; background: var(--ph-glass); }

/* Écran */
.ph-screen { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ph-head { display: flex; align-items: center; gap: 10px; padding: 12px 22px 8px; }
.ph-head-text { flex: 1; min-width: 0; }
.ph-head h3 {
  margin: 0; font: 900 22px 'Orbitron', sans-serif; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(92deg, #ffffff, #a8f4ff 55%, #ffb8f1); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}
.ph-head p { margin: 2px 0 0; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; color: var(--ph-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-head-conv { padding: 8px 14px 8px 10px; }
.ph-head-conv h3 { font-size: 17px; }
.ph-icon {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  color: var(--ph-text); background: none; cursor: pointer;
}
.ph-icon:hover { background: var(--ph-glass); }
.ph-icon svg { width: 22px; height: 22px; }
.ph-dial { color: var(--ph-green); background: rgba(61, 255, 138, 0.12); }
.ph-dial:disabled { color: var(--ph-dim); background: none; opacity: 0.45; cursor: default; }

/* Fil de messages (chat général, conversation) */
.ph-feed {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 5px; padding: 8px 16px 12px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 16px, #000 calc(100% - 6px), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 16px, #000 calc(100% - 6px), transparent);
  scrollbar-width: thin; scrollbar-color: rgba(56, 232, 255, 0.3) transparent;
}
.ph-feed > :first-child { margin-top: auto; } /* peu de messages : collés en bas, comme une messagerie */
.ph-msg { align-self: flex-start; max-width: 88%; }
.ph-msg.mine { align-self: flex-end; }
.ph-msg.grouped { margin-top: -2px; }
.ph-msg p {
  position: relative; margin: 0; padding: 7px 12px; border-radius: 5px 17px 17px 17px;
  font-size: 15px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; user-select: text;
  background: rgba(255, 255, 255, 0.085); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.ph-msg.mine p {
  border-radius: 17px 5px 17px 17px;
  background: linear-gradient(135deg, rgba(56, 232, 255, 0.30), rgba(56, 160, 255, 0.16));
  box-shadow: inset 0 0 0 1px rgba(56, 232, 255, 0.22), 0 0 16px rgba(56, 232, 255, 0.08);
}
.ph-msg.grouped p { border-radius: 17px; }
.ph-meta { display: flex; align-items: center; gap: 6px; margin: 5px 4px 3px; font-size: 12px; color: var(--ph-dim); }
.ph-msg.mine .ph-meta { justify-content: flex-end; }
.ph-meta time { font-size: 11px; opacity: 0.85; }
.ph-name { padding: 0; border: 0; background: none; cursor: pointer; font: 700 14px 'Rajdhani', sans-serif; color: var(--c); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.ph-name:hover { text-decoration: underline; }
.ph-me { font-size: 13px; color: var(--cyan); }
.ph-lv {
  display: inline-block; padding: 0 4px; border-radius: 5px; font: 700 9px/14px 'Orbitron', sans-serif; color: var(--t);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t) 55%, transparent); text-shadow: none; vertical-align: 1px;
}
.ph-w { width: 6px; height: 6px; border-radius: 50%; background: var(--w); box-shadow: 0 0 6px var(--w); }
.ph-msg.pm p { padding-right: 46px; }
.ph-msg.pm p time { position: absolute; right: 10px; bottom: 6px; font-size: 10px; color: var(--ph-dim); }
.ph-msg.pm.mine p { background: linear-gradient(135deg, rgba(255, 79, 216, 0.30), rgba(150, 90, 255, 0.20)); box-shadow: inset 0 0 0 1px rgba(255, 120, 230, 0.25), 0 0 16px rgba(255, 79, 216, 0.08); }
.ph-state { display: block; margin: 2px 6px 0; text-align: right; font-size: 11px; color: var(--ph-dim); }
.ph-state.bad { color: #ff8aa0; }
.ph-day { align-self: center; margin: 10px 0 4px; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ph-dim); background: rgba(0, 0, 0, 0.25); }
.ph-older { align-self: center; margin: 4px 0; padding: 4px 12px; border: 0; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--cyan); background: var(--ph-glass); cursor: pointer; }
.ph-empty { margin: auto 18px; text-align: center; font-size: 15px; line-height: 1.45; color: var(--ph-dim); }
.ph-empty b, .ph-note b, .ph-hint b { color: var(--cyan); }
.ph-flash { margin: 0 18px 6px; font-size: 13px; font-weight: 600; color: var(--amber); text-align: center; }
.ph-note { margin: 0 16px 10px; padding: 10px 14px; border-radius: 18px; font-size: 14px; text-align: center; color: var(--ph-dim); background: var(--ph-glass); }

/* Saisie */
.ph-compose {
  display: flex; align-items: center; gap: 6px; margin: 0 14px 8px; padding: 5px 5px 5px 15px; border-radius: 24px;
  background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
  transition: box-shadow 0.2s;
}
.ph-compose:focus-within { box-shadow: inset 0 0 0 1px rgba(56, 232, 255, 0.6), 0 0 20px rgba(56, 232, 255, 0.22); }
.ph-input {
  flex: 1; min-width: 0; padding: 6px 0; border: 0; outline: none !important; background: none;
  color: #fff; font: 600 15px 'Rajdhani', sans-serif; user-select: text; caret-color: var(--cyan);
}
.ph-input::placeholder { color: rgba(226, 244, 255, 0.45); }
.ph-left { font: 700 10px 'Orbitron', sans-serif; color: var(--ph-dim); }
.ph-left.warn { color: var(--amber); }
.ph-send {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  color: #03111a; background: linear-gradient(135deg, var(--cyan), #a6f7ff); box-shadow: 0 0 14px rgba(56, 232, 255, 0.45); cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.ph-send svg { width: 17px; height: 17px; margin-left: -2px; }
.ph-send:not(:disabled):hover { transform: scale(1.06); }
.ph-send:disabled { opacity: 0.3; box-shadow: none; cursor: default; }

/* Listes (messages, contacts) */
.ph-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 10px 12px; scrollbar-width: thin; scrollbar-color: rgba(56, 232, 255, 0.3) transparent; }
.ph-sec { display: flex; justify-content: space-between; margin: 12px 10px 4px; font: 700 10px 'Orbitron', sans-serif; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(150, 240, 255, 0.8); }
.ph-sec span:last-child { color: var(--ph-dim); }
.ph-row {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: 20px;
  color: inherit; background: none; text-align: left; font: inherit; text-shadow: inherit;
}
button.ph-row { cursor: pointer; }
.ph-row:hover { background: rgba(255, 255, 255, 0.055); }
.ph-row.confirm { background: rgba(255, 59, 92, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 59, 92, 0.3); }
.ph-who { flex: 1; min-width: 0; }
.ph-who b { display: block; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-who small { display: block; font-size: 13px; font-weight: 500; color: var(--ph-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-row.unread .ph-who b, .ph-row.unread .ph-who small { color: #fff; }
.ph-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 11px; color: var(--ph-dim); }
.ph-unread {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; font: 700 10px/19px 'Orbitron', sans-serif; font-style: normal;
  color: #fff; text-align: center; background: linear-gradient(135deg, #ff4fd8, #ff3b6b); box-shadow: 0 0 10px rgba(255, 79, 216, 0.6); text-shadow: none;
}
.ph-unread.mini { position: absolute; top: 4px; right: 4px; min-width: 8px; width: 8px; height: 8px; padding: 0; }
.ph-hint { margin: 2px 10px 6px; font-size: 13px; line-height: 1.4; color: var(--ph-dim); }
.ph-hint kbd { margin: 0 1px; }
.ph-tag { flex: none; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--ph-dim); background: var(--ph-glass); }

.ph-avatar {
  position: relative; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  font: 700 14px 'Orbitron', sans-serif; color: #041018; text-shadow: none;
  background: radial-gradient(circle at 35% 28%, hsl(var(--h) 100% 88%), hsl(var(--h) 90% 62%) 52%, hsl(calc(var(--h) + 45) 80% 38%));
  box-shadow: 0 0 16px hsl(var(--h) 90% 60% / 0.35), inset 0 -3px 8px rgba(0, 0, 0, 0.25);
}
.ph-avatar.on::after {
  content: ''; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%;
  background: var(--ph-green); box-shadow: 0 0 0 2px rgba(6, 12, 30, 0.85), 0 0 8px var(--ph-green);
}
.ph-avatar.big { width: 112px; height: 112px; font-size: 38px; }
.ph-avatar.big.on::after { display: none; }

.ph-act {
  position: relative; display: grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  color: #e3fbff; background: rgba(255, 255, 255, 0.08); cursor: pointer; transition: background 0.15s;
}
.ph-act svg { width: 18px; height: 18px; }
.ph-act:not(:disabled):hover { background: rgba(56, 232, 255, 0.24); }
.ph-act:disabled { opacity: 0.32; cursor: default; }
.ph-act.ok { color: #8dffbc; background: rgba(61, 255, 138, 0.16); }
.ph-act.no { color: #ff9cb0; background: rgba(255, 59, 92, 0.14); }
.ph-act.faint { background: none; color: var(--ph-dim); width: 26px; }
.ph-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; padding: 8px 14px; border: 0; border-radius: 999px;
  font: 700 14px 'Rajdhani', sans-serif; letter-spacing: 0.02em; color: #03111a; text-shadow: none; cursor: pointer;
  background: linear-gradient(135deg, var(--cyan), #a6f7ff); box-shadow: 0 0 16px rgba(56, 232, 255, 0.35);
}
.ph-pill svg { width: 16px; height: 16px; }
.ph-pill.small { padding: 5px 11px; font-size: 13px; }
.ph-pill.ghost { color: var(--ph-text); background: var(--ph-glass); box-shadow: inset 0 0 0 1px var(--ph-edge); text-shadow: inherit; }
.ph-pill.danger { color: #fff; background: linear-gradient(135deg, #ff3b5c, #c4123a); box-shadow: 0 0 14px rgba(255, 59, 92, 0.4); }
.ph-pill:disabled { opacity: 0.4; cursor: default; }

/* Fiche d'un joueur touché dans le chat général */
.ph-sheet {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; padding: 16px 16px 14px; border-radius: 28px;
  background: rgba(8, 14, 34, 0.78); backdrop-filter: blur(18px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 -12px 34px rgba(0, 0, 0, 0.4);
  animation: ph-up 0.26s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.ph-sheet-who { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.ph-sheet .ph-sub { margin: 10px 2px 0; font-size: 14px; color: var(--ph-dim); }
.ph-sheet-actions { display: flex; gap: 8px; margin-top: 12px; }
.ph-sheet-actions .ph-pill { flex: 1; }
.ph-x { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; color: var(--ph-dim); background: none; cursor: pointer; }
.ph-x:hover { color: #fff; background: var(--ph-glass); }
@keyframes ph-up { from { opacity: 0; transform: translateY(16px); } }

/* Applications */
.ph-nav { display: flex; gap: 4px; margin: 2px 14px 4px; padding: 5px; border-radius: 24px; background: rgba(255, 255, 255, 0.055); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }
.ph-tab {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; border: 0; border-radius: 19px;
  font: 700 11px 'Rajdhani', sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ph-dim); background: none; cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.ph-tab svg { width: 22px; height: 22px; }
.ph-tab:hover { color: #fff; }
.ph-tab[aria-current="page"] { color: #fff; background: rgba(56, 232, 255, 0.15); box-shadow: inset 0 0 0 1px rgba(56, 232, 255, 0.32), 0 0 18px rgba(56, 232, 255, 0.16); }
.ph-tab[aria-current="page"] svg { filter: drop-shadow(0 0 6px rgba(56, 232, 255, 0.8)); }
.ph-count {
  position: absolute; top: 1px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  font: 700 9px/17px 'Orbitron', sans-serif; font-style: normal; color: #fff; letter-spacing: 0; text-shadow: none;
  background: linear-gradient(135deg, #ff4fd8, #ff3b6b); box-shadow: 0 0 8px rgba(255, 79, 216, 0.6);
}
.ph-home { display: block; width: 120px; height: 18px; margin: 0 auto 3px; padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
.ph-home::before { content: ''; position: absolute; left: 0; right: 0; top: 7px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.55); box-shadow: 0 0 10px rgba(255, 255, 255, 0.25); }
.ph-home:hover::before { background: #fff; }

/* Appel : écran par-dessus tout le téléphone */
.ph-call {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center;
  padding: 64px 24px 46px; border-radius: inherit; text-align: center;
  background: radial-gradient(85% 45% at 50% 34%, rgba(56, 232, 255, 0.20), transparent 70%), rgba(4, 8, 22, 0.80);
  backdrop-filter: blur(18px); animation: ph-fade 0.25s ease-out;
}
.ph-call[data-state="entrant"] { background: radial-gradient(85% 45% at 50% 34%, rgba(61, 255, 138, 0.18), transparent 70%), rgba(4, 8, 22, 0.80); }
.ph-call[data-state="fin"] { background: radial-gradient(85% 45% at 50% 34%, rgba(255, 59, 92, 0.14), transparent 70%), rgba(4, 8, 22, 0.82); }
@keyframes ph-fade { from { opacity: 0; } }
.ph-call-top { font: 700 10px 'Orbitron', sans-serif; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ph-dim); }
.ph-rings { position: relative; display: grid; place-items: center; margin: 38px 0 22px; }
.ph-rings::before, .ph-rings::after {
  content: ''; position: absolute; inset: -12px; border-radius: 50%; border: 1px solid rgba(56, 232, 255, 0.55); opacity: 0;
}
.ph-call[data-state="sonne"] .ph-rings::before, .ph-call[data-state="sonne"] .ph-rings::after,
.ph-call[data-state="compose"] .ph-rings::before, .ph-call[data-state="entrant"] .ph-rings::before,
.ph-call[data-state="entrant"] .ph-rings::after, .ph-rings.talk::before, .ph-rings.talk::after { animation: ph-ring 2s ease-out infinite; }
.ph-rings::after { animation-delay: 1s !important; }
.ph-call[data-state="entrant"] .ph-rings::before, .ph-call[data-state="entrant"] .ph-rings::after { border-color: rgba(61, 255, 138, 0.6); }
.ph-rings.talk::before, .ph-rings.talk::after { animation-duration: 1.1s; }
@keyframes ph-ring { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.6); } }
.ph-call h3 { margin: 0; font: 900 24px 'Orbitron', sans-serif; letter-spacing: 0.03em; overflow-wrap: anywhere; }
.ph-call-status { margin: 8px 0 0; font: 700 15px 'Orbitron', sans-serif; letter-spacing: 0.08em; color: rgba(226, 244, 255, 0.82); }
.ph-call[data-state="fin"] .ph-call-status { color: #ff9cb0; }
.ph-call-note { margin: 14px 8px 0; font-size: 13px; line-height: 1.4; color: var(--ph-dim); }
.ph-call-actions { display: flex; justify-content: center; gap: 40px; margin-top: auto; }
.ph-round {
  position: relative; display: grid; place-items: center; width: 66px; height: 66px; padding: 0; border: 0; border-radius: 50%;
  color: #fff; background: rgba(255, 255, 255, 0.13); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); cursor: pointer;
  transition: transform 0.15s;
}
.ph-round:not(:disabled):hover { transform: scale(1.06); }
.ph-round:disabled { opacity: 0.4; cursor: default; }
.ph-round svg { width: 28px; height: 28px; }
.ph-round small { position: absolute; top: calc(100% + 7px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--ph-dim); }
.ph-round.red { background: linear-gradient(135deg, #ff3b5c, #c4123a); box-shadow: 0 0 26px rgba(255, 59, 92, 0.55); }
.ph-round.green { background: linear-gradient(135deg, #3dff8a, #10b558); box-shadow: 0 0 26px rgba(61, 255, 138, 0.55); animation: ph-nudge 1.2s ease-in-out infinite; }
.ph-round.off { color: #0a1020; background: rgba(255, 255, 255, 0.88); text-shadow: none; }
@keyframes ph-nudge { 0%, 100% { transform: rotate(0); } 10% { transform: rotate(-12deg); } 20% { transform: rotate(10deg); } 30% { transform: rotate(-6deg); } 40% { transform: rotate(0); } }

/* Écran tactile : le téléphone rangé au-dessus des boutons de droite ; ouvert, presque toute la hauteur */
body.touch .phone-wrap { right: 22px; bottom: 176px; }
body.touch .phone-wrap.open { right: 8px; bottom: 8px; }
body.touch .phone-dock { width: 46px; height: 46px; border-radius: 50%; }
body.touch .phone-key { display: none; }
body.touch .phone { width: min(360px, calc(100vw - 16px)); height: min(650px, calc(100dvh - 60px)); border-radius: 34px; }
@media (max-height: 430px) {
  body.touch .phone-wrap { right: 16px; bottom: 152px; }
  body.touch .phone { height: calc(100dvh - 16px); }
  .ph-call { padding-top: 30px; }
  .ph-rings { margin: 16px 0 12px; }
  .ph-avatar.big { width: 76px; height: 76px; font-size: 26px; }
}
@media (max-height: 560px) {
  .phone { height: calc(100vh - 32px); }
}
@media (prefers-reduced-motion: reduce) {
  .ph-glare::after, .phone-dock.call, .ph-round.green, .ph-rings::before, .ph-rings::after, .ph-island.call i { animation: none !important; }
}

/* Message de bienvenue : la conversation « OAXIRA », épinglée en haut des Messages */
.ph-avatar.sys {
  font-size: 13px; letter-spacing: 0.02em; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  background: conic-gradient(from 210deg, #38e8ff, #ff4fd8, #ffb02e, #38e8ff);
  box-shadow: 0 0 16px rgba(56, 232, 255, 0.4), inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.ph-pin { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(150, 240, 255, 0.8); }
.ph-msg.sys { max-width: 94%; }
.ph-msg.sys p {
  background: linear-gradient(135deg, rgba(56, 232, 255, 0.14), rgba(255, 79, 216, 0.08));
  box-shadow: inset 0 0 0 1px rgba(150, 240, 255, 0.16);
}
.ph-msg.sys b { color: #a8f4ff; }

/* Photos dans les fils (chat général, conversations) : la vignette à ses vraies proportions, touchée = en grand */
.ph-photo {
  display: block; width: 100%; padding: 0; border: 0; border-radius: 14px; overflow: hidden; cursor: zoom-in;
  background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 6px 18px rgba(0, 0, 0, 0.3);
}
.ph-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph-msg.has-photo { width: 78%; }
.ph-msg.has-photo p { margin-top: 4px; }
.ph-msg.mine .ph-photo { border-radius: 14px 4px 14px 14px; }
.ph-msg:not(.mine).has-photo .ph-photo { border-radius: 4px 14px 14px 14px; }
.ph-ptime { display: block; margin: 3px 6px 0; font-size: 10px; text-align: right; color: var(--ph-dim); }
.ph-msg:not(.mine) .ph-ptime { text-align: left; }

/* Bouton appareil photo de la saisie */
.ph-cam {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; margin-left: -8px; padding: 0; border: 0; border-radius: 50%;
  color: var(--ph-dim); background: none; cursor: pointer;
}
.ph-cam:hover { color: var(--cyan); background: var(--ph-glass); }

/* Appli Photos */
.ph-take {
  display: flex; align-items: center; gap: 14px; width: calc(100% - 8px); margin: 6px 4px 12px; padding: 14px 16px; border: 0; border-radius: 22px;
  color: #03111a; text-align: left; cursor: pointer; text-shadow: none;
  background: linear-gradient(135deg, var(--cyan), #a6f7ff 60%, #ffc9f3); box-shadow: 0 0 22px rgba(56, 232, 255, 0.35);
}
.ph-take svg { width: 34px; height: 34px; }
.ph-take b { display: block; font: 900 15px 'Orbitron', sans-serif; letter-spacing: 0.03em; }
.ph-take small { display: block; font-size: 12px; font-weight: 600; opacity: 0.75; }
.ph-shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 4px 10px; }
.ph-shot { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 12px; overflow: hidden; cursor: pointer; background: rgba(255, 255, 255, 0.06); }
.ph-shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.ph-shot:hover img { transform: scale(1.05); }
.ph-shot.sent::after {
  content: ''; position: absolute; right: 5px; bottom: 5px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--ph-green) center / 10px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2303111a' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5 9.8 17 19 7.2'/%3E%3C/svg%3E");
  box-shadow: 0 0 8px rgba(61, 255, 138, 0.7);
}

/* Aperçu d'une photo : partage */
.ph-shot-view { padding-top: 4px; }
.ph-photo.big { width: calc(100% - 8px); margin: 0 4px 10px; max-height: 46%; }
.ph-caption { margin: 0 4px 10px; }
.ph-share { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 4px 6px; }
.ph-share .ph-pill { flex: 1 1 100%; }
.ph-share .ph-pill.ghost { flex: 1 1 calc(50% - 4px); }
.ph-del { color: #ff9cb0; }
.ph-retake { display: flex; align-items: center; justify-content: center; gap: 6px; width: calc(100% - 8px); margin: 10px 4px 4px; padding: 9px; border: 0; border-radius: 16px; font: 700 13px 'Rajdhani', sans-serif; color: var(--ph-dim); background: none; cursor: pointer; }
.ph-retake:hover { color: #fff; background: var(--ph-glass); }
.ph-retake svg { width: 18px; height: 18px; }

/* Visionneuse : une photo en grand, par-dessus le jeu */
.ph-viewer {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 28px;
  background: rgba(2, 4, 12, 0.82); backdrop-filter: blur(14px); animation: ph-fade 0.2s ease-out; cursor: zoom-out;
}
.ph-viewer img { max-width: 100%; max-height: calc(100% - 70px); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08); cursor: default; }
.ph-viewer-bar { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: 'Rajdhani', sans-serif; }
.ph-viewer-bar span { margin-right: 8px; font-size: 15px; font-weight: 600; color: var(--muted); }
.ph-viewer .ph-pill { cursor: pointer; }
.ph-viewer .ph-pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Mode photo : l'interface s'efface, un viseur prend l'écran */
body.photo-mode #hud > :not(#toasts):not(.tc-layer) { visibility: hidden; }
body.photo-mode .tc-pad, body.photo-mode .tc-side { display: none; }
body.photo-mode .phone-wrap:not(.ringing) { display: none; }
.cam { position: fixed; inset: 0; z-index: 14; pointer-events: none; font-family: 'Rajdhani', sans-serif; color: #fff; }
.cam-frame { position: absolute; inset: 7% 6% 17%; }
.cam-frame i { position: absolute; width: 42px; height: 42px; border: 0 solid rgba(255, 255, 255, 0.9); filter: drop-shadow(0 0 6px rgba(56, 232, 255, 0.7)); }
.cam-frame i:nth-child(1) { left: 0; top: 0; border-width: 2px 0 0 2px; border-top-left-radius: 14px; }
.cam-frame i:nth-child(2) { right: 0; top: 0; border-width: 2px 2px 0 0; border-top-right-radius: 14px; }
.cam-frame i:nth-child(3) { left: 0; bottom: 0; border-width: 0 0 2px 2px; border-bottom-left-radius: 14px; }
.cam-frame i:nth-child(4) { right: 0; bottom: 0; border-width: 0 2px 2px 0; border-bottom-right-radius: 14px; }
.cam-grid {
  position: absolute; inset: 0; opacity: 0.22;
  background:
    linear-gradient(to right, transparent calc(33.33% - 0.5px), #fff calc(33.33% - 0.5px), #fff calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px),
      transparent calc(66.66% - 0.5px), #fff calc(66.66% - 0.5px), #fff calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px)),
    linear-gradient(to bottom, transparent calc(33.33% - 0.5px), #fff calc(33.33% - 0.5px), #fff calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px),
      transparent calc(66.66% - 0.5px), #fff calc(66.66% - 0.5px), #fff calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px));
}
.cam-focus { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 1.5px solid rgba(255, 255, 255, 0.85); border-radius: 50%; }
.cam-top { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.cam-rec {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px;
  font: 700 11px 'Orbitron', sans-serif; letter-spacing: 0.2em; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(8px);
}
.cam-rec i { width: 7px; height: 7px; border-radius: 50%; background: #ff3b5c; box-shadow: 0 0 8px #ff3b5c; }
.cam.selfie .cam-rec::after { content: '/ SELFIE'; color: var(--cyan); letter-spacing: 0.14em; }
.cam-hint { padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, 0.85); background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(8px); }
.cam-hint kbd { margin: 0 1px; }
.cam-bar { position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); display: flex; align-items: center; gap: 44px; pointer-events: auto; }
.cam-btn {
  position: relative; display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  color: #fff; background: rgba(0, 0, 0, 0.42); backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.cam-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cam-btn small { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, 0.8); text-shadow: 0 1px 3px #000; }
.cam.selfie .cam-btn[data-cmd="selfie"] { color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan), 0 0 16px rgba(56, 232, 255, 0.5); }
.cam-shutter {
  display: grid; place-items: center; width: 78px; height: 78px; padding: 0; border: 3px solid #fff; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, 0.12); box-shadow: 0 0 24px rgba(56, 232, 255, 0.45);
}
.cam-shutter i { width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff, #dff6ff 60%, #a8f4ff); transition: transform 0.1s; }
.cam-shutter:active i { transform: scale(0.88); }
.cam-shade { position: absolute; inset: 0; background: #000; opacity: 0; }
.cam-shade.on { animation: cam-shutter 0.28s ease-out; }
@keyframes cam-shutter { 0% { opacity: 0; } 30% { opacity: 0.55; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cam-shade.on { animation: none; } }
