/* ============================================================
   allah.rocks
   ============================================================ */

:root {
  --bg:        #0e0e10;
  --panel:     #151517;
  --panel-2:   #1c1c20;
  --line:      rgba(255, 255, 255, .075);
  --line-soft: rgba(255, 255, 255, .045);
  --text:      #e8e6e2;
  --muted:     #8e8a82;
  --faint:     #605c56;
  --accent:    #8fb8a0;
  --accent-dk: #2b4438;

  --radius:    14px;
  --shell:     820px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --arabic: "Traditional Arabic", "Arabic Typesetting", Amiri,
            "Scheherazade New", "Noto Naskh Arabic", "Geeza Pro",
            "Segoe UI", serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

::selection { background: rgba(143, 184, 160, .28); }

kbd {
  font: inherit;
  font-size: .84em;
  padding: .1em .4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--muted);
  background: var(--panel-2);
}

/* ---------- la pierre ---------- */

.stone-glyph {
  font-family: var(--arabic);
  font-size: 52px;
  text-anchor: middle;
  direction: rtl;
}
.stone-glyph--lit { fill: #b3a897; opacity: .55; transform: translate(1.2px, 1.4px); }
.stone-glyph--cut { fill: #100e0c; opacity: .88; }

/* ============================================================
   Écran d'entrée
   ============================================================ */

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(143, 184, 160, .07), transparent 70%),
    var(--bg);
}

.gate[hidden] { display: none; }

.gate__card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: rise .5s cubic-bezier(.2, .7, .3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
}

.gate__stone {
  width: 116px;
  height: 116px;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .55));
}

.gate__title {
  margin: 20px 0 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.gate__title span { color: var(--accent); }

.gate__sub {
  margin: 10px 0 28px;
  color: var(--muted);
  font-size: 14.5px;
}

.gate__form { display: grid; gap: 10px; text-align: left; }

.field { display: block; }

.field__label {
  display: block;
  margin: 0 0 7px 2px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .01em;
}
.field__label em {
  font-style: normal;
  color: var(--faint);
}

.field__input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .18s, background .18s;
}
.field__input::placeholder { color: var(--faint); }
.field__input:focus {
  border-color: rgba(143, 184, 160, .5);
  background: var(--panel-2);
}

.btn {
  width: 100%;
  padding: 12px 16px;
  font: inherit;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s, transform .1s;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  margin-top: 6px;
  background: var(--accent);
  color: #10201a;
}
.btn--primary:hover { background: #a2c7b1; }

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}
.btn--ghost:hover { color: var(--text); border-color: rgba(255, 255, 255, .16); }

.gate__foot {
  margin: 26px 0 0;
  font-size: 12.5px;
  color: var(--faint);
}

/* ============================================================
   Salon
   ============================================================ */

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.app[hidden] { display: none; }

/* ---------- barre du haut ---------- */

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px max(20px, calc((100% - var(--shell)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(14, 14, 16, .86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand__stone {
  width: 34px;
  height: 34px;
  flex: none;
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, .5));
}

.brand__text { display: flex; flex-direction: column; min-width: 0; }

.brand__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.brand__name span { color: var(--accent); }

.brand__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  transition: background .3s;
}
.dot.is-live {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(143, 184, 160, .13);
}

.me {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  min-width: 0;
}

.me__avatar, .msg__avatar {
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 600;
  color: #14120f;
  text-transform: uppercase;
  user-select: none;
}
.me__avatar { width: 24px; height: 24px; font-size: 11px; }

.me__name {
  font-size: 13px;
  color: var(--muted);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- flux ---------- */

.stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .13) transparent;
}
.stream::-webkit-scrollbar { width: 10px; }
.stream::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .11);
  border-radius: 99px;
  border: 3px solid var(--bg);
}

.stream__inner {
  width: 100%;
  max-width: var(--shell);
  margin: auto auto 0;   /* le fil reste ancré en bas quand il est court */
  padding: 22px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.welcome {
  text-align: center;
  padding: 28px 0 34px;
  color: var(--muted);
}
.welcome__stone { width: 54px; height: 54px; opacity: .75; }
.welcome p { margin: 12px 0 3px; font-size: 14px; color: var(--text); }
.welcome span { font-size: 12.5px; color: var(--faint); }

/* ---------- messages ---------- */

.msg {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  padding: 3px 0;
  animation: pop .22s ease-out both;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(4px); }
}

.msg + .msg.is-head { margin-top: 12px; }

.msg__avatar {
  width: 32px;
  height: 32px;
  font-size: 13px;
  margin-top: 2px;
}
.msg:not(.is-head) .msg__avatar { visibility: hidden; height: 0; margin: 0; }

.msg__meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 1px;
}
.msg:not(.is-head) .msg__meta { display: none; }

.msg__name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.005em;
}
.msg__name .tag {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--faint);
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  vertical-align: 1px;
}

.msg__time {
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.msg__text {
  font-size: 14.5px;
  line-height: 1.6;
  color: #dcdad6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg__text a {
  color: var(--accent);
  text-underline-offset: 2px;
}

.msg.is-me .msg__name { color: var(--accent) !important; }
.msg.is-me .msg__text { color: var(--text); }

/* ---------- messages système ---------- */

.sys {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-size: 12px;
  color: var(--faint);
  animation: pop .22s ease-out both;
}
.sys::before, .sys::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

/* ---------- « écrit… » ---------- */

.typing {
  flex: none;
  height: 20px;
  padding: 0 max(20px, calc((100% - var(--shell)) / 2));
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  opacity: 0;
  transition: opacity .2s;
}
.typing.is-on { opacity: 1; }

.typing__dots { display: inline-flex; gap: 3px; }
.typing__dots i {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.3s infinite;
}
.typing__dots i:nth-child(2) { animation-delay: .18s; }
.typing__dots i:nth-child(3) { animation-delay: .36s; }

@keyframes blink {
  0%, 60%, 100% { opacity: .25; }
  30%           { opacity: 1; }
}

/* ---------- barre d'écriture ---------- */

.composer {
  flex: none;
  padding: 10px max(20px, calc((100% - var(--shell)) / 2))
           calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(14, 14, 16, .86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.composer__form {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 7px 7px 7px 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  transition: border-color .18s;
}
.composer__form:focus-within { border-color: rgba(143, 184, 160, .42); }

.composer__input {
  flex: 1;
  min-width: 0;
  max-height: 148px;
  padding: 7px 0;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: none;
  border: none;
  outline: none;
  resize: none;
  scrollbar-width: thin;
}
.composer__input::placeholder { color: var(--faint); }

.send {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--accent-dk);
  color: var(--muted);
  cursor: pointer;
  transition: background .18s, color .18s, transform .12s;
}
.send svg { width: 19px; height: 19px; }
.send:disabled { opacity: .45; cursor: default; }
.send:not(:disabled) { background: var(--accent); color: #10201a; }
.send:not(:disabled):hover { background: #a2c7b1; }
.send:not(:disabled):active { transform: scale(.93); }

.composer__hint {
  margin: 8px 2px 0;
  font-size: 11.5px;
  color: var(--faint);
  text-align: center;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 12px);
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 20;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   Écrans étroits
   ============================================================ */

@media (max-width: 560px) {
  .composer__hint { display: none; }
  .composer { padding-top: 8px; }
  .stream__inner { padding: 16px 14px 6px; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .typing { padding: 0 14px; }
  .composer { padding-left: 14px; padding-right: 14px; }
  .me__name { max-width: 92px; }
  .msg { grid-template-columns: 28px minmax(0, 1fr); gap: 9px; }
  .msg__avatar { width: 28px; height: 28px; font-size: 12px; }
}

/* ============================================================
   Messages d'annonce
   ============================================================ */

.msg.is-admin .msg__avatar {
  background: var(--accent) !important;
  color: #10201a;
}
.msg.is-admin .msg__text {
  padding: 9px 13px;
  border-left: 2px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: rgba(143, 184, 160, .07);
  color: var(--text);
}

.announce {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: 13px 22px;
  text-align: center;
  font-size: 14.5px;
  font-weight: 500;
  color: #10201a;
  background: linear-gradient(90deg, #8fb8a0, #b4cfbe, #8fb8a0);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
  transform: translateY(-100%);
  transition: transform .38s cubic-bezier(.2, .8, .3, 1);
}
.announce.is-on { transform: translateY(0); }

/* ============================================================
   Écran de blocage (banni / exclu)
   ============================================================ */

.blocked {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 8, 9, .93);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.blocked__box {
  max-width: 380px;
  text-align: center;
}
.blocked__box h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 600;
  color: #d98f8f;
}
.blocked__box p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

/* ============================================================
   Effets
   ============================================================ */

.fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}

.fx-emoji {
  position: fixed;
  top: -70px;
  z-index: 70;
  pointer-events: none;
  user-select: none;
  animation: fx-fall linear forwards;
}

@keyframes fx-fall {
  to { transform: translate(var(--drift), 108vh) rotate(var(--turn)); }
}

.fx-flash {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  background: #fff;
  animation: fx-flash .9s ease-out forwards;
}

@keyframes fx-flash {
  0%   { opacity: .92; }
  100% { opacity: 0; }
}

.fx-bigtext {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  pointer-events: none;
  padding: 20px;
  text-align: center;
  font-size: clamp(42px, 13vw, 148px);
  font-weight: 800;
  letter-spacing: -.03em;
  color: #fff;
  text-shadow: 0 6px 40px rgba(0, 0, 0, .7);
  animation: fx-bigtext 2.4s cubic-bezier(.2, .8, .3, 1) forwards;
}

@keyframes fx-bigtext {
  0%   { opacity: 0; transform: scale(.3); }
  18%  { opacity: 1; transform: scale(1.06); }
  30%  { transform: scale(1); }
  80%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.25); }
}

body.fx-shake   { animation: fx-shake .55s cubic-bezier(.36, .07, .19, .97) 0s 2 both; }
body.fx-invert  { filter: invert(1) hue-rotate(180deg); transition: filter .35s; }
body.fx-blur    { filter: blur(5px); transition: filter .45s; }
body.fx-spin    { animation: fx-spin 2.6s cubic-bezier(.5, 0, .5, 1) both; }
body.fx-rainbow { animation: fx-rainbow 1.7s linear infinite; }

/* les couches d'effet ne doivent pas subir les filtres appliqués au corps */
body.fx-invert .fx-canvas, body.fx-invert .fx-emoji,
body.fx-blur   .fx-canvas, body.fx-blur   .fx-emoji { filter: invert(1) hue-rotate(180deg); }

@keyframes fx-shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-9px, 0, 0); }
  40%, 60% { transform: translate3d(9px, 0, 0); }
}

@keyframes fx-spin {
  0%   { transform: rotate(0); }
  100% { transform: rotate(360deg); }
}

@keyframes fx-rainbow {
  0%   { filter: hue-rotate(0); }
  100% { filter: hue-rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .fx-bigtext { animation: none !important; opacity: 1; }
}
