
/*
 * ZWorld Pulse V0.1
 * Deuxième interface mobile — même moteur IRC/ZProxy que le Terminal.
 */

#pulse-app,
#pulse-mode-switcher {
  --pulse-bg:#05060a;
  --pulse-panel:rgba(10,12,18,.94);
  --pulse-card:rgba(17,20,28,.94);
  --pulse-card-soft:rgba(21,24,33,.76);
  --pulse-green:#35eb94;
  --pulse-green-dim:rgba(53,235,148,.16);
  --pulse-purple:#9b5cff;
  --pulse-purple-dim:rgba(155,92,255,.15);
  --pulse-line:rgba(255,255,255,.09);
  --pulse-text:#f4f5fa;
  --pulse-muted:rgba(231,232,242,.55);
}

#pulse-app,
#pulse-mode-switcher {
  display:none;
}

@media (max-width:768px) {
  body.pulse-available #pulse-mode-switcher {
    position:fixed;
    top:calc(env(safe-area-inset-top, 0px) + 8px);
    right:9px;
    z-index:235;
    display:flex;
    gap:2px;
    padding:3px;
    border:1px solid rgba(255,255,255,.11);
    border-radius:999px;
    background:rgba(4,5,9,.88);
    box-shadow:
      0 8px 25px rgba(0,0,0,.48),
      0 0 20px rgba(155,92,255,.12);
    backdrop-filter:blur(18px);
  }

  #pulse-mode-switcher button {
    height:29px;
    padding:0 10px;
    border:0;
    border-radius:999px;
    color:rgba(255,255,255,.48);
    background:transparent;
    font:700 10px/1 var(--font-ui, "Space Grotesk", sans-serif);
    letter-spacing:.25px;
  }

  #pulse-mode-switcher button.active {
    color:#06110b;
    background:linear-gradient(135deg,#6bf2b4,var(--pulse-green));
    box-shadow:0 0 15px rgba(53,235,148,.25);
  }

  #pulse-mode-switcher button[data-mobile-ui="pulse"].active {
    color:#fff;
    background:linear-gradient(135deg,var(--pulse-purple),#bd7cff);
    box-shadow:0 0 16px rgba(155,92,255,.3);
  }

  body.pulse-active {
    overflow:hidden;
    background:var(--pulse-bg);
  }

  body.pulse-active #term-app {
    display:none !important;
  }

  body.pulse-active #pulse-app {
    position:fixed;
    inset:0;
    z-index:175;
    display:grid;
    grid-template-rows:auto minmax(0,1fr) auto auto;
    overflow:hidden;
    color:var(--pulse-text);
    background:
      radial-gradient(circle at -10% 16%,rgba(155,92,255,.25),transparent 43%),
      radial-gradient(circle at 112% 77%,rgba(53,235,148,.2),transparent 45%),
      linear-gradient(145deg,#090710 0%,#05060a 48%,#04100a 100%);
    font-family:var(--font-ui, "Space Grotesk", sans-serif);
  }

  #pulse-app::before {
    content:'';
    position:absolute;
    inset:0;
    z-index:0;
    pointer-events:none;
    opacity:.24;
    background-image:
      linear-gradient(rgba(255,255,255,.018) 1px,transparent 1px),
      linear-gradient(90deg,rgba(255,255,255,.012) 1px,transparent 1px);
    background-size:24px 24px;
  }

  #pulse-app * {
    box-sizing:border-box;
  }

  .pulse-header {
    position:relative;
    z-index:2;
    min-height:78px;
    padding:
      calc(env(safe-area-inset-top, 0px) + 12px)
      111px
      10px
      14px;
    display:flex;
    align-items:flex-end;
    gap:10px;
    border-bottom:1px solid var(--pulse-line);
    background:linear-gradient(180deg,rgba(3,4,8,.97),rgba(6,7,12,.83));
    backdrop-filter:blur(22px);
  }

  .pulse-header-symbol {
    flex:0 0 38px;
    width:38px;
    height:38px;
    display:grid;
    place-items:center;
    border:1px solid rgba(53,235,148,.25);
    border-radius:14px;
    color:var(--pulse-green);
    background:var(--pulse-green-dim);
    box-shadow:0 0 20px rgba(53,235,148,.08);
    font-size:20px;
    font-weight:900;
  }

  .pulse-header-copy {
    min-width:0;
    flex:1;
  }

  .pulse-title {
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:#fff;
    font-size:18px;
    font-weight:800;
    letter-spacing:-.25px;
  }

  .pulse-subtitle {
    margin-top:2px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:var(--pulse-muted);
    font-size:10px;
  }

  .pulse-header-actions {
    position:absolute;
    right:8px;
    bottom:9px;
    display:flex;
    gap:5px;
  }

  .pulse-header-actions button {
    width:31px;
    height:31px;
    padding:0;
    display:grid;
    place-items:center;
    border:1px solid rgba(255,255,255,.09);
    border-radius:11px;
    color:rgba(255,255,255,.76);
    background:rgba(255,255,255,.035);
    font-size:14px;
  }

  .pulse-header-actions button:active {
    color:var(--pulse-green);
    border-color:rgba(53,235,148,.35);
    background:var(--pulse-green-dim);
  }

  .pulse-content {
    position:relative;
    z-index:1;
    min-height:0;
    padding:14px 11px 24px;
    overflow-y:auto;
    overscroll-behavior:contain;
    scrollbar-width:none;
  }

  .pulse-content::-webkit-scrollbar {
    display:none;
  }

  .pulse-empty {
    min-height:100%;
    padding:38px 24px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:7px;
    color:var(--pulse-muted);
    text-align:center;
  }

  .pulse-empty strong {
    color:#fff;
    font-size:16px;
  }

  .pulse-message {
    margin:0 0 14px;
    display:grid;
    grid-template-columns:42px minmax(0,1fr);
    gap:9px;
  }

  .pulse-avatar,
  .pulse-list-avatar,
  .pulse-member-avatar {
    display:grid;
    place-items:center;
    flex-shrink:0;
    color:#fff;
    background:
      linear-gradient(145deg,color-mix(in srgb,var(--pulse-nick) 48%,#111 52%),rgba(155,92,255,.3));
    border:1px solid color-mix(in srgb,var(--pulse-nick) 75%,transparent);
    box-shadow:
      0 0 0 3px color-mix(in srgb,var(--pulse-nick) 7%,transparent),
      0 0 16px color-mix(in srgb,var(--pulse-nick) 10%,transparent);
    font-weight:800;
    text-transform:uppercase;
  }

  .pulse-avatar {
    width:42px;
    height:42px;
    border-radius:50%;
    font-size:13px;
  }

  .pulse-message-main {
    min-width:0;
  }

  .pulse-message-head {
    margin:0 0 4px;
    display:flex;
    align-items:baseline;
    gap:7px;
  }

  .pulse-message-nick {
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:13px;
    font-weight:800;
  }

  .pulse-message-time {
    flex-shrink:0;
    color:rgba(255,255,255,.32);
    font-size:9px;
  }

  .pulse-bubble {
    padding:10px 12px;
    border:1px solid var(--pulse-line);
    border-radius:5px 17px 17px 17px;
    color:#eff1f7;
    background:
      linear-gradient(145deg,rgba(24,28,38,.97),rgba(14,17,24,.93));
    box-shadow:
      0 7px 22px rgba(0,0,0,.16),
      inset 0 1px 0 rgba(255,255,255,.025);
  }

  .pulse-message-text {
    white-space:pre-wrap;
    overflow-wrap:anywhere;
    font-size:13px;
    line-height:1.48;
  }

  .pulse-message-text a {
    color:var(--pulse-green);
    text-decoration:none;
  }

  .pulse-edited {
    margin-left:5px;
    color:rgba(255,255,255,.3);
    font-size:9px;
  }

  .pulse-reply {
    margin:0 0 8px;
    padding:7px 9px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    border-left:2px solid var(--pulse-purple);
    border-radius:6px;
    color:rgba(255,255,255,.58);
    background:rgba(155,92,255,.08);
    font-size:10px;
  }

  .pulse-reactions {
    margin-top:7px;
    display:flex;
    flex-wrap:wrap;
    gap:5px;
  }

  .pulse-reaction {
    min-height:25px;
    padding:2px 8px;
    display:inline-flex;
    align-items:center;
    gap:4px;
    border:1px solid rgba(255,255,255,.1);
    border-radius:999px;
    color:rgba(255,255,255,.72);
    background:rgba(255,255,255,.035);
    font-size:11px;
  }

  .pulse-reaction.mine {
    color:var(--pulse-green);
    border-color:rgba(53,235,148,.4);
    background:var(--pulse-green-dim);
  }

  .pulse-system {
    width:max-content;
    max-width:92%;
    margin:7px auto 13px;
    padding:4px 10px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    border-radius:999px;
    color:rgba(255,255,255,.4);
    background:rgba(255,255,255,.03);
    font-size:9px;
    text-align:center;
  }

  .pulse-system a {
    color:var(--pulse-green);
  }

  .pulse-section-title {
    margin:3px 5px 11px;
    color:rgba(255,255,255,.43);
    font-size:10px;
    font-weight:800;
    letter-spacing:1.2px;
    text-transform:uppercase;
  }

  .pulse-list-card {
    width:100%;
    min-height:72px;
    margin:0 0 9px;
    padding:10px 12px;
    display:grid;
    grid-template-columns:44px minmax(0,1fr) auto;
    align-items:center;
    gap:10px;
    border:1px solid var(--pulse-line);
    border-radius:18px;
    color:inherit;
    text-align:left;
    background:
      linear-gradient(145deg,rgba(19,23,31,.94),rgba(10,13,19,.94));
    box-shadow:0 7px 22px rgba(0,0,0,.14);
  }

  .pulse-list-card:active {
    transform:scale(.985);
    border-color:rgba(53,235,148,.34);
  }

  .pulse-list-avatar {
    width:44px;
    height:44px;
    border-radius:50%;
    font-size:14px;
  }

  .pulse-list-copy {
    min-width:0;
    display:flex;
    flex-direction:column;
  }

  .pulse-list-name,
  .pulse-list-preview {
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .pulse-list-name {
    color:var(--pulse-purple);
    font-size:14px;
    font-weight:800;
  }

  .pulse-list-card.channel .pulse-list-name {
    color:var(--pulse-green);
  }

  .pulse-list-preview {
    margin-top:3px;
    color:var(--pulse-muted);
    font-size:11px;
  }

  .pulse-list-meta {
    min-width:31px;
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    gap:7px;
    color:rgba(255,255,255,.34);
    font-size:9px;
  }

  .pulse-unread {
    min-width:21px;
    height:21px;
    padding:0 6px;
    display:grid;
    place-items:center;
    border-radius:999px;
    color:#fff;
    background:var(--pulse-purple);
    box-shadow:0 0 14px rgba(155,92,255,.28);
    font-size:10px;
    font-weight:900;
  }

  .pulse-list-card.channel .pulse-unread {
    color:#04110a;
    background:var(--pulse-green);
    box-shadow:0 0 14px rgba(53,235,148,.22);
  }

  .pulse-member {
    width:100%;
    min-height:60px;
    margin-bottom:8px;
    padding:9px 11px;
    display:grid;
    grid-template-columns:42px minmax(0,1fr) 32px;
    align-items:center;
    gap:10px;
    border:1px solid var(--pulse-line);
    border-radius:16px;
    color:#fff;
    text-align:left;
    background:rgba(17,20,28,.87);
  }

  .pulse-member-avatar {
    width:42px;
    height:42px;
    border-radius:50%;
    font-size:13px;
  }

  .pulse-member-copy {
    min-width:0;
    display:flex;
    flex-direction:column;
  }

  .pulse-member-copy strong,
  .pulse-member-copy small {
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .pulse-member-copy strong {
    font-size:13px;
  }

  .pulse-member-copy small {
    margin-top:2px;
    color:var(--pulse-muted);
    font-size:10px;
  }

  .pulse-member-action {
    color:var(--pulse-green);
    font-size:16px;
    text-align:center;
  }

  .pulse-welcome {
    min-height:100%;
    padding:34px 15px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    text-align:center;
  }

  .pulse-orbit {
    position:relative;
    width:90px;
    height:90px;
    margin-bottom:17px;
    display:grid;
    place-items:center;
    border:2px solid rgba(155,92,255,.72);
    border-radius:50%;
    transform:rotate(-18deg);
    box-shadow:
      0 0 28px rgba(155,92,255,.2),
      inset 0 0 24px rgba(53,235,148,.1);
  }

  .pulse-orbit::after {
    content:'';
    position:absolute;
    width:112px;
    height:35px;
    border:2px solid rgba(53,235,148,.68);
    border-radius:50%;
  }

  .pulse-orbit span {
    width:59px;
    height:59px;
    display:grid;
    place-items:center;
    border-radius:22px;
    color:#fff;
    background:linear-gradient(145deg,var(--pulse-green),var(--pulse-purple));
    box-shadow:
      0 0 28px rgba(53,235,148,.22),
      0 0 42px rgba(155,92,255,.18);
    font-size:32px;
    font-weight:900;
    transform:rotate(18deg);
  }

  .pulse-kicker {
    color:var(--pulse-green);
    font-size:11px;
    font-weight:800;
    letter-spacing:4px;
  }

  .pulse-welcome h1 {
    margin:2px 0 8px;
    color:#fff;
    font-size:40px;
    line-height:1;
  }

  .pulse-welcome p {
    max-width:310px;
    margin:0;
    color:var(--pulse-muted);
    font-size:12px;
    line-height:1.55;
  }

  .pulse-stats {
    width:100%;
    max-width:330px;
    margin-top:22px;
    padding:11px;
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:7px;
    border:1px solid var(--pulse-line);
    border-radius:18px;
    background:rgba(15,18,25,.72);
  }

  .pulse-stats div {
    min-width:0;
    padding:9px 5px;
    display:flex;
    flex-direction:column;
    gap:3px;
    border-radius:12px;
    background:rgba(255,255,255,.025);
  }

  .pulse-stats strong {
    color:var(--pulse-green);
    font-size:15px;
  }

  .pulse-stats div:nth-child(2) strong {
    color:var(--pulse-purple);
  }

  .pulse-stats span {
    color:var(--pulse-muted);
    font-size:9px;
  }

  .pulse-profile {
    padding:24px 16px;
    border:1px solid var(--pulse-line);
    border-radius:22px;
    text-align:center;
    background:var(--pulse-card);
  }

  .pulse-profile-avatar {
    width:74px;
    height:74px;
    margin:0 auto 11px;
    display:grid;
    place-items:center;
    border-radius:50%;
    color:#fff;
    background:linear-gradient(145deg,var(--pulse-green),var(--pulse-purple));
    box-shadow:
      0 0 25px rgba(53,235,148,.16),
      0 0 35px rgba(155,92,255,.15);
    font-size:25px;
    font-weight:900;
  }

  .pulse-profile h2 {
    margin:0;
    color:#fff;
  }

  .pulse-profile p {
    margin:5px 0 18px;
    color:var(--pulse-muted);
    font-size:11px;
  }

  .pulse-profile button {
    width:100%;
    height:43px;
    margin-top:8px;
    border:1px solid rgba(155,92,255,.32);
    border-radius:14px;
    color:#fff;
    background:var(--pulse-purple-dim);
    font-weight:800;
  }

  .pulse-composer {
    position:relative;
    z-index:2;
    min-height:62px;
    padding:8px 9px;
    display:grid;
    grid-template-columns:38px minmax(0,1fr) 36px 42px;
    align-items:center;
    gap:6px;
    border-top:1px solid var(--pulse-line);
    background:rgba(5,6,10,.91);
    backdrop-filter:blur(20px);
  }

  .pulse-composer[hidden] {
    display:none;
  }

  .pulse-composer button {
    height:38px;
    padding:0;
    display:grid;
    place-items:center;
    border:1px solid rgba(255,255,255,.08);
    border-radius:50%;
    color:rgba(255,255,255,.75);
    background:rgba(255,255,255,.035);
    font-size:17px;
  }

  #pulse-plus {
    color:var(--pulse-green);
    border-color:rgba(53,235,148,.19);
    background:var(--pulse-green-dim);
    font-size:20px;
  }

  #pulse-send {
    color:#04110a;
    border:0;
    background:linear-gradient(145deg,#69f2b4,var(--pulse-green));
    box-shadow:0 0 19px rgba(53,235,148,.22);
  }

  #pulse-input {
    width:100%;
    height:40px;
    padding:0 12px;
    border:1px solid rgba(255,255,255,.1);
    border-radius:17px;
    outline:none;
    color:#fff;
    background:rgba(255,255,255,.045);
    font:400 13px/1 var(--font-ui, "Space Grotesk", sans-serif);
  }

  #pulse-input:focus {
    border-color:rgba(53,235,148,.42);
    box-shadow:0 0 0 3px rgba(53,235,148,.07);
  }

  #pulse-input::placeholder {
    color:rgba(255,255,255,.3);
  }

  .pulse-nav {
    position:relative;
    z-index:2;
    min-height:69px;
    padding:
      5px
      6px
      calc(env(safe-area-inset-bottom, 0px) + 5px);
    display:grid;
    grid-template-columns:repeat(5,1fr);
    align-items:center;
    border-top:1px solid var(--pulse-line);
    background:rgba(4,5,9,.97);
    backdrop-filter:blur(24px);
  }

  .pulse-nav button {
    min-width:0;
    height:51px;
    padding:0;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    border:0;
    border-radius:14px;
    color:rgba(255,255,255,.38);
    background:transparent;
  }

  .pulse-nav button > span {
    font-size:20px;
    line-height:1;
  }

  .pulse-nav button small {
    font-size:9px;
    font-weight:700;
  }

  .pulse-nav button.active {
    color:var(--pulse-green);
    background:rgba(53,235,148,.06);
  }

  .pulse-nav button[data-pulse-view="private"].active {
    color:var(--pulse-purple);
    background:rgba(155,92,255,.07);
  }

  .pulse-nav b {
    width:47px;
    height:47px;
    margin-top:-13px;
    display:grid;
    place-items:center;
    border:1px solid rgba(255,255,255,.23);
    border-radius:18px;
    color:#fff;
    background:linear-gradient(145deg,var(--pulse-green),var(--pulse-purple));
    box-shadow:
      0 0 24px rgba(53,235,148,.2),
      0 0 30px rgba(155,92,255,.18);
    font-size:25px;
    font-weight:900;
  }
}
