
/* Multi-thèmes BobGram */
:root, [data-theme="noir"] {
  --bg: #0a0a0b; --surface: #141416; --text: #f4f4f5; --muted: #9b9ba3;
  --accent: #ff4d6d; --accent-2: #ff8a3d; --line: #2a2a2e; --ok: #3dd68c;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
}
[data-theme="ambre"] {
  --bg:#1a1a2e; --surface:#22223a; --text:#f5f0e6; --muted:#a89b7c;
  --accent:#e6a817; --accent-2:#f0b93a; --line:#4a3f28; --ok:#c9a227;
  --shadow:0 8px 28px rgba(230,168,23,.12);
}
[data-theme="ocean"] {
  --bg:#0b1a2e; --surface:#12263d; --text:#fff; --muted:#7a9bb5;
  --accent:#00b4d8; --accent-2:#48cae4; --line:#1a3a5c; --ok:#00c9a7;
  --shadow:0 8px 28px rgba(0,180,216,.14);
}
[data-theme="foret"] {
  --bg:#0d1f0d; --surface:#142814; --text:#e0e0e0; --muted:#8fbc8f;
  --accent:#2ecc71; --accent-2:#27ae60; --line:#1e3d1e; --ok:#2ecc71;
  --shadow:0 8px 28px rgba(46,204,113,.12);
}
[data-theme="magenta"] {
  --bg:#1a0a1a; --surface:#2a1230; --text:#ffe6f7; --muted:#c79bb8;
  --accent:#ff2d95; --accent-2:#ff6bb5; --line:#4a2048; --ok:#ff6bb5;
  --shadow:0 8px 28px rgba(255,45,149,.14);
}
[data-theme="rouge"] {
  --bg:#1a0a0a; --surface:#2a1212; --text:#ffeaea; --muted:#cc9999;
  --accent:#e74c3c; --accent-2:#ff6b5a; --line:#4a2020; --ok:#e74c3c;
  --shadow:0 8px 28px rgba(231,76,60,.14);
}
[data-theme="gris"] {
  --bg:#121212; --surface:#1e1e1e; --text:#f0f0f0; --muted:#9a9a9a;
  --accent:#b0b0b0; --accent-2:#ddd; --line:#333; --ok:#8bc34a;
  --shadow:0 8px 28px rgba(0,0,0,.4);
}
[data-theme="blizzard"] {
  --bg:#e8f0fe; --surface:#ffffff; --text:#1a1a2e; --muted:#4a5a6e;
  --accent:#4fc3f7; --accent-2:#29b6f6; --line:#b0d4f1; --ok:#1f9d55;
  --shadow:0 8px 24px rgba(79,195,247,.18);
}
[data-theme="blizzard"] body {
  background:
    radial-gradient(900px 400px at 10% -10%, rgba(88,101,242,.18), transparent 55%),
    radial-gradient(700px 360px at 100% 0%, rgba(79,195,247,.3), transparent 50%),
    var(--bg) !important;
}
[data-theme="blizzard"] .app {
  background: rgba(255,255,255,.88);
}

.theme-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--dock-space, 175px) + 4px);
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  width: min(100% - 16px, var(--max, 470px));
  padding: 0.4rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.theme-bar button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.theme-bar button .swatch {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
}
.theme-bar button.is-active {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}
@media (max-width: 480px) {
  .theme-bar button .label { display: none; }
}


:root {
  --radius: 14px;
  --max: 470px;
  --font: "Segoe UI", "Avenir Next", "Helvetica Neue", sans-serif;
  --touch: 44px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --dock-space: 175px;
}


* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 50% -10%, #2a1218 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
}

body {
  display: flex;
  justify-content: center;
  padding: 0 0 calc(var(--dock-space) + var(--safe-bottom));
  width: 100%;
  max-width: 100vw;
}

img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}

button,
input,
textarea {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(100%, var(--max));
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  border-inline: 1px solid var(--line);
  background: rgba(10, 10, 11, 0.92);
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(12px + var(--safe-top)) 14px 12px;
  backdrop-filter: blur(10px);
  background: rgba(10, 10, 11, 0.8);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #12080a;
}

.brand-name {
  font-size: clamp(1.1rem, 4.5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, #fff, #ffc4b0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  width: var(--touch);
  height: var(--touch);
  min-width: var(--touch);
  min-height: var(--touch);
  border-radius: 999px;
  font-size: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
}

.stories {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.stories::-webkit-scrollbar { display: none; }

/* flatten so all rings scroll in one row */
.stories-list {
  display: contents;
}

.story-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  min-width: 72px;
  padding: 0;
}

.story-avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), #ffd166);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.story-ring.seen .story-avatar {
  background: linear-gradient(135deg, #555, #777);
}
.story-avatar > span,
.story-avatar.add {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  border: 2px solid var(--bg);
}
.story-name {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed {
  padding: 8px 0 24px;
  width: 100%;
  max-width: 100%;
}

.post {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 8px;
  animation: rise 0.35s ease both;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.post-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #111;
  flex-shrink: 0;
}

.post-user {
  font-weight: 650;
  font-size: 0.92rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.post-time { color: var(--muted); font-size: 0.75rem; }

.post-media {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #1a1a1d;
  display: block;
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px 4px;
}

.post-actions button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  min-height: var(--touch);
  font-size: 0.85rem;
  cursor: pointer;
}
.post-actions button.liked {
  border-color: var(--accent);
  color: var(--accent);
}
.post-actions button.tip {
  border-color: #c9a227;
  color: #ffd76a;
}

.post-meta {
  padding: 0 12px 6px;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.post-meta strong { font-weight: 700; }
.caption { margin-top: 4px; color: #e8e8ec; }
.caption .who { font-weight: 650; margin-right: 6px; }

.comments {
  padding: 0 12px 8px;
  display: grid;
  gap: 4px;
}
.comment {
  font-size: 0.84rem;
  color: #d7d7de;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.comment .who { font-weight: 650; margin-right: 6px; color: var(--text); }

.comment-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 12px 10px;
  align-items: center;
}
.comment-row input {
  flex: 1 1 160px;
  min-width: 0;
  min-height: var(--touch);
  border: 1px solid var(--line);
  background: #101012;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-size: 16px; /* avoid iOS zoom */
}
.comment-row button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 650;
  cursor: pointer;
  min-height: var(--touch);
  padding: 8px 12px;
  flex: 0 0 auto;
}

.dock {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 24px), calc(var(--max) - 24px));
  max-width: calc(100vw - 24px);
  z-index: 30;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(20, 20, 22, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.dock-row {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  min-width: 0;
}
.dock-row label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dock-row input {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--line);
  background: #0d0d0f;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px; /* avoid iOS zoom on focus */
}
.dock-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dock-actions button,
.sheet-actions button {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  min-height: var(--touch);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #16080b;
  font-weight: 700;
  cursor: pointer;
}
.sheet-actions button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.balance {
  font-variant-numeric: tabular-nums;
  color: #ffd76a;
  font-weight: 700;
}
.hint {
  margin: 8px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.muted { color: var(--muted); }
.center { text-align: center; padding: 28px 12px; }

.sheet {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  width: min(92vw, 420px);
  max-width: calc(100vw - 24px);
  max-height: min(90vh, 90dvh);
  overflow: auto;
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.65); }
.sheet-body {
  display: grid;
  gap: 10px;
  padding: 16px;
  margin: 0;
  min-width: 0;
}
.sheet-body h2 { margin: 0; font-size: 1.1rem; }
.sheet-body input[type="file"],
.sheet-body input[type="text"],
.sheet-body textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line);
  background: #0d0d0f;
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  font-size: 16px;
}
.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.viewer {
  border: 0;
  padding: 0;
  width: min(100vw, 470px);
  max-width: 100vw;
  height: min(100dvh, 100vh, 820px);
  max-height: 100dvh;
  background: #000;
  color: #fff;
}
.viewer::backdrop { background: #000; }
.viewer-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.viewer-inner img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.viewer-bars {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  gap: 4px;
}
.viewer-seg {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  overflow: hidden;
}
.viewer-seg > i {
  display: block;
  height: 100%;
  width: 0%;
  background: #fff;
}
.viewer-seg.done > i { width: 100%; }
.viewer-seg.active > i {
  animation: fill 5s linear forwards;
}
@keyframes fill {
  from { width: 0%; }
  to { width: 100%; }
}
.viewer-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  border: 0;
  background: transparent;
  z-index: 2;
  cursor: pointer;
}
.viewer-nav.prev { left: 0; }
.viewer-nav.next { right: 0; }
.viewer-footer {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(14px + var(--safe-bottom));
  z-index: 3;
  pointer-events: none;
}
.viewer-meta {
  margin: 0;
  font-weight: 650;
  text-shadow: 0 2px 8px #000;
  overflow-wrap: anywhere;
}
.viewer-ttl {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.75);
  text-shadow: 0 1px 6px #000;
}
.viewer-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
.viewer-tip,
.viewer-del {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  background: rgba(255,255,255,0.16);
  color: #fff;
  backdrop-filter: blur(6px);
}
.viewer-tip:hover,
.viewer-del:hover { background: rgba(255,255,255,0.28); }
.viewer-close {
  position: absolute;
  top: calc(22px + var(--safe-top));
  right: 8px;
  border: 0;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  width: var(--touch);
  height: var(--touch);
  border-radius: 999px;
  z-index: 4;
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty strong {
  display: block;
  color: var(--text);
  font-size: 1.05rem;
  margin-bottom: 6px;
}

/* —— Mobile / narrow phones —— */
@media (max-width: 480px) {
  :root {
    --dock-space: 168px;
  }

  .app {
    border-inline: 0;
    width: 100%;
  }

  .topbar {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .stories {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    gap: 10px;
  }

  .story-ring {
    min-width: 68px;
  }

  .story-avatar {
    width: 58px;
    height: 58px;
  }

  .dock {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    transform: none;
    bottom: calc(8px + var(--safe-bottom));
    padding: 12px;
  }

  .dock-actions {
    flex-direction: row;
    align-items: stretch;
  }

  .dock-actions button {
    flex: 1 1 auto;
  }

  .sheet {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    border-radius: 16px 16px 12px 12px;
    margin: 0;
  }

  .sheet-actions {
    justify-content: stretch;
  }

  .sheet-actions button {
    flex: 1 1 auto;
  }

  .viewer {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .post-actions button {
    flex: 1 1 auto;
    text-align: center;
  }

  .comment-row {
    flex-direction: column;
    align-items: stretch;
  }

  .comment-row input {
    flex: 1 1 auto;
    width: 100%;
  }

  .comment-row button {
    align-self: flex-end;
  }
}

/* —— Very small screens —— */
@media (max-width: 360px) {
  :root {
    --dock-space: 190px;
  }

  .brand-name {
    font-size: 1.05rem;
  }

  .post-actions {
    gap: 6px;
  }

  .post-actions button {
    padding: 10px 10px;
    font-size: 0.8rem;
  }

  .hint {
    font-size: 0.68rem;
  }
}

/* —— Landscape phones —— */
@media (max-height: 480px) and (orientation: landscape) {
  :root {
    --dock-space: 96px;
  }

  .dock {
    max-height: 42vh;
    overflow-y: auto;
  }

  .viewer {
    height: 100dvh;
  }
}

/* —— Desktop comfort —— */
@media (min-width: 768px) {
  body {
    padding-top: 8px;
  }

  .app {
    border-radius: 0 0 18px 18px;
    box-shadow: 0 0 0 1px var(--line), 0 24px 80px rgba(0, 0, 0, 0.35);
  }
}

/* Auth moved into burger — no bottom dock */
:root { --dock-space: 72px; }
.dock { display: none !important; }

.burger-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 0;
}
.burger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.burger-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 80;
}
.burger-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  height: 100dvh;
  width: min(340px, 92vw);
  z-index: 90;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(0,0,0,.35);
  padding: calc(14px + var(--safe-top)) 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.burger-panel[hidden], .burger-backdrop[hidden] { display: none !important; }
.burger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.burger-auth { display: grid; gap: 12px; }
.btn-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  background: #5865f2;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.btn-ghost-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.burger-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.2);
}
.burger-user img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #333;
}
.burger-user strong { display: block; }
.balance { color: #ffd76a; font-weight: 700; font-variant-numeric: tabular-nums; }
.hint { margin: 0; font-size: .8rem; color: var(--muted); line-height: 1.35; }
.auth-msg { margin: 0; font-size: .85rem; font-weight: 600; }
.auth-msg.ok { color: var(--ok, #3dd68c); }
.auth-msg.bad { color: #ff6b6b; }
.code-auth {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.code-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.code-row input {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.25);
  color: var(--text);
  padding: 0 12px;
  font-size: 1.15rem;
  letter-spacing: .28em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.btn-code {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 0;
  background: var(--accent, #ff4d6d);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
body.burger-open { overflow: hidden; }
