:root {
  --bg: #111017;
  --accent: #d7a86e;
  --paper: rgba(255, 249, 240, 0.92);
  --paper-strong: #fff9f0;
  --paper-soft: rgba(255, 249, 240, 0.68);
  --ink: #241d1e;
  --muted: rgba(36, 29, 30, 0.58);
  --line: rgba(36, 29, 30, 0.14);
  --white-line: rgba(255, 249, 240, 0.18);
  --white-soft: rgba(255, 249, 240, 0.10);
  --glass-dark: rgba(12, 9, 16, 0.48);
  --glass-darker: rgba(12, 9, 16, 0.72);
  --shadow: 0 34px 120px rgba(10, 7, 12, 0.42);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

/* Click shield fix: author CSS can override the native hidden attribute.
   Keep hidden auth/modals truly gone so they cannot block buttons. */
[hidden],
.auth-screen[hidden],
.modal-backdrop.hidden {
  display: none !important;
  pointer-events: none !important;
}

html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--paper);
  background: var(--bg);
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.background {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 194, 115, 0.20), transparent 32%),
    radial-gradient(circle at 82% 72%, rgba(158, 108, 255, 0.18), transparent 38%),
    linear-gradient(90deg, rgba(8, 6, 11, 0.76), rgba(8, 6, 11, 0.46), rgba(8, 6, 11, 0.74)),
    linear-gradient(135deg, #211826, #181521 45%, #2b211b);
}
.background::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 92%);
}

.page { position: relative; z-index: 1; min-height: 100vh; padding: 24px; }
.wrap { max-width: 1180px; margin: 0 auto; }
.topbar { position: sticky; top: 18px; z-index: 20; margin-bottom: 30px; }
.topbar-inner {
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  padding: 10px; border: 1px solid var(--white-line); border-radius: 999px;
  background: rgba(17, 13, 22, 0.58); backdrop-filter: blur(20px); box-shadow: var(--shadow);
}
.brand, .room-nav a, .top-actions button {
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid transparent; color: var(--paper);
}
.brand { gap: 10px; padding: 0 14px 0 10px; }
.brand-mark { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, #fff2cf, #f2a86f 50%, #9b6cff); box-shadow: 0 0 30px rgba(255, 205, 147, .35); }
.room-nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: center; }
.room-nav a { padding: 0 14px; color: var(--paper-soft); }
.room-nav a.active, .room-nav a:hover { color: var(--ink); background: var(--paper); }
.top-actions { display: flex; gap: 8px; }
.top-actions button { padding: 0 14px; background: var(--white-soft); color: var(--paper); border-color: var(--white-line); }
.top-actions button:hover { background: var(--paper); color: var(--ink); }

.main { min-height: 70vh; }
.room-view { animation: pageIn .34s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.intro { max-width: 760px; margin: 56px 0 30px; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; color: var(--paper-soft); margin-bottom: 12px; }
h1 { font-size: clamp(2.5rem, 7vw, 5.9rem); line-height: .92; letter-spacing: -0.07em; margin: 0 0 18px; }
h2 { margin: 0; font-size: 1.1rem; }
h3 { margin: 0; }
p { line-height: 1.65; }
.subtitle { color: var(--paper-soft); max-width: 680px; font-size: 1.05rem; }
.action-row, .button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn, button, .file-label {
  border: 0; border-radius: 999px; background: var(--paper); color: var(--ink); padding: 11px 16px; font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,.14);
}
.btn.secondary, button.secondary { background: var(--white-soft); color: var(--paper); border: 1px solid var(--white-line); box-shadow: none; }
.btn.danger, button.danger { background: #4c151a; color: #fff5f0; }
.btn.small, button.small { padding: 8px 12px; font-size: .86rem; }

.grid, .split-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .62fr); gap: 18px; align-items: start; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.panel, .dark-panel, .media-player, .auth-card {
  border-radius: var(--radius-xl); box-shadow: var(--shadow); overflow: hidden;
}
.panel { background: var(--paper); color: var(--ink); border: 1px solid rgba(255,255,255,.35); }
.dark-panel, .media-player { background: var(--glass-darker); border: 1px solid var(--white-line); color: var(--paper); backdrop-filter: blur(20px); }
.panel, .dark-panel { padding: 22px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-head span, .muted { color: var(--muted); font-size: .92rem; }
.dark-panel .panel-head span, .dark-panel .muted { color: var(--paper-soft); }
.status-pill, .pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 7px 10px; font-size: .78rem; font-weight: 800;
  background: rgba(36,29,30,.08); color: var(--ink); white-space: nowrap;
}
.dark-panel .pill, .dark-panel .status-pill { background: var(--white-soft); color: var(--paper); }

.stack { display: grid; gap: 14px; }
.quick-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field, label { display: grid; gap: 7px; font-weight: 700; color: inherit; }
.field.wide, .wide { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 16px; padding: 12px 13px; background: rgba(255,255,255,.58); color: var(--ink); outline: none;
}
.dark-panel input, .dark-panel select, .dark-panel textarea, .auth-card input {
  color: var(--paper); background: rgba(255,255,255,.08); border-color: var(--white-line);
}
textarea { min-height: 96px; resize: vertical; }
.form-actions { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 16px; color: var(--muted); }
.dark-panel .form-actions { color: var(--paper-soft); }
.status-line { min-height: 24px; color: var(--paper-soft); }

.countdown-display { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.count-card { border-radius: 22px; background: rgba(36,29,30,.07); padding: 22px; text-align: center; }
.count-card strong { display: block; font-size: clamp(2rem, 5vw, 4.8rem); letter-spacing: -0.08em; }
.count-card span { color: var(--muted); font-weight: 800; }
.countdown-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }

.local-list { display: grid; gap: 10px; }
.list-item, .event-item, .file-item, .secret-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px; border-radius: 18px;
  background: rgba(255,255,255,.08); border: 1px solid var(--white-line);
}
.panel .list-item, .panel .event-item, .panel .file-item { background: rgba(36,29,30,.06); border-color: var(--line); }
.item-main { min-width: 0; }
.item-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main span { display: block; color: var(--paper-soft); font-size: .88rem; margin-top: 4px; }
.panel .item-main span { color: var(--muted); }

.media-player { padding: 14px; }
video, audio { width: 100%; display: block; border-radius: 22px; background: #050407; }
video { aspect-ratio: 16 / 9; object-fit: contain; }
.sync-row, .ready-grid, .link-pill-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ready-item, .link-pill-row span {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 999px; background: var(--white-soft); border: 1px solid var(--white-line);
}
.image-wall { columns: 260px; column-gap: 16px; }
.image-card { break-inside: avoid; margin: 0 0 16px; border-radius: 24px; overflow: hidden; background: var(--glass-darker); border: 1px solid var(--white-line); }
.image-card img { width: 100%; display: block; }
.image-card div { padding: 12px; }

.auth-screen {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(5,4,8,.72); backdrop-filter: blur(18px);
}
.auth-card { width: min(460px, 100%); padding: 28px; background: rgba(17, 13, 22, 0.86); border: 1px solid var(--white-line); }
body.is-locked .page { filter: blur(6px); pointer-events: none; user-select: none; }

.route-curtain { position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .24s ease; background: rgba(8,6,11,.62); backdrop-filter: blur(20px); display: grid; place-items: center; }
.route-curtain.show { opacity: 1; }
.route-loader { width: 180px; height: 4px; border-radius: 999px; overflow: hidden; background: var(--white-soft); }
.route-loader span { display: block; width: 40%; height: 100%; border-radius: inherit; background: var(--paper); animation: load 1s ease infinite; }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

.empty { padding: 22px; border-radius: 22px; border: 1px dashed var(--white-line); color: var(--paper-soft); text-align: center; }
.panel .empty { border-color: var(--line); color: var(--muted); }
.hidden { display: none !important; }

@media (max-width: 860px) {
  .page { padding: 14px; }
  .topbar { position: static; }
  .topbar-inner { border-radius: 26px; align-items: stretch; flex-direction: column; }
  .brand { justify-content: flex-start; }
  .room-nav { justify-content: flex-start; }
  .grid, .split-board { grid-template-columns: 1fr; }
  .countdown-display { grid-template-columns: repeat(2, 1fr); }
  .form-actions { align-items: stretch; flex-direction: column; }
}

/* Respect the hidden attribute. Without this, .stack/display:grid overrides hidden and both auth forms show. */
[hidden] {
  display: none !important;
}

.profile-chip {
  min-height: 40px; display: inline-flex; align-items: center; gap: 9px; border-radius: 999px;
  padding: 5px 12px 5px 6px; background: var(--white-soft); border: 1px solid var(--white-line); color: var(--paper); font-weight: 800;
}
.profile-chip:hover { background: var(--paper); color: var(--ink); }
.top-avatar, .profile-avatar {
  display: inline-grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--accent), rgba(255,255,255,.72));
  color: var(--ink); font-weight: 900; background-size: cover; background-position: center;
}
.top-avatar { width: 30px; height: 30px; font-size: .8rem; }
.profile-avatar.big { width: 92px; height: 92px; font-size: 2rem; box-shadow: 0 18px 60px rgba(0,0,0,.22); }
.profile-preview { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.compact-intro { margin-top: 36px; }

.calendar-shell { padding: 22px; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.weekday-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 8px; color: var(--paper-soft); font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.weekday-row span { padding: 0 10px; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day-cell {
  min-height: 132px; border-radius: 20px; border: 1px solid var(--white-line); background: rgba(255,255,255,.075); color: var(--paper);
  padding: 10px; display: flex; flex-direction: column; align-items: stretch; text-align: left; box-shadow: none; overflow: hidden; cursor: pointer;
}
.day-cell:hover { background: rgba(255,255,255,.12); transform: translateY(-1px); }
.day-cell.muted-month { opacity: .45; }
.day-cell.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.day-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.day-number { font-weight: 900; color: var(--paper); }
.day-add { width: 28px; height: 28px; padding: 0; display: inline-grid; place-items: center; border-radius: 50%; background: var(--white-soft); border: 1px solid var(--white-line); color: var(--paper); box-shadow: none; font-size: 1rem; line-height: 1; }
.day-add:hover { background: var(--paper); color: var(--ink); }
.day-events { display: grid; gap: 5px; min-width: 0; }
.calendar-event {
  width: 100%; border-radius: 11px; border: 1px solid rgba(255,255,255,.16); background: rgba(0,0,0,.18); color: var(--paper);
  padding: 6px 7px; box-shadow: none; display: grid; gap: 1px; text-align: left; position: relative; overflow: hidden;
}
.calendar-event::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--event-color); }
.calendar-event span { color: var(--paper-soft); font-size: .68rem; padding-left: 4px; }
.calendar-event strong { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
.more-events { color: var(--paper-soft); font-size: .75rem; padding-left: 6px; }
.agenda-lower, .calltime-lower { margin-top: 18px; }
.agenda-help p { margin-bottom: 0; }
.modal-backdrop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 22px; background: rgba(5,4,8,.66); backdrop-filter: blur(18px); }
.modal-card { width: min(680px, 100%); max-height: min(780px, 92vh); overflow: auto; border-radius: var(--radius-xl); padding: 24px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.modal-card textarea { min-height: 130px; }

.call-hero { padding: 28px; margin-bottom: 18px; }
.mega-time { font-size: clamp(2.8rem, 9vw, 7rem); letter-spacing: -0.08em; line-height: .95; font-weight: 900; margin: 18px 0; }
.live-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 14px; border-top: 1px solid var(--white-line); color: var(--paper-soft); }
.live-line strong { color: var(--paper); font-size: 1.4rem; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { border-radius: 22px; padding: 18px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); min-width: 0; }
.stat-card span { display: block; color: var(--muted); font-weight: 900; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.stat-card strong { display: block; font-size: clamp(1.15rem, 2.4vw, 1.8rem); letter-spacing: -0.04em; margin-top: 8px; overflow-wrap: anywhere; }
.stat-card small { display: block; color: var(--muted); margin-top: 6px; }
.bar-chart { display: grid; gap: 8px; max-height: 420px; overflow: auto; padding-right: 4px; }
.bar-row { display: grid; grid-template-columns: 86px minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: .82rem; color: inherit; }
.bar-row > span { color: inherit; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row > div { height: 10px; border-radius: 999px; background: rgba(36,29,30,.10); overflow: hidden; }
.dark-panel .bar-row > div { background: var(--white-soft); }
.bar-row i { display: block; height: 100%; border-radius: inherit; background: var(--accent); opacity: .86; }
.bar-row strong { font-size: .78rem; text-align: right; white-space: nowrap; }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .calendar-toolbar { align-items: stretch; flex-direction: column; }
  .weekday-row { display: none; }
  .month-grid { grid-template-columns: 1fr; }
  .day-cell { min-height: 108px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .bar-row { grid-template-columns: 72px minmax(0, 1fr) 60px; }
  .top-actions { flex-wrap: wrap; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .quick-form-grid { grid-template-columns: 1fr; }
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--paper-soft);
  font-size: .94rem;
}
.link-button {
  padding: 0;
  min-height: auto;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--paper);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.link-button:hover {
  color: var(--accent);
  background: transparent;
}

/* Library visual shelf */
.library-room { max-width: 1060px; margin: 0 auto; }
.library-intro {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; max-width: none;
}
.library-count {
  min-width: 118px; border-radius: 26px; padding: 18px 20px; background: rgba(255,255,255,.075); border: 1px solid var(--white-line);
  text-align: center; box-shadow: var(--shadow);
}
.library-count strong { display: block; font-size: 2.2rem; line-height: .9; letter-spacing: -.07em; }
.library-count span { display: block; color: var(--paper-soft); font-weight: 800; margin-top: 6px; }
.library-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .7fr); gap: 16px; margin-bottom: 28px; }
.library-tool { border-radius: 28px; }
.library-wall-wrap { margin-top: 8px; padding-bottom: 50px; }
.library-wall-head { padding: 0 4px; }
.library-masonry { columns: 3 240px; column-gap: 18px; }
.library-masonry .empty { break-inside: avoid; }
.shelf-card {
  position: relative; break-inside: avoid; margin: 0 0 18px; overflow: hidden; border-radius: 22px; background: #0b0d0c;
  min-height: 160px; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 24px 90px rgba(0,0,0,.36);
  transform: translateZ(0);
}
.shelf-card:hover .shelf-visual img { transform: scale(1.035); }
.shelf-card:hover .shelf-title { opacity: 1; transform: translateY(0); }
.shelf-visual { min-height: 100%; }
.shelf-visual img { width: 100%; min-height: 175px; display: block; object-fit: cover; transition: transform .4s ease; }
.shelf-placeholder {
  min-height: 260px; display: grid; place-items: center; padding: 26px; color: rgba(255,255,255,.82); text-transform: uppercase; letter-spacing: .18em; font-size: .74rem; font-weight: 900;
  background:
    radial-gradient(circle at 20% 18%, rgba(255,255,255,.22), transparent 28%),
    radial-gradient(circle at 82% 80%, rgba(87, 130, 90,.38), transparent 34%),
    linear-gradient(135deg, #172416, #36502e 48%, #10150f);
}
.seed-1 { min-height: 190px; background: linear-gradient(135deg, #0f2118, #2f523d 58%, #09100c); }
.seed-2 { min-height: 330px; background: linear-gradient(135deg, #14211f, #415b52 52%, #13100f); }
.seed-3 { min-height: 230px; background: linear-gradient(135deg, #17210f, #536734 52%, #0f1208); }
.seed-4 { min-height: 380px; background: linear-gradient(135deg, #1f1712, #6c3d24 48%, #0b0807); }
.file-tile { min-height: 300px; background: linear-gradient(135deg, #1a1a20, #51483d 54%, #0d0d12); }
.shelf-shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,.18), transparent 32%, rgba(0,0,0,.72));
}
.shelf-topline {
  position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  opacity: 0; transition: opacity .2s ease;
}
.shelf-card:hover .shelf-topline { opacity: 1; }
.shelf-topline span {
  max-width: calc(100% - 42px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 999px; padding: 7px 10px;
  background: rgba(0,0,0,.38); backdrop-filter: blur(14px); color: rgba(255,255,255,.86); font-size: .72rem; font-weight: 800;
}
.shelf-delete, .shelf-open {
  width: 30px; height: 30px; min-height: 30px; padding: 0; display: inline-grid; place-items: center; border-radius: 50%;
  background: rgba(255,255,255,.90); color: #171414; border: 0; box-shadow: 0 10px 28px rgba(0,0,0,.22); font-weight: 900;
}
.shelf-delete { background: rgba(60, 14, 19, .86); color: #fff; }
.shelf-caption {
  position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.shelf-person { min-width: 0; display: inline-flex; align-items: center; gap: 8px; color: white; font-weight: 900; font-size: .82rem; text-shadow: 0 2px 20px rgba(0,0,0,.75); }
.shelf-person span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-avatar { width: 24px; height: 24px; flex: 0 0 auto; border-radius: 50%; background-size: cover; background-position: center; border: 1px solid rgba(255,255,255,.45); }
.shelf-avatar-fallback { display: inline-grid; place-items: center; background: var(--paper); color: var(--ink); font-size: .72rem; }
.shelf-title {
  position: absolute; left: 12px; right: 12px; bottom: 54px; padding: 12px; border-radius: 16px; color: white;
  background: rgba(0,0,0,.34); border: 1px solid rgba(255,255,255,.10); backdrop-filter: blur(16px);
  opacity: 0; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease;
}
.shelf-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-title span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; color: rgba(255,255,255,.72); font-size: .8rem; line-height: 1.35; }

/* Cleaner call-time dashboard */
.clean-call-hero { margin-bottom: 14px; }
.call-compact-row {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding-top: 14px; border-top: 1px solid var(--white-line);
}
.call-compact-row div { min-width: 0; border-radius: 18px; background: var(--white-soft); padding: 12px 14px; }
.call-compact-row span { display: block; color: var(--paper-soft); font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.call-compact-row strong { display: block; margin-top: 4px; color: var(--paper); font-size: 1.14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.mini-metric {
  min-width: 0; border-radius: 20px; padding: 14px 15px; background: rgba(255,255,255,.075); border: 1px solid var(--white-line); color: var(--paper);
}
.mini-metric span { display: block; color: var(--paper-soft); font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.mini-metric strong { display: block; margin-top: 6px; font-size: 1.15rem; letter-spacing: -.04em; overflow-wrap: anywhere; }
.mini-metric small { display: block; margin-top: 4px; color: var(--paper-soft); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-details { margin-top: 12px; padding: 0; }
.call-details summary {
  list-style: none; padding: 18px 22px; cursor: pointer; font-weight: 900; display: flex; align-items: center; justify-content: space-between;
}
.call-details summary::-webkit-details-marker { display: none; }
.call-details summary::after { content: "+"; width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--white-soft); border: 1px solid var(--white-line); }
.panel.call-details summary::after { background: rgba(36,29,30,.06); border-color: var(--line); }
.call-details[open] summary::after { content: "–"; }
.call-details .local-list, .call-details .chart-stack { padding: 0 22px 22px; }
.chart-stack { display: grid; gap: 18px; }
.compact-session { padding: 12px; }
.calm-bars { max-height: 280px; }

@media (max-width: 860px) {
  .library-intro { align-items: stretch; flex-direction: column; }
  .library-count { align-self: flex-start; }
  .library-tools { grid-template-columns: 1fr; }
  .call-compact-row, .call-overview { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .library-masonry { columns: 1; }
  .call-compact-row, .call-overview { grid-template-columns: 1fr; }
}

/* Library wall mode */
.library-room.wall-mode {
  width: min(calc(100vw - 48px), 1380px);
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
  position: relative;
  padding-bottom: 88px;
}
.library-wall-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 34px 0 18px;
  padding: 0 4px;
}
.library-wall-hero h1 {
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  margin-bottom: 0;
}
.library-wall-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.library-count.compact {
  min-width: 92px;
  padding: 12px 14px;
  border-radius: 22px;
  background: rgba(255,255,255,.07);
}
.library-count.compact strong { font-size: 1.65rem; }
.library-count.compact span { font-size: .78rem; }
.library-plus {
  width: 58px;
  height: 58px;
  min-height: 58px;
  padding: 0;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 22px 70px rgba(0,0,0,.35), 0 0 50px rgba(215,168,110,.22);
}
.library-wall-wrap.full-wall {
  margin-top: 0;
  min-height: 62vh;
}
.full-wall .library-masonry {
  columns: 4 250px;
  column-gap: 20px;
}
.full-wall .empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  border-radius: 32px;
  background: rgba(255,255,255,.045);
  border: 1px dashed rgba(255,249,240,.24);
  color: var(--paper-soft);
}
.wall-mode .shelf-card {
  margin-bottom: 20px;
  border-radius: 24px;
  cursor: pointer;
  background: #050705;
}
.wall-mode .shelf-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 32px 110px rgba(0,0,0,.48);
}
.wall-mode .shelf-visual img {
  min-height: 0;
  height: 270px;
}
.wall-mode .card-size-1 .shelf-visual img,
.wall-mode .card-size-1 .shelf-placeholder { height: 170px; min-height: 170px; }
.wall-mode .card-size-2 .shelf-visual img,
.wall-mode .card-size-2 .shelf-placeholder { height: 360px; min-height: 360px; }
.wall-mode .card-size-3 .shelf-visual img,
.wall-mode .card-size-3 .shelf-placeholder { height: 260px; min-height: 260px; }
.wall-mode .card-size-4 .shelf-visual img,
.wall-mode .card-size-4 .shelf-placeholder { height: 430px; min-height: 430px; }
.wall-mode .card-size-5 .shelf-visual img,
.wall-mode .card-size-5 .shelf-placeholder { height: 310px; min-height: 310px; }
.wall-mode .shelf-title {
  opacity: 0;
  bottom: 56px;
}
.wall-mode .shelf-caption {
  bottom: 14px;
}
.wall-mode .shelf-person {
  font-size: .78rem;
  max-width: calc(100% - 42px);
}
.wall-mode .shelf-open {
  opacity: .96;
}
.library-modal {
  z-index: 80;
}
.library-modal-card.modal-card {
  width: min(620px, 100%);
  background: rgba(15, 12, 19, .94);
  color: var(--paper);
  border: 1px solid var(--white-line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}
.library-modal-card .eyebrow {
  margin-bottom: 8px;
}
.modal-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.icon-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.25rem;
}
.library-tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--white-line);
  margin-bottom: 18px;
}
.library-tabs button {
  flex: 1;
  box-shadow: none;
  background: transparent;
  color: var(--paper-soft);
}
.library-tabs button.active {
  background: var(--paper);
  color: var(--ink);
}
.library-add-panel textarea,
.library-modal-card textarea {
  min-height: 110px;
}
.library-settings-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.library-settings-meta span {
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--white-line);
  color: var(--paper-soft);
  font-size: .82rem;
  font-weight: 800;
}
.split-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
}
.split-actions span {
  align-self: center;
  text-align: center;
}
.library-modal-card input,
.library-modal-card textarea {
  color: var(--paper);
  background: rgba(255,255,255,.08);
  border-color: var(--white-line);
}
.library-modal-card input[type="file"] {
  padding: 10px;
}

@media (max-width: 980px) {
  .full-wall .library-masonry { columns: 3 220px; }
}
@media (max-width: 700px) {
  .library-room.wall-mode { width: min(calc(100vw - 28px), 1380px); }
  .library-wall-hero { align-items: flex-start; }
  .library-wall-actions { align-items: flex-end; flex-direction: column-reverse; }
  .full-wall .library-masonry { columns: 2 160px; column-gap: 12px; }
  .wall-mode .shelf-card { margin-bottom: 12px; border-radius: 18px; }
  .wall-mode .card-size-1 .shelf-visual img,
  .wall-mode .card-size-1 .shelf-placeholder { height: 140px; min-height: 140px; }
  .wall-mode .card-size-2 .shelf-visual img,
  .wall-mode .card-size-2 .shelf-placeholder { height: 260px; min-height: 260px; }
  .wall-mode .card-size-3 .shelf-visual img,
  .wall-mode .card-size-3 .shelf-placeholder { height: 210px; min-height: 210px; }
  .wall-mode .card-size-4 .shelf-visual img,
  .wall-mode .card-size-4 .shelf-placeholder { height: 300px; min-height: 300px; }
  .wall-mode .card-size-5 .shelf-visual img,
  .wall-mode .card-size-5 .shelf-placeholder { height: 230px; min-height: 230px; }
  .library-plus { width: 52px; height: 52px; min-height: 52px; }
  .split-actions { grid-template-columns: 1fr; }
  .split-actions span { text-align: left; }
}

/* Library: full visual wall */
.library-room.wall-gallery-mode {
  width: min(calc(100vw - 36px), 1440px);
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
  position: relative;
  min-height: calc(100vh - 150px);
  padding-bottom: 96px;
}
.library-room.wall-gallery-mode .library-wall-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 14px;
  padding: 0 4px;
  color: var(--paper-soft);
}
.library-room.wall-gallery-mode .library-wall-strip .eyebrow {
  margin-bottom: 4px;
  opacity: .82;
}
.library-room.wall-gallery-mode .library-wall-strip strong {
  color: var(--paper);
  font-size: 1.15rem;
  letter-spacing: -.04em;
}
.library-room.wall-gallery-mode .library-wall-wrap.full-wall {
  margin: 0;
  min-height: 74vh;
}
.library-room.wall-gallery-mode .library-masonry {
  columns: 5 230px;
  column-gap: 18px;
  min-height: 74vh;
}
.library-room.wall-gallery-mode .shelf-card {
  width: 100%;
  display: block;
  break-inside: avoid;
  margin: 0 0 18px;
  border-radius: 22px;
  overflow: hidden;
  cursor: pointer;
  background: #060706;
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 22px 90px rgba(0,0,0,.42);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.library-room.wall-gallery-mode .shelf-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,.18);
  box-shadow: 0 34px 120px rgba(0,0,0,.56);
}
.library-room.wall-gallery-mode .shelf-visual,
.library-room.wall-gallery-mode .shelf-visual img,
.library-room.wall-gallery-mode .shelf-placeholder {
  width: 100%;
}
.library-room.wall-gallery-mode .shelf-visual img {
  display: block;
  object-fit: cover;
  min-height: 0;
  background: #050505;
}
.library-room.wall-gallery-mode .fit-contain .shelf-visual img {
  object-fit: contain;
  padding: 10px;
}
.library-room.wall-gallery-mode .card-size-1 .shelf-visual img,
.library-room.wall-gallery-mode .card-size-1 .shelf-placeholder,
.library-room.wall-gallery-mode .wall-size-small .shelf-visual img,
.library-room.wall-gallery-mode .wall-size-small .shelf-placeholder,
.library-room.wall-gallery-mode .shelf-card.wall-size-small { height: 178px; min-height: 178px; }
.library-room.wall-gallery-mode .card-size-2 .shelf-visual img,
.library-room.wall-gallery-mode .card-size-2 .shelf-placeholder,
.library-room.wall-gallery-mode .wall-size-tall .shelf-visual img,
.library-room.wall-gallery-mode .wall-size-tall .shelf-placeholder,
.library-room.wall-gallery-mode .shelf-card.wall-size-tall { height: 410px; min-height: 410px; }
.library-room.wall-gallery-mode .card-size-3 .shelf-visual img,
.library-room.wall-gallery-mode .card-size-3 .shelf-placeholder,
.library-room.wall-gallery-mode .wall-size-medium .shelf-visual img,
.library-room.wall-gallery-mode .wall-size-medium .shelf-placeholder,
.library-room.wall-gallery-mode .shelf-card.wall-size-medium { height: 270px; min-height: 270px; }
.library-room.wall-gallery-mode .card-size-4 .shelf-visual img,
.library-room.wall-gallery-mode .card-size-4 .shelf-placeholder,
.library-room.wall-gallery-mode .wall-size-feature .shelf-visual img,
.library-room.wall-gallery-mode .wall-size-feature .shelf-placeholder,
.library-room.wall-gallery-mode .shelf-card.wall-size-feature { height: 510px; min-height: 510px; }
.library-room.wall-gallery-mode .card-size-5 .shelf-visual img,
.library-room.wall-gallery-mode .card-size-5 .shelf-placeholder { height: 320px; min-height: 320px; }
.library-room.wall-gallery-mode .shelf-title {
  bottom: 56px;
  opacity: 0;
}
.library-room.wall-gallery-mode .shelf-card:hover .shelf-title {
  opacity: 1;
  transform: translateY(0);
}
.library-room.wall-gallery-mode .shelf-caption {
  bottom: 13px;
}
.library-room.wall-gallery-mode .shelf-person {
  max-width: calc(100% - 42px);
  font-size: .78rem;
}
.library-room.wall-gallery-mode .shelf-open {
  opacity: .96;
}
.library-room.wall-gallery-mode .wall-add-card {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 22px;
  border: 1px dashed rgba(255,249,240,.28);
  color: var(--paper);
  background:
    radial-gradient(circle at 32% 20%, rgba(215,168,110,.22), transparent 34%),
    radial-gradient(circle at 84% 88%, rgba(155,108,255,.18), transparent 42%),
    rgba(255,255,255,.045);
  box-shadow: none;
  font-weight: 900;
}
.library-room.wall-gallery-mode .wall-add-card:hover {
  background:
    radial-gradient(circle at 32% 20%, rgba(215,168,110,.32), transparent 34%),
    radial-gradient(circle at 84% 88%, rgba(155,108,255,.24), transparent 42%),
    rgba(255,255,255,.075);
}
.library-room.wall-gallery-mode .wall-add-plus {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  background: var(--paper);
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 22px 70px rgba(0,0,0,.34);
}
.library-room.wall-gallery-mode .wall-ghost {
  pointer-events: none;
  opacity: .36;
  background:
    linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.02)),
    radial-gradient(circle at 30% 20%, rgba(215,168,110,.16), transparent 34%),
    radial-gradient(circle at 82% 75%, rgba(120,86,180,.18), transparent 44%);
  border: 1px dashed rgba(255,249,240,.18);
  box-shadow: none;
}
.library-room.wall-gallery-mode .ghost-2,
.library-room.wall-gallery-mode .ghost-5,
.library-room.wall-gallery-mode .ghost-8 { opacity: .22; }
.library-fab {
  position: fixed;
  z-index: 65;
  right: max(24px, calc((100vw - 1440px) / 2 + 24px));
  bottom: 28px;
  width: 66px;
  height: 66px;
  min-height: 66px;
  padding: 0;
  border-radius: 50%;
  font-size: 2.35rem;
  line-height: 1;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(255,255,255,.44);
  box-shadow: 0 28px 90px rgba(0,0,0,.50), 0 0 70px rgba(215,168,110,.22);
}
.library-fab:hover {
  transform: translateY(-2px) scale(1.03);
}
@media (max-width: 1100px) {
  .library-room.wall-gallery-mode .library-masonry { columns: 4 210px; }
}
@media (max-width: 820px) {
  .library-room.wall-gallery-mode { width: min(calc(100vw - 24px), 1440px); }
  .library-room.wall-gallery-mode .library-masonry { columns: 3 180px; column-gap: 12px; }
  .library-room.wall-gallery-mode .shelf-card { margin-bottom: 12px; border-radius: 18px; }
  .library-fab { right: 18px; bottom: 18px; width: 58px; height: 58px; min-height: 58px; }
}
@media (max-width: 560px) {
  .library-room.wall-gallery-mode .library-masonry { columns: 2 150px; }
  .library-room.wall-gallery-mode .card-size-1 .shelf-visual img,
  .library-room.wall-gallery-mode .card-size-1 .shelf-placeholder,
  .library-room.wall-gallery-mode .wall-size-small .shelf-visual img,
  .library-room.wall-gallery-mode .wall-size-small .shelf-placeholder,
  .library-room.wall-gallery-mode .shelf-card.wall-size-small { height: 142px; min-height: 142px; }
  .library-room.wall-gallery-mode .card-size-2 .shelf-visual img,
  .library-room.wall-gallery-mode .card-size-2 .shelf-placeholder,
  .library-room.wall-gallery-mode .wall-size-tall .shelf-visual img,
  .library-room.wall-gallery-mode .wall-size-tall .shelf-placeholder,
  .library-room.wall-gallery-mode .shelf-card.wall-size-tall { height: 280px; min-height: 280px; }
  .library-room.wall-gallery-mode .card-size-3 .shelf-visual img,
  .library-room.wall-gallery-mode .card-size-3 .shelf-placeholder,
  .library-room.wall-gallery-mode .wall-size-medium .shelf-visual img,
  .library-room.wall-gallery-mode .wall-size-medium .shelf-placeholder,
  .library-room.wall-gallery-mode .shelf-card.wall-size-medium { height: 210px; min-height: 210px; }
  .library-room.wall-gallery-mode .card-size-4 .shelf-visual img,
  .library-room.wall-gallery-mode .card-size-4 .shelf-placeholder,
  .library-room.wall-gallery-mode .wall-size-feature .shelf-visual img,
  .library-room.wall-gallery-mode .wall-size-feature .shelf-placeholder,
  .library-room.wall-gallery-mode .shelf-card.wall-size-feature { height: 330px; min-height: 330px; }
  .library-room.wall-gallery-mode .card-size-5 .shelf-visual img,
  .library-room.wall-gallery-mode .card-size-5 .shelf-placeholder { height: 240px; min-height: 240px; }
}

/* Library wall v3: anchor the wall to the room instead of letting it drift right. */
.library-room.wall-gallery-mode {
  width: 100%;
  max-width: none;
  margin: 0;
  margin-left: 0;
  transform: none;
  min-height: calc(100vh - 136px);
  padding-bottom: 96px;
}
.library-room.wall-gallery-mode .library-wall-strip {
  width: 100%;
  margin: 4px 0 14px;
  padding: 0 2px;
}
.library-room.wall-gallery-mode .library-wall-strip .eyebrow {
  margin-bottom: 1px;
}
.library-room.wall-gallery-mode .library-wall-strip strong {
  font-size: 1rem;
}
.library-room.wall-gallery-mode .library-wall-wrap.full-wall {
  width: 100%;
  margin: 0;
  min-height: calc(100vh - 190px);
}
.library-room.wall-gallery-mode .library-masonry {
  columns: initial;
  column-gap: initial;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  grid-auto-rows: 10px;
  grid-auto-flow: dense;
  gap: 18px;
  width: 100%;
  min-height: calc(100vh - 190px);
  align-items: stretch;
}
.library-room.wall-gallery-mode .shelf-card {
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  grid-row: span 28;
}
.library-room.wall-gallery-mode .shelf-card.card-size-1,
.library-room.wall-gallery-mode .shelf-card.wall-size-small {
  grid-row: span 18;
}
.library-room.wall-gallery-mode .shelf-card.card-size-2,
.library-room.wall-gallery-mode .shelf-card.wall-size-tall {
  grid-row: span 42;
}
.library-room.wall-gallery-mode .shelf-card.card-size-3,
.library-room.wall-gallery-mode .shelf-card.wall-size-medium {
  grid-row: span 28;
}
.library-room.wall-gallery-mode .shelf-card.card-size-4,
.library-room.wall-gallery-mode .shelf-card.wall-size-feature {
  grid-row: span 52;
}
.library-room.wall-gallery-mode .shelf-card.card-size-5 {
  grid-row: span 34;
}
.library-room.wall-gallery-mode .shelf-visual,
.library-room.wall-gallery-mode .shelf-visual img,
.library-room.wall-gallery-mode .shelf-placeholder {
  height: 100% !important;
  min-height: 0 !important;
}
.library-room.wall-gallery-mode .shelf-visual img {
  object-fit: cover;
}
.library-room.wall-gallery-mode .fit-contain .shelf-visual img {
  object-fit: contain;
  padding: 10px;
}
.library-room.wall-gallery-mode .wall-add-card {
  min-height: 0 !important;
}
.library-room.wall-gallery-mode .wall-ghost {
  min-height: 0 !important;
}

@media (min-width: 1300px) {
  .library-room.wall-gallery-mode {
    width: min(calc(100vw - 48px), 1440px);
    margin-left: calc(50% - min(calc(100vw - 48px), 1440px) / 2);
  }
  .library-room.wall-gallery-mode .library-masonry {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  }
}
@media (max-width: 820px) {
  .library-room.wall-gallery-mode {
    width: 100%;
    margin-left: 0;
  }
  .library-room.wall-gallery-mode .library-masonry {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    grid-auto-rows: 8px;
    gap: 12px;
  }
  .library-room.wall-gallery-mode .shelf-card.card-size-1,
  .library-room.wall-gallery-mode .shelf-card.wall-size-small { grid-row: span 17; }
  .library-room.wall-gallery-mode .shelf-card.card-size-2,
  .library-room.wall-gallery-mode .shelf-card.wall-size-tall { grid-row: span 34; }
  .library-room.wall-gallery-mode .shelf-card.card-size-3,
  .library-room.wall-gallery-mode .shelf-card.wall-size-medium { grid-row: span 25; }
  .library-room.wall-gallery-mode .shelf-card.card-size-4,
  .library-room.wall-gallery-mode .shelf-card.wall-size-feature { grid-row: span 40; }
  .library-room.wall-gallery-mode .shelf-card.card-size-5 { grid-row: span 29; }
}

/* Library upload preview */
.library-file-preview {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.11);
}
.library-preview-visual {
  height: 104px;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 25% 10%, rgba(215,168,110,.25), transparent 36%),
    rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.10);
  display: grid;
  place-items: center;
}
.library-preview-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.library-preview-file {
  color: var(--paper);
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.library-preview-meta {
  min-width: 0;
}
.library-preview-meta strong,
.library-preview-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-preview-meta strong {
  color: var(--paper);
  font-size: 1rem;
  margin-bottom: 5px;
}
.library-preview-meta span {
  color: var(--paper-soft);
  font-weight: 700;
  font-size: .88rem;
}
@media (max-width: 560px) {
  .library-file-preview { grid-template-columns: 1fr; }
  .library-preview-visual { height: 150px; }
}

/* Per-user personalization */
html[data-radius="sharp"] { --radius-xl: 18px; --radius-lg: 12px; --radius-md: 9px; }
html[data-radius="soft"] { --radius-xl: 32px; --radius-lg: 22px; --radius-md: 16px; }
html[data-radius="round"] { --radius-xl: 44px; --radius-lg: 30px; --radius-md: 22px; }

html[data-theme="midnight"] {
  --bg: #070812;
  --paper: rgba(236, 240, 255, 0.92);
  --paper-strong: #f3f5ff;
  --paper-soft: rgba(236, 240, 255, 0.68);
  --ink: #11131f;
  --muted: rgba(17, 19, 31, 0.58);
  --line: rgba(17, 19, 31, 0.16);
  --white-line: rgba(236, 240, 255, 0.16);
  --white-soft: rgba(236, 240, 255, 0.09);
  --glass-dark: rgba(6, 8, 18, 0.50);
  --glass-darker: rgba(6, 8, 18, 0.76);
}
html[data-theme="forest"] {
  --bg: #07110c;
  --paper: rgba(241, 248, 232, 0.92);
  --paper-strong: #f7ffe9;
  --paper-soft: rgba(241, 248, 232, 0.68);
  --ink: #142016;
  --muted: rgba(20, 32, 22, 0.58);
  --line: rgba(20, 32, 22, 0.16);
  --white-line: rgba(241, 248, 232, 0.16);
  --white-soft: rgba(241, 248, 232, 0.09);
  --glass-dark: rgba(5, 13, 8, 0.50);
  --glass-darker: rgba(5, 13, 8, 0.76);
}
html[data-theme="ocean"] {
  --bg: #061018;
  --paper: rgba(230, 247, 255, 0.92);
  --paper-strong: #f0fbff;
  --paper-soft: rgba(230, 247, 255, 0.68);
  --ink: #091b28;
  --muted: rgba(9, 27, 40, 0.58);
  --line: rgba(9, 27, 40, 0.15);
  --white-line: rgba(230, 247, 255, 0.16);
  --white-soft: rgba(230, 247, 255, 0.09);
  --glass-dark: rgba(4, 12, 20, 0.50);
  --glass-darker: rgba(4, 12, 20, 0.76);
}
html[data-theme="rose"] {
  --bg: #170c13;
  --paper: rgba(255, 242, 247, 0.92);
  --paper-strong: #fff5f8;
  --paper-soft: rgba(255, 242, 247, 0.68);
  --ink: #26131b;
  --muted: rgba(38, 19, 27, 0.58);
  --line: rgba(38, 19, 27, 0.15);
  --white-line: rgba(255, 242, 247, 0.16);
  --white-soft: rgba(255, 242, 247, 0.09);
  --glass-dark: rgba(20, 8, 14, 0.50);
  --glass-darker: rgba(20, 8, 14, 0.76);
}
html[data-theme="ember"] {
  --bg: #150907;
  --paper: rgba(255, 244, 230, 0.92);
  --paper-strong: #fff7ed;
  --paper-soft: rgba(255, 244, 230, 0.68);
  --ink: #26120c;
  --muted: rgba(38, 18, 12, 0.58);
  --line: rgba(38, 18, 12, 0.15);
  --white-line: rgba(255, 244, 230, 0.16);
  --white-soft: rgba(255, 244, 230, 0.09);
  --glass-dark: rgba(18, 7, 5, 0.50);
  --glass-darker: rgba(18, 7, 5, 0.76);
}

.background::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--wallpaper-url, none);
  background-size: cover;
  background-position: center;
  opacity: 0;
  filter: saturate(0.9) contrast(0.94);
  transition: opacity .28s ease;
}
html[data-background="custom"] .background::before {
  opacity: calc(1 - var(--wallpaper-dim, .68));
}
html[data-background="aurora"] .background {
  background:
    radial-gradient(circle at 18% 20%, color-mix(in srgb, var(--accent) 42%, transparent), transparent 32%),
    radial-gradient(circle at 82% 72%, rgba(158, 108, 255, 0.18), transparent 38%),
    linear-gradient(90deg, rgba(8, 6, 11, 0.76), rgba(8, 6, 11, 0.46), rgba(8, 6, 11, 0.74)),
    linear-gradient(135deg, #211826, #181521 45%, #2b211b);
}
html[data-background="stars"] .background {
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.20) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 68%, rgba(255,255,255,.16) 0 1px, transparent 2px),
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.13) 0 1px, transparent 2px),
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--accent) 32%, transparent), transparent 30%),
    linear-gradient(135deg, #070812, #11131f 50%, #09070f);
  background-size: 220px 220px, 310px 310px, 180px 180px, auto, auto;
}
html[data-background="window"] .background {
  background:
    linear-gradient(110deg, rgba(255,255,255,.06) 0 1px, transparent 1px 74px),
    radial-gradient(circle at 14% 18%, rgba(170, 205, 255,.18), transparent 28%),
    radial-gradient(circle at 88% 82%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 40%),
    linear-gradient(135deg, #0a1018, #1b1820 48%, #101015);
}
html[data-background="moss"] .background {
  background:
    radial-gradient(circle at 18% 16%, rgba(193, 232, 151,.18), transparent 32%),
    radial-gradient(circle at 82% 70%, rgba(77, 124, 75,.30), transparent 42%),
    linear-gradient(135deg, #07110c, #152315 45%, #090d08);
}
html[data-background="blush"] .background {
  background:
    radial-gradient(circle at 20% 16%, rgba(255, 174, 195,.24), transparent 34%),
    radial-gradient(circle at 86% 72%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 44%),
    linear-gradient(135deg, #170c13, #271723 46%, #11090f);
}
html[data-background="void"] .background {
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 38%),
    linear-gradient(135deg, #050507, #09090e 50%, #050507);
}
html[data-background="custom"] .background {
  background:
    linear-gradient(90deg, rgba(5, 5, 8, var(--wallpaper-dim, .68)), rgba(5, 5, 8, calc(var(--wallpaper-dim, .68) - .14)), rgba(5, 5, 8, var(--wallpaper-dim, .68))),
    linear-gradient(135deg, #111017, #181521 45%, #111017);
}

html[data-surface="glass"] .panel {
  background: rgba(255,255,255,.16);
  color: var(--paper);
  border-color: var(--white-line);
  backdrop-filter: blur(24px);
}
html[data-surface="glass"] .panel .muted,
html[data-surface="glass"] .panel .panel-head span,
html[data-surface="glass"] .panel .countdown-meta,
html[data-surface="glass"] .panel .count-card span,
html[data-surface="glass"] .panel .form-actions { color: var(--paper-soft); }
html[data-surface="glass"] .panel input,
html[data-surface="glass"] .panel select,
html[data-surface="glass"] .panel textarea {
  color: var(--paper);
  background: rgba(255,255,255,.08);
  border-color: var(--white-line);
}
html[data-surface="glass"] .panel .status-pill,
html[data-surface="glass"] .panel .pill,
html[data-surface="glass"] .panel .count-card {
  background: var(--white-soft);
  color: var(--paper);
}
html[data-surface="dim"] .panel,
html[data-surface="dim"] .dark-panel,
html[data-surface="dim"] .media-player {
  background: rgba(8, 7, 11, .80);
  color: var(--paper);
  border-color: var(--white-line);
}
html[data-surface="dim"] .panel input,
html[data-surface="dim"] .panel select,
html[data-surface="dim"] .panel textarea {
  color: var(--paper);
  background: rgba(255,255,255,.08);
  border-color: var(--white-line);
}
html[data-surface="dim"] .panel .muted,
html[data-surface="dim"] .panel .panel-head span,
html[data-surface="dim"] .panel .form-actions { color: var(--paper-soft); }

html[data-density="compact"] .panel,
html[data-density="compact"] .dark-panel { padding: 16px; }
html[data-density="compact"] .intro { margin: 34px 0 20px; }
html[data-density="compact"] .quick-form-grid { gap: 10px; }
html[data-density="compact"] input,
html[data-density="compact"] select,
html[data-density="compact"] textarea { padding: 9px 11px; border-radius: 12px; }
html[data-density="roomy"] .panel,
html[data-density="roomy"] .dark-panel { padding: 30px; }
html[data-density="roomy"] .intro { margin: 76px 0 42px; }
html[data-density="roomy"] .quick-form-grid { gap: 18px; }
html[data-density="roomy"] input,
html[data-density="roomy"] select,
html[data-density="roomy"] textarea { padding: 15px 16px; }

html[data-nav="minimal"] .topbar-inner {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
html[data-nav="minimal"] .room-nav a,
html[data-nav="minimal"] .profile-chip,
html[data-nav="minimal"] .top-actions button {
  background: transparent;
  border-color: transparent;
}
html[data-nav="minimal"] .room-nav a.active,
html[data-nav="minimal"] .room-nav a:hover {
  background: var(--white-soft);
  color: var(--paper);
}
html[data-nav="rail"] .topbar-inner {
  border-radius: var(--radius-xl);
  align-items: stretch;
}
html[data-nav="rail"] .room-nav a,
html[data-nav="rail"] .brand,
html[data-nav="rail"] .profile-chip,
html[data-nav="rail"] .top-actions button {
  border-radius: var(--radius-lg);
}

html[data-motion="calm"] *,
html[data-motion="calm"] *::before,
html[data-motion="calm"] *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}

.preferences-panel { margin-top: 18px; }
.preferences-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.room-label-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: rgba(36,29,30,.045);
}
.room-label-editor summary {
  cursor: pointer;
  font-weight: 900;
  color: inherit;
  margin-bottom: 12px;
}
.theme-preview-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 96px;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 18% 14%, color-mix(in srgb, var(--accent) 32%, transparent), transparent 38%),
    rgba(36,29,30,.055);
  border: 1px solid var(--line);
}
.theme-dot {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--paper));
  box-shadow: 0 16px 42px color-mix(in srgb, var(--accent) 34%, transparent);
}
.theme-strip {
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--paper-soft));
}
.theme-card-preview {
  height: 58px;
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 0 14px 42px rgba(0,0,0,.14);
}
html[data-surface="glass"] .room-label-editor,
html[data-surface="dim"] .room-label-editor,
html[data-surface="glass"] .theme-preview-row,
html[data-surface="dim"] .theme-preview-row {
  border-color: var(--white-line);
  background: var(--white-soft);
}
html[data-surface="glass"] .theme-card-preview,
html[data-surface="dim"] .theme-card-preview {
  background: rgba(255,255,255,.18);
}

@media (max-width: 860px) {
  .preferences-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .preferences-grid { grid-template-columns: 1fr; }
  .theme-preview-row { grid-template-columns: 44px 1fr; }
  .theme-card-preview { display: none; }
}

/* v1.2 layout fixes + new rooms */
.library-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  overflow: auto;
  padding: 24px;
}
.library-modal-card.modal-card {
  width: min(760px, calc(100vw - 32px));
  max-height: min(700px, 86vh);
  margin: auto;
  transform: none;
}
.library-room.wall-gallery-mode .library-masonry .wall-add-card {
  break-inside: avoid;
}

.stats-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .75fr);
  gap: 18px;
  margin-bottom: 18px;
}
.stats-call-panel { margin-bottom: 0; }
.storage-panel { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.storage-meter {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  border: 1px solid var(--white-line);
}
.storage-meter i {
  display: block;
  height: 100%;
  width: 2%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), rgba(255,255,255,.78));
  box-shadow: 0 0 28px rgba(255,255,255,.18);
}
.storage-big { font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -.06em; }
.roomy-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.soft-stat { min-height: 128px; }
.stats-lower { align-items: start; }

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .65fr);
  gap: 18px;
  align-items: start;
}
.map-stage { padding: 20px; }
.map-toolbar { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 14px; }
.map-toolbar h2 { margin: 0; }
.map-canvas {
  position: relative;
  min-height: min(68vh, 720px);
  border-radius: 34px;
  overflow: hidden;
  border: 1px solid var(--white-line);
  background:
    radial-gradient(circle at 20% 25%, rgba(215,168,110,.24), transparent 26%),
    radial-gradient(circle at 78% 70%, rgba(146,114,255,.18), transparent 34%),
    linear-gradient(140deg, rgba(15,16,34,.96), rgba(10,12,24,.92));
  cursor: crosshair;
  box-shadow: inset 0 0 80px rgba(0,0,0,.28);
}
.map-canvas.dream-mode {
  filter: saturate(1.22) contrast(1.05);
}
.world-shapes {
  position: absolute;
  inset: 5% 4%;
  width: 92%;
  height: 90%;
  opacity: .34;
  filter: drop-shadow(0 20px 70px rgba(0,0,0,.5));
}
.world-shapes path {
  fill: rgba(255,249,240,.16);
  stroke: rgba(255,249,240,.18);
  stroke-width: 2;
}
.map-grid-glow {
  position: absolute;
  inset: 0;
  opacity: .18;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.trip-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.trip-lines line {
  stroke-width: .55;
  stroke-linecap: round;
  stroke-dasharray: 1.4 1.1;
  filter: drop-shadow(0 0 7px currentColor);
  opacity: .9;
}
.map-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
  padding: 0;
  border: 0;
  color: var(--paper);
  background: transparent;
  text-shadow: 0 2px 18px rgba(0,0,0,.8);
}
.map-pin span {
  width: 20px;
  height: 20px;
  border-radius: 999px 999px 999px 4px;
  transform: rotate(-45deg);
  background: var(--accent);
  border: 2px solid rgba(255,255,255,.8);
  box-shadow: 0 0 0 8px rgba(215,168,110,.16), 0 16px 40px rgba(0,0,0,.45);
}
.map-pin strong {
  max-width: 150px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(5,4,8,.55);
  border: 1px solid rgba(255,255,255,.16);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(12px);
}
.map-pin.status-done span { background: #91d190; }
.map-pin.status-booked span { background: #8bb8ff; }
.map-pin.status-planned span { background: #f0c36f; }
.map-pin:hover { z-index: 6; transform: translate(-50%, -100%) scale(1.04); }
.map-hint { margin: 12px 4px 0; }
.map-sidebar { display: grid; gap: 18px; }
.map-side-card, .trip-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(36,29,30,.06);
}
.map-side-card { cursor: pointer; }
.map-side-card:hover { transform: translateY(-1px); background: rgba(36,29,30,.09); }
.map-side-card strong, .trip-card strong { display: block; }
.map-side-card span, .trip-card span { display: block; color: var(--muted); font-size: .84rem; margin-top: 4px; }
.dark-panel .trip-card { border-color: var(--white-line); background: rgba(255,255,255,.07); }
.dark-panel .trip-card span { color: var(--paper-soft); }
.pin-image-strip {
  grid-column: 1 / -1;
  display: flex;
  gap: 7px;
  overflow: hidden;
  margin-bottom: 2px;
}
.pin-image-strip img {
  width: 64px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.18);
}
.pin-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--white-line);
  background: var(--white-soft);
  color: var(--paper);
  font-size: .84rem;
}
.trip-list { display: grid; gap: 10px; margin-top: 14px; }
.trip-card { grid-template-columns: 12px minmax(0, 1fr) auto; }
.trip-color { width: 12px; height: 100%; min-height: 46px; border-radius: 999px; }
.trip-card p { margin: 7px 0 0; color: var(--paper-soft); font-size: .85rem; }
.map-modal .modal-card { width: min(760px, calc(100vw - 32px)); max-height: min(720px, 88vh); }
.pin-existing-images { margin-top: 12px; }

.casino-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .52fr);
  gap: 18px;
  align-items: start;
}
.casino-table, .casino-create, .casino-rules { margin-bottom: 18px; }
.casino-balances {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.casino-balance-card {
  padding: 22px;
  border-radius: 26px;
  border: 1px solid var(--white-line);
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.14), transparent 38%),
    rgba(255,255,255,.07);
}
.casino-balance-card.me { outline: 2px solid var(--accent); outline-offset: -2px; }
.casino-balance-card span { display: block; color: var(--paper-soft); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; }
.casino-balance-card strong { display: block; margin-top: 10px; font-size: clamp(1.9rem, 4vw, 3.4rem); letter-spacing: -.08em; }
.casino-balance-card small { color: var(--paper-soft); }
.casino-bets-panel { margin-top: 18px; }
.casino-bets { display: grid; gap: 12px; }
.casino-bet-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .36fr);
  gap: 14px;
  align-items: start;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid var(--white-line);
  background: rgba(255,255,255,.07);
}
.casino-bet-card.status-settled { opacity: .82; }
.casino-bet-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.casino-bet-title strong { font-size: 1.15rem; }
.casino-bet-title span { color: var(--accent); font-weight: 900; }
.casino-bet-card p { margin: 8px 0; color: var(--paper-soft); }
.casino-bet-card small { color: var(--paper-soft); }
.casino-result {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 16px;
  background: rgba(255,255,255,.10);
  border: 1px solid var(--white-line);
}
.casino-result.pending { color: var(--paper-soft); }
.casino-resolve { display: grid; gap: 10px; }

@media (max-width: 980px) {
  .stats-top-grid, .map-layout, .casino-layout { grid-template-columns: 1fr; }
  .roomy-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-canvas { min-height: 520px; }
}
@media (max-width: 620px) {
  .roomy-stats, .casino-balances, .casino-bet-card { grid-template-columns: 1fr; }
  .map-toolbar { flex-direction: column; align-items: stretch; }
  .map-pin strong { display: none; }
  .map-canvas { min-height: 430px; }
}

/* v1.2.1: real map room + cleaner casino */
.map-real-room {
  width: min(100vw - 48px, 1560px);
  margin: 0 auto;
}
.map-real-room .intro { display: none; }
.map-shell {
  position: relative;
  min-height: calc(100vh - 144px);
  border-radius: 34px;
  overflow: hidden;
  border: 1px solid var(--white-line);
  box-shadow: var(--shadow);
  background: #081329;
}
.real-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  min-height: 640px;
  background: #091322;
}
.real-map .leaflet-container,
.leaflet-container {
  font-family: inherit;
}
.real-map .leaflet-tile-pane {
  filter: saturate(.82) brightness(.72) contrast(1.05) hue-rotate(178deg);
}
.real-map .leaflet-control-attribution {
  background: rgba(5, 7, 12, .48);
  color: rgba(255,249,240,.7);
  border-radius: 999px 0 0 0;
  backdrop-filter: blur(14px);
}
.real-map .leaflet-control-attribution a { color: rgba(255,249,240,.86); }
.real-map .leaflet-control-zoom {
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,.28);
}
.real-map .leaflet-control-zoom a {
  width: 42px;
  height: 42px;
  line-height: 40px;
  background: rgba(13, 18, 32, .78);
  color: var(--paper);
  border: 0;
  backdrop-filter: blur(16px);
}
.real-map .leaflet-control-zoom a:hover { background: var(--paper); color: var(--ink); }
.floating-map-control {
  position: absolute;
  z-index: 650;
  backdrop-filter: blur(20px);
}
.map-searchbar {
  top: 18px;
  left: 18px;
  right: 18px;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 26px;
  background: rgba(8, 11, 20, .62);
  box-shadow: 0 24px 90px rgba(0,0,0,.34);
}
.map-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.map-searchbar input {
  height: 44px;
  border-radius: 999px;
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.12);
  color: var(--paper);
}
.map-searchbar input::placeholder { color: rgba(255,249,240,.56); }
.map-searchbar button {
  min-height: 44px;
  box-shadow: none;
}
.map-square-button {
  width: 44px;
  padding: 0;
}
.map-search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 64px;
  width: min(720px, calc(100vw - 126px));
  max-height: 360px;
  overflow: auto;
  padding: 8px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.17);
  background: rgba(10, 12, 22, .92);
  box-shadow: 0 24px 90px rgba(0,0,0,.42);
}
.map-search-result {
  width: 100%;
  display: grid;
  gap: 2px;
  text-align: left;
  border-radius: 16px;
  background: transparent;
  color: var(--paper);
  box-shadow: none;
  padding: 10px 12px;
}
.map-search-result:hover { background: rgba(255,255,255,.10); }
.map-search-result span,
.map-search-empty {
  color: var(--paper-soft);
  font-size: .86rem;
  line-height: 1.35;
}
.map-search-empty { padding: 14px; }
.map-drawer {
  position: absolute;
  z-index: 620;
  left: 18px;
  top: 88px;
  bottom: 18px;
  width: min(360px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 30px;
  background: rgba(8, 9, 18, .72);
  color: var(--paper);
  backdrop-filter: blur(24px);
  box-shadow: 0 30px 110px rgba(0,0,0,.42);
  transition: transform .24s ease, opacity .24s ease;
}
.map-drawer.collapsed {
  transform: translateX(calc(-100% - 28px));
  opacity: 0;
  pointer-events: none;
}
.map-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.map-drawer-head h1 {
  font-size: 2rem;
  line-height: 1;
  margin: 0 0 3px;
}
.map-drawer-head span { color: var(--paper-soft); font-weight: 800; }
.map-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.map-tabs button {
  min-height: 36px;
  padding: 0 10px;
  box-shadow: none;
  background: transparent;
  color: var(--paper-soft);
}
.map-tabs button.active {
  background: var(--paper);
  color: var(--ink);
}
.map-tab-panel {
  min-height: 0;
  overflow: auto;
  padding-right: 3px;
}
.map-panel-actions { margin-bottom: 12px; }
.map-panel-actions button { width: 100%; }
.map-pin-list, .trip-list { display: grid; gap: 10px; }
.map-side-card.real-map-card,
.trip-card.real-trip-card {
  grid-template-columns: minmax(0, 1fr);
  padding: 12px;
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.08);
  color: var(--paper);
}
.map-side-card.real-map-card:hover,
.trip-card.real-trip-card:hover { background: rgba(255,255,255,.12); }
.map-side-card.real-map-card span,
.trip-card.real-trip-card span { color: var(--paper-soft); }
.map-card-actions,
.trip-card-actions,
.casino-resolve-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.trip-card.real-trip-card {
  grid-template-columns: 10px minmax(0, 1fr);
}
.trip-card.real-trip-card .trip-card-actions { grid-column: 1 / -1; }
.compact-trip-form {
  padding: 12px;
  border-radius: 22px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  margin-bottom: 12px;
}
.compact-trip-form textarea { min-height: 74px; }
.two-tight { grid-template-columns: minmax(0, 1fr) 68px; }
.map-zoom-hint {
  right: 20px;
  bottom: 20px;
  max-width: 320px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--paper-soft);
  background: rgba(8, 11, 20, .62);
  box-shadow: 0 18px 70px rgba(0,0,0,.28);
}
.leaf-pin-wrap { background: transparent; border: 0; }
.leaf-pin {
  width: 30px;
  height: 42px;
  position: relative;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.45));
}
.leaf-pin span {
  position: absolute;
  left: 4px;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 999px 999px 999px 5px;
  transform: rotate(-45deg);
  background: var(--accent);
  border: 3px solid rgba(255,249,240,.96);
  box-shadow: 0 0 0 8px rgba(215,168,110,.18);
}
.leaf-pin span::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 999px;
  background: rgba(0,0,0,.26);
}
.leaf-pin.status-planned span { background: #f0c36f; box-shadow: 0 0 0 8px rgba(240,195,111,.2); }
.leaf-pin.status-booked span { background: #79adff; box-shadow: 0 0 0 8px rgba(121,173,255,.2); }
.leaf-pin.status-done span { background: #8ad88d; box-shadow: 0 0 0 8px rgba(138,216,141,.2); }
.leaflet-tooltip {
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(8, 11, 20, .78);
  color: var(--paper);
  border-radius: 999px;
  box-shadow: 0 18px 60px rgba(0,0,0,.3);
  backdrop-filter: blur(12px);
  font-weight: 800;
}
.map-error-panel {
  position: absolute;
  inset: 20px;
  z-index: 2;
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 28px;
  background: rgba(0,0,0,.42);
}

.casino-clean-room {
  width: min(100%, 1120px);
  margin: 0 auto;
}
.casino-clean-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin: 48px 0 14px;
}
.casino-clean-hero h1 {
  font-size: clamp(2.8rem, 6vw, 5rem);
  margin-bottom: 8px;
}
.casino-clean-hero .subtitle { margin: 0; }
.casino-clean-balances {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.casino-mini-balance {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid var(--white-line);
  background: rgba(255,255,255,.08);
  color: var(--paper);
  box-shadow: 0 18px 70px rgba(0,0,0,.18);
}
.casino-mini-balance.me { outline: 2px solid var(--accent); outline-offset: -2px; }
.casino-mini-balance span { color: var(--paper-soft); font-weight: 900; }
.casino-mini-balance strong { font-size: 1.35rem; letter-spacing: -.04em; }
.casino-compose { margin: 0 0 14px; }
.casino-compose-form {
  display: grid;
  grid-template-columns: minmax(160px, .65fr) minmax(120px, .35fr) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}
.casino-compose-form textarea { min-height: 46px; }
.casino-compose-form .form-actions { grid-column: 1 / -1; }
.casino-board { padding: 18px; }
.casino-board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.casino-board-head h2 { font-size: 1.4rem; }
.casino-board-head span { color: var(--paper-soft); }
.casino-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.casino-filters button {
  min-height: 36px;
  padding: 0 12px;
  font-size: .86rem;
  background: rgba(255,255,255,.08);
  color: var(--paper-soft);
  box-shadow: none;
  border: 1px solid rgba(255,255,255,.12);
}
.casino-filters button.active {
  background: var(--paper);
  color: var(--ink);
}
.casino-clean-bets { display: grid; gap: 10px; }
.casino-clean-bet {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(255,255,255,.07);
}
.casino-clean-bet.status-settled { opacity: .78; }
.casino-clean-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.casino-clean-top strong { display: block; font-size: 1.08rem; }
.casino-clean-top span { display: block; color: var(--paper-soft); margin-top: 3px; font-size: .9rem; }
.casino-clean-amount {
  text-align: right;
  display: grid;
  gap: 3px;
  min-width: 128px;
}
.casino-clean-amount b { color: var(--accent); font-size: 1.05rem; }
.casino-clean-amount small { color: var(--paper-soft); }
.casino-clean-bet p {
  margin: 0;
  color: var(--paper-soft);
  line-height: 1.45;
}
.casino-bet-details {
  border-top: 1px solid rgba(255,255,255,.10);
  padding-top: 8px;
}
.casino-bet-details summary {
  cursor: pointer;
  color: var(--paper-soft);
  font-weight: 800;
}
.casino-resolve-buttons { margin: 10px 0 8px; }
.casino-resolve-buttons button { box-shadow: none; }

@media (max-width: 980px) {
  .map-real-room { width: min(100vw - 24px, 1560px); }
  .map-shell { min-height: calc(100vh - 130px); }
  .map-searchbar { grid-template-columns: auto minmax(0, 1fr); }
  .map-searchbar > #addMapPin,
  .map-searchbar > #fitPins { display: none; }
  .map-drawer { width: min(340px, calc(100vw - 28px)); left: 14px; top: 92px; bottom: 14px; }
  .casino-clean-hero,
  .casino-board-head { align-items: stretch; flex-direction: column; }
  .casino-compose-form { grid-template-columns: 1fr 1fr; }
  .casino-compose-form .wide { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .map-searchbar { left: 10px; right: 10px; top: 10px; border-radius: 22px; }
  .map-search-form { grid-template-columns: 1fr; }
  .map-searchbar input { height: 42px; }
  .map-search-results { left: 10px; width: calc(100vw - 44px); }
  .map-drawer { left: 10px; right: 10px; top: 128px; width: auto; }
  .map-zoom-hint { display: none; }
  .casino-clean-balances,
  .casino-compose-form { grid-template-columns: 1fr; }
  .casino-clean-top { flex-direction: column; }
  .casino-clean-amount { text-align: left; }
}


/* v1.2.2: full-map layout polish + uniform map styling */
body.route-map {
  overflow: hidden;
}
body.route-map .page {
  height: 100dvh;
  min-height: 720px;
  padding: 18px 20px 20px;
}
body.route-map .wrap {
  max-width: none;
  height: 100%;
  display: flex;
  flex-direction: column;
}
body.route-map .topbar {
  position: relative;
  top: auto;
  z-index: 760;
  width: min(1180px, 100%);
  margin: 0 auto 18px;
}
body.route-map .main {
  min-height: 0;
  flex: 1 1 auto;
}
body.route-map .background {
  background:
    radial-gradient(circle at 14% 22%, rgba(255, 194, 115, 0.18), transparent 30%),
    radial-gradient(circle at 86% 80%, rgba(126, 99, 255, 0.16), transparent 36%),
    linear-gradient(135deg, #17121c, #0c1019 46%, #211917);
}
body.route-map .background::after {
  opacity: .1;
}
.map-real-room {
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
}
.map-shell {
  height: 100%;
  min-height: 0;
  border-radius: 32px;
  background: #0d1620;
  border-color: rgba(255, 249, 240, .13);
  box-shadow: 0 32px 110px rgba(0,0,0,.48);
}
.real-map {
  height: 100%;
  min-height: 0;
  background: #0d1620;
}
.real-map .leaflet-container {
  width: 100%;
  height: 100%;
  background: #0d1620;
}
.real-map .leaflet-tile-pane {
  filter: none;
}
.real-map[data-map-style="night"] .leaflet-tile-pane {
  filter: saturate(.92) brightness(.95) contrast(1.04);
}
.real-map[data-map-style="atlas"] .leaflet-tile-pane {
  filter: saturate(.92) brightness(.86) contrast(1.02);
}
.real-map[data-map-style="clean"] .leaflet-tile-pane {
  filter: saturate(.78) brightness(.76) contrast(1.03);
}
.real-map[data-map-style="osm"] .leaflet-tile-pane {
  filter: saturate(.78) brightness(.78) contrast(1.02);
}
.map-searchbar {
  top: 20px;
  left: 22px;
  right: auto;
  width: min(1120px, calc(100% - 44px));
  grid-template-columns: 44px minmax(280px, 1fr) 116px auto auto;
  padding: 9px;
  border-radius: 24px;
  background: rgba(15, 16, 25, .78);
  border-color: rgba(255, 249, 240, .16);
  box-shadow: 0 22px 80px rgba(0,0,0,.36);
}
.map-searchbar input,
.map-style-select {
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 249, 240, .16);
  background: rgba(255,255,255,.10);
  color: var(--paper);
}
.map-style-select {
  padding: 0 12px;
  outline: none;
  font-weight: 800;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255,249,240,.78) 50%), linear-gradient(135deg, rgba(255,249,240,.78) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.map-style-select option {
  color: #16131a;
  background: #fff9f0;
}
.map-searchbar button {
  min-height: 44px;
  white-space: nowrap;
}
.map-square-button {
  min-width: 44px;
  width: 44px;
  padding: 0;
}
.map-search-results {
  top: calc(100% + 10px);
  left: 62px;
  width: min(760px, calc(100vw - 160px));
  background: rgba(14, 15, 24, .94);
  border-color: rgba(255, 249, 240, .16);
}
.map-drawer {
  left: 22px;
  top: 96px;
  bottom: 22px;
  width: min(380px, calc(100vw - 44px));
  padding: 17px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(30, 31, 43, .88), rgba(10, 12, 22, .88));
  border-color: rgba(255, 249, 240, .15);
  box-shadow: 0 30px 100px rgba(0,0,0,.44);
}
.map-drawer-head h1 {
  font-size: 2.05rem;
  letter-spacing: -.055em;
}
.map-drawer .eyebrow {
  margin-bottom: 8px;
}
.map-drawer.collapsed {
  transform: translateX(calc(-100% - 34px));
}
.map-tabs {
  background: rgba(255,255,255,.07);
  border-color: rgba(255, 249, 240, .13);
}
.map-tab-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,249,240,.32) transparent;
}
.map-side-card.real-map-card,
.trip-card.real-trip-card,
.compact-trip-form {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,249,240,.12);
}
.map-side-card.real-map-card:hover,
.trip-card.real-trip-card:hover {
  background: rgba(255,255,255,.11);
}
.map-zoom-hint {
  display: none;
}
.real-map .leaflet-control-zoom {
  margin-right: 22px;
  margin-bottom: 22px;
  border-color: rgba(255,249,240,.16);
}
.real-map .leaflet-control-zoom a {
  background: rgba(15, 16, 25, .80);
}
.real-map .leaflet-control-attribution {
  font-size: .68rem;
  background: rgba(10, 12, 18, .58);
}
.leaf-pin {
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.5));
}
.leaf-pin span {
  border-color: rgba(255,249,240,.96);
}

@media (max-width: 1120px) {
  body.route-map .page { padding: 14px; }
  body.route-map .topbar { margin-bottom: 14px; }
  .map-shell { border-radius: 26px; }
  .map-searchbar {
    left: 14px;
    width: calc(100% - 28px);
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }
  .map-style-select,
  .map-searchbar > #fitPins {
    display: none;
  }
  .map-drawer {
    left: 14px;
    top: 94px;
    bottom: 14px;
    width: min(360px, calc(100vw - 28px));
  }
  .map-search-results {
    left: 58px;
    width: calc(100vw - 100px);
  }
}
@media (max-width: 720px) {
  body.route-map {
    overflow: auto;
  }
  body.route-map .page {
    min-height: 100dvh;
    height: auto;
  }
  body.route-map .wrap {
    height: auto;
  }
  .map-shell {
    min-height: 760px;
  }
  .map-searchbar {
    top: 10px;
    left: 10px;
    width: calc(100% - 20px);
    grid-template-columns: 44px 1fr;
    gap: 8px;
  }
  .map-search-form {
    grid-template-columns: minmax(0, 1fr);
  }
  .map-search-form button,
  .map-searchbar > #addMapPin {
    display: none;
  }
  .map-drawer {
    top: 74px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
  }
  .map-search-results {
    left: 10px;
    width: calc(100vw - 42px);
  }
}


/* v1.2.3: true fullscreen map with nav hovering over it */
body.route-map {
  overflow: hidden;
  background: #070b12;
}
body.route-map .background {
  display: none;
}
body.route-map .page {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  z-index: 1;
}
body.route-map .wrap {
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  display: block;
}
body.route-map .topbar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  width: min(1160px, calc(100vw - 32px));
  margin: 0;
  pointer-events: auto;
}
body.route-map .topbar-inner {
  background: rgba(13, 11, 18, .74);
  border-color: rgba(255, 249, 240, .18);
  box-shadow: 0 18px 70px rgba(0,0,0,.42);
  backdrop-filter: blur(22px) saturate(1.25);
}
body.route-map .main {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100vw;
  height: 100dvh;
  min-height: 0;
}
body.route-map .room-view {
  animation: none;
}
body.route-map .map-real-room {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  margin: 0;
}
body.route-map .map-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #09111b;
}
body.route-map .real-map {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
}
body.route-map .real-map .leaflet-container {
  width: 100%;
  height: 100%;
}
body.route-map .map-searchbar {
  top: 94px;
  left: 20px;
  right: auto;
  width: min(980px, calc(100vw - 40px));
  grid-template-columns: 44px minmax(320px, 1fr) 112px 112px 66px;
  padding: 8px;
  border-radius: 24px;
  background: rgba(15, 16, 25, .82);
  border: 1px solid rgba(255, 249, 240, .18);
  box-shadow: 0 20px 80px rgba(0,0,0,.38);
  backdrop-filter: blur(24px) saturate(1.25);
}
body.route-map .map-search-results {
  top: calc(100% + 10px);
  left: 60px;
  width: min(720px, calc(100vw - 100px));
}
body.route-map .map-drawer {
  top: 166px;
  left: 20px;
  bottom: 22px;
  width: min(370px, calc(100vw - 40px));
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(27, 29, 40, .86), rgba(8, 10, 18, .88));
  box-shadow: 0 26px 90px rgba(0,0,0,.44);
  backdrop-filter: blur(24px) saturate(1.18);
}
body.route-map .map-drawer.collapsed {
  transform: translateX(calc(-100% - 32px));
}
body.route-map .real-map .leaflet-control-zoom {
  margin-right: 22px;
  margin-bottom: 22px;
}
body.route-map .real-map .leaflet-control-attribution {
  margin-right: 8px;
  margin-bottom: 0;
}
body.route-map .real-map[data-map-style="clean"] .leaflet-tile-pane,
body.route-map .real-map[data-map-style="osm"] .leaflet-tile-pane {
  filter: none;
}
body.route-map .real-map[data-map-style="atlas"] .leaflet-tile-pane {
  filter: saturate(.96) brightness(.98) contrast(1.02);
}
body.route-map .real-map[data-map-style="night"] .leaflet-tile-pane {
  filter: saturate(.95) brightness(.96) contrast(1.04);
}

@media (max-width: 1120px) {
  body.route-map .topbar {
    top: 10px;
    width: calc(100vw - 20px);
  }
  body.route-map .map-searchbar {
    top: 86px;
    left: 12px;
    width: calc(100vw - 24px);
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }
  body.route-map .map-style-select,
  body.route-map .map-searchbar > #fitPins {
    display: none;
  }
  body.route-map .map-drawer {
    top: 154px;
    left: 12px;
    bottom: 12px;
    width: min(360px, calc(100vw - 24px));
  }
  body.route-map .map-search-results {
    left: 56px;
    width: calc(100vw - 90px);
  }
}
@media (max-width: 720px) {
  body.route-map .page,
  body.route-map .main,
  body.route-map .map-real-room,
  body.route-map .map-shell {
    height: 100dvh;
  }
  body.route-map .topbar {
    top: 8px;
  }
  body.route-map .topbar-inner {
    overflow-x: auto;
    justify-content: flex-start;
  }
  body.route-map .map-searchbar {
    top: 78px;
    left: 8px;
    width: calc(100vw - 16px);
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 8px;
  }
  body.route-map .map-search-form {
    grid-template-columns: minmax(0, 1fr);
  }
  body.route-map .map-search-form button,
  body.route-map .map-searchbar > #addMapPin {
    display: none;
  }
  body.route-map .map-drawer {
    top: 140px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
  }
  body.route-map .map-search-results {
    left: 8px;
    width: calc(100vw - 16px);
  }
}


/* v1.2.4: map page only — nav and map controls share one desktop row */
@media (min-width: 1761px) {
  body.route-map .topbar {
    top: 16px;
    left: 18px;
    right: auto;
    transform: none;
    width: 920px;
    max-width: calc(100vw - 36px);
  }
  body.route-map .topbar-inner {
    gap: 10px;
    padding: 8px;
    min-height: 64px;
    overflow: hidden;
  }
  body.route-map .brand {
    flex: 0 0 auto;
    padding: 0 10px 0 8px;
  }
  body.route-map .room-nav {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 2px;
    justify-content: center;
  }
  body.route-map .room-nav a {
    min-height: 40px;
    padding: 0 11px;
    white-space: nowrap;
  }
  body.route-map .top-actions {
    flex: 0 0 auto;
    gap: 6px;
  }
  body.route-map .profile-chip {
    min-height: 40px;
    gap: 7px;
    padding: 5px 10px 5px 6px;
    white-space: nowrap;
  }
  body.route-map .top-actions button {
    min-height: 40px;
    padding: 0 12px;
    white-space: nowrap;
  }
  body.route-map .map-searchbar {
    top: 16px;
    left: 956px;
    right: 18px;
    width: auto;
    max-width: none;
    grid-template-columns: 44px minmax(280px, 1fr) 112px 108px 64px;
  }
  body.route-map .map-drawer {
    top: 96px;
  }
}

/* v1.2.5: map top row fit, dark pin modal, safer upload controls */
@media (min-width: 900px) {
  body.route-map {
    --map-edge: 14px;
    --map-topbar-w: clamp(500px, 53vw, 900px);
  }
  body.route-map .topbar {
    top: var(--map-edge);
    left: var(--map-edge);
    right: auto;
    transform: none;
    width: var(--map-topbar-w);
    max-width: none;
  }
  body.route-map .topbar-inner {
    min-height: 58px;
    padding: 7px;
    gap: 6px;
    overflow: hidden;
  }
  body.route-map .brand {
    flex: 0 0 auto;
    padding: 0 8px;
  }
  body.route-map .room-nav {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 1px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  body.route-map .room-nav::-webkit-scrollbar { display: none; }
  body.route-map .room-nav a {
    min-height: 38px;
    padding: 0 9px;
    white-space: nowrap;
  }
  body.route-map .top-actions {
    flex: 0 0 auto;
    gap: 5px;
  }
  body.route-map .profile-chip {
    min-height: 38px;
    max-width: 148px;
    padding: 4px 9px 4px 5px;
    gap: 6px;
    overflow: hidden;
  }
  body.route-map .profile-chip strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.route-map .top-actions button {
    min-height: 38px;
    padding: 0 10px;
    white-space: nowrap;
  }
  body.route-map .map-searchbar {
    top: var(--map-edge);
    left: calc(var(--map-edge) + var(--map-topbar-w) + 10px);
    right: var(--map-edge);
    width: auto;
    max-width: none;
    min-width: 0;
    grid-template-columns: 42px minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 7px;
    border-radius: 24px;
  }
  body.route-map .map-search-form {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  body.route-map .map-search-form input { min-width: 0; }
  body.route-map .map-search-results {
    left: 58px;
    width: min(620px, calc(100vw - var(--map-edge) - var(--map-edge) - var(--map-topbar-w) - 86px));
  }
  body.route-map .map-drawer {
    top: 88px;
  }
}

@media (min-width: 900px) and (max-width: 1500px) {
  body.route-map .map-style-select,
  body.route-map .map-searchbar > #fitPins {
    display: none;
  }
  body.route-map .map-searchbar {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }
  body.route-map .map-searchbar > #addMapPin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 15px;
  }
}

@media (min-width: 900px) and (max-width: 1250px) {
  body.route-map { --map-topbar-w: clamp(470px, 52vw, 650px); }
  body.route-map .brand strong,
  body.route-map .profile-chip strong {
    display: none;
  }
  body.route-map .brand { padding: 0 6px; }
  body.route-map .room-nav {
    justify-content: flex-start;
  }
  body.route-map .room-nav a {
    min-height: 36px;
    padding: 0 7px;
    font-size: .9rem;
  }
  body.route-map .top-actions button {
    padding: 0 9px;
  }
  body.route-map .map-search-form {
    grid-template-columns: minmax(0, 1fr);
  }
  body.route-map .map-search-form button {
    display: none;
  }
  body.route-map .map-searchbar {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }
}

@media (max-width: 899px) {
  body.route-map .map-searchbar {
    top: 86px;
  }
  body.route-map .map-drawer {
    top: 148px;
  }
}

body.route-map .map-modal,
.map-modal {
  z-index: 2600;
  align-content: center;
  place-items: center;
  padding: 18px;
  background: rgba(3, 5, 10, .72);
  backdrop-filter: blur(22px) saturate(1.08);
}
body.route-map .map-modal .map-modal-card,
.map-modal .map-modal-card {
  width: min(860px, calc(100vw - 30px));
  max-height: calc(100dvh - 36px);
  overflow: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(25, 27, 38, .96), rgba(8, 10, 18, .97));
  color: var(--paper);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 34px 120px rgba(0,0,0,.62);
  backdrop-filter: blur(26px) saturate(1.18);
}
.map-modal .modal-topline {
  position: sticky;
  top: -1px;
  z-index: 2;
  margin: -24px -24px 18px;
  padding: 24px 24px 14px;
  background: linear-gradient(180deg, rgba(19, 20, 30, .98), rgba(19, 20, 30, .86));
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.map-modal .map-modal-card input,
.map-modal .map-modal-card select,
.map-modal .map-modal-card textarea {
  color: var(--paper);
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.15);
}
.map-modal .map-modal-card input::placeholder,
.map-modal .map-modal-card textarea::placeholder {
  color: rgba(255,249,240,.46);
}
.map-modal .map-modal-card select option {
  color: #201b1e;
  background: #fff9f0;
}

.map-coordinate-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.map-coordinate-fields input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.map-click-hint {
  grid-column: 1 / -1;
  margin: -2px 0 2px;
  color: rgba(255,249,240,.62);
  font-size: .88rem;
  font-weight: 700;
}
@media (max-width: 720px) {
  .map-coordinate-fields { grid-template-columns: 1fr; }
}

.map-modal .map-modal-card .form-actions {
  position: sticky;
  bottom: -1px;
  z-index: 2;
  margin: 18px -24px -24px;
  padding: 14px 24px 22px;
  background: linear-gradient(0deg, rgba(8,10,18,.98), rgba(8,10,18,.82));
  border-top: 1px solid rgba(255,255,255,.1);
}

.file-picker-field {
  cursor: pointer;
}
.visually-hidden-file {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.file-picker-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
}
.file-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.file-picker-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--paper-soft);
  font-weight: 800;
}
.file-picker-field:focus-within .file-picker-row,
.file-picker-field:hover .file-picker-row {
  border-color: rgba(255,249,240,.34);
  background: rgba(255,255,255,.11);
}
.library-modal-card .file-picker-row,
.map-modal-card .file-picker-row {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.15);
}

@media (max-width: 720px) {
  .map-modal .modal-topline,
  .map-modal .map-modal-card .form-actions {
    margin-left: -18px;
    margin-right: -18px;
  }
  .file-picker-row {
    grid-template-columns: 1fr;
  }
}

/* v1.2.6: map controls, upload controls, request-flow casino cleanup */
body.route-map .map-searchbar > #fitPins {
  display: none !important;
}
body.route-map .map-searchbar {
  align-items: center;
}
body.route-map .map-search-form {
  min-width: 0;
}
body.route-map .map-search-form input {
  min-width: 0;
}
body.route-map .map-style-select {
  min-width: 88px;
}

@media (min-width: 760px) {
  body.route-map {
    --map-edge: 10px;
    --map-topbar-w: clamp(430px, 46vw, 760px);
  }
  body.route-map .topbar {
    top: var(--map-edge);
    left: var(--map-edge);
    right: auto;
    transform: none;
    width: var(--map-topbar-w);
    max-width: none;
  }
  body.route-map .topbar-inner {
    min-height: 54px;
    padding: 6px;
    gap: 5px;
    overflow: hidden;
  }
  body.route-map .brand {
    flex: 0 0 auto;
    padding: 0 7px;
  }
  body.route-map .room-nav {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 1px;
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: flex-start;
  }
  body.route-map .room-nav::-webkit-scrollbar { display: none; }
  body.route-map .room-nav a {
    min-height: 36px;
    padding: 0 8px;
    white-space: nowrap;
    font-size: .9rem;
  }
  body.route-map .top-actions {
    flex: 0 0 auto;
    gap: 5px;
  }
  body.route-map .profile-chip {
    min-height: 36px;
    max-width: 132px;
    padding: 4px 8px 4px 5px;
    overflow: hidden;
  }
  body.route-map .profile-chip strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.route-map .top-actions button {
    min-height: 36px;
    padding: 0 9px;
  }
  body.route-map .map-searchbar {
    top: var(--map-edge);
    left: calc(var(--map-edge) + var(--map-topbar-w) + 8px);
    right: var(--map-edge);
    width: auto;
    max-width: none;
    grid-template-columns: 40px minmax(0, 1fr) auto auto;
    gap: 7px;
    padding: 6px;
    border-radius: 22px;
  }
  body.route-map .map-search-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
  }
  body.route-map .map-searchbar button,
  body.route-map .map-style-select {
    min-height: 40px;
  }
  body.route-map .map-drawer {
    top: 78px;
  }
}

@media (min-width: 760px) and (max-width: 1380px) {
  body.route-map { --map-topbar-w: clamp(430px, 49vw, 640px); }
  body.route-map .brand strong,
  body.route-map .profile-chip strong {
    display: none;
  }
  body.route-map .map-style-select {
    display: none;
  }
  body.route-map .map-searchbar {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }
}

@media (min-width: 760px) and (max-width: 1120px) {
  body.route-map .map-search-form button {
    display: none;
  }
  body.route-map .map-searchbar {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }
  body.route-map .room-nav a {
    padding: 0 6px;
    font-size: .84rem;
  }
  body.route-map .top-actions button {
    padding: 0 8px;
  }
}

@media (max-width: 759px) {
  body.route-map .map-searchbar {
    top: 78px;
    left: 8px;
    right: 8px;
    width: auto;
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }
  body.route-map .map-style-select,
  body.route-map .map-search-form button {
    display: none;
  }
  body.route-map .map-drawer {
    top: 138px;
  }
}

.file-picker-field {
  position: relative;
}
.file-picker-row {
  cursor: pointer;
  user-select: none;
}
.file-picker-button {
  pointer-events: none;
}
.file-picker-name {
  pointer-events: none;
}

.casino-clean-bet.status-requested {
  border-color: rgba(215, 168, 110, .36);
  background: linear-gradient(135deg, rgba(215,168,110,.14), rgba(255,255,255,.06));
}
.casino-clean-bet.status-declined {
  opacity: .62;
}
.casino-request-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* v1.2.7: reliable native upload controls and clearer map forms */
.native-upload-field {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 0;
}
.native-upload-field .native-file-input {
  width: 100%;
  min-height: 52px;
  padding: 9px 12px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: var(--paper);
  cursor: pointer;
  outline: none;
}
.panel .native-upload-field .native-file-input {
  background: rgba(36,29,30,.06);
  border-color: rgba(36,29,30,.14);
  color: var(--ink);
}
.native-upload-field .native-file-input::file-selector-button {
  margin-right: 12px;
  border: 0;
  border-radius: 999px;
  min-height: 34px;
  padding: 0 14px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}
.panel .native-upload-field .native-file-input::file-selector-button {
  background: var(--ink);
  color: var(--paper);
}
.native-upload-field .upload-help {
  display: block;
  color: var(--paper-soft);
  font-size: .86rem;
  font-weight: 700;
}
.panel .native-upload-field .upload-help {
  color: var(--muted);
}
.native-upload-field.is-dragging .native-file-input,
.native-upload-field:focus-within .native-file-input {
  border-color: rgba(255,249,240,.42);
  box-shadow: 0 0 0 4px rgba(215,168,110,.14);
}
body.route-map .map-modal .native-upload-field .native-file-input {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.18);
  color: var(--paper);
}
body.route-map .map-modal .native-upload-field .upload-help {
  color: rgba(255,249,240,.62);
}

/* Hide old fit button in case an older browser cached part of the page. */
#fitPins { display: none !important; }

/* v1.2.9: make validation visible instead of looking like dead buttons */
.field-needs-attention,
input.field-needs-attention,
select.field-needs-attention,
textarea.field-needs-attention {
  border-color: rgba(220, 60, 60, .9) !important;
  box-shadow: 0 0 0 4px rgba(220, 60, 60, .18) !important;
}
button:active, .btn:active { transform: translateY(1px); }
.auth-screen.hidden,
.modal-backdrop.hidden {
  display: none !important;
  pointer-events: none !important;
}

/* v1.2.11: hard fix clickable file pickers, casino details, and top-anchored modals */
.casino-bet-details summary {
  display: block;
  min-height: 42px;
  padding: 10px 0;
  user-select: none;
  -webkit-user-select: none;
}
.casino-bet-details summary:hover {
  color: var(--paper);
}

.clickable-upload-field {
  cursor: pointer;
}
.clickable-upload-field .visually-hidden-file {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}
.clickable-upload-field .file-picker-row {
  width: 100%;
  min-height: 56px;
  cursor: pointer;
}
.clickable-upload-field .file-picker-button,
.clickable-upload-field .file-picker-name {
  pointer-events: none;
}
.native-upload-field.is-dragging .file-picker-row,
.clickable-upload-field:hover .file-picker-row,
.clickable-upload-field:focus-within .file-picker-row {
  border-color: rgba(255,249,240,.42);
  box-shadow: 0 0 0 4px rgba(215,168,110,.14);
}
.panel .clickable-upload-field .file-picker-row {
  background: rgba(36,29,30,.06);
  border-color: rgba(36,29,30,.14);
}
.panel .clickable-upload-field:hover .file-picker-row,
.panel .clickable-upload-field:focus-within .file-picker-row {
  border-color: rgba(36,29,30,.28);
}

.library-modal {
  z-index: 3200 !important;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  place-items: initial;
  align-content: initial;
  overflow-y: auto;
  padding: 20px;
  overscroll-behavior: contain;
}
.library-modal:not(.hidden) {
  display: flex !important;
}
.library-modal-card.modal-card {
  margin: 0 auto;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.library-modal-card .modal-topline {
  position: sticky;
  top: -1px;
  z-index: 5;
  margin: -24px -24px 16px;
  padding: 24px 24px 14px;
  background: linear-gradient(180deg, rgba(15,12,19,.98), rgba(15,12,19,.88));
  backdrop-filter: blur(20px);
}
@media (max-height: 760px) {
  .library-modal { padding-top: 12px; padding-bottom: 12px; }
  .library-modal-card.modal-card { max-height: calc(100dvh - 24px); }
}

/* v1.2.12 local cinema sync */
.cinema-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  align-items: start;
}
.cinema-side-stack {
  display: grid;
  gap: 16px;
}
.video-shell {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: rgba(0, 0, 0, .28);
}
.video-shell video {
  display: block;
  width: 100%;
  min-height: 320px;
  background: #050407;
  border-radius: inherit;
}
.play-gate {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px;
  background: rgba(8, 7, 12, .82);
  color: var(--paper);
  font-weight: 800;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .24);
  backdrop-filter: blur(14px);
}
.play-gate[hidden] { display: none !important; }
.cinema-ready-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.ready-summary,
.ready-card {
  border: 1px solid var(--white-line);
  border-radius: 18px;
  padding: 10px 12px;
  background: rgba(255,255,255,.06);
  display: grid;
  gap: 3px;
}
.ready-summary {
  grid-column: 1 / -1;
}
.ready-summary span,
.ready-card span {
  color: var(--muted);
  font-size: .92rem;
}
.ready-card.is-ready {
  border-color: rgba(215, 168, 110, .55);
  background: rgba(215, 168, 110, .12);
}
.ready-card.is-waiting {
  opacity: .82;
}
@media (max-width: 980px) {
  .cinema-grid { grid-template-columns: 1fr; }
  .video-shell video { min-height: 220px; }
}

/* v1.2.13 cinema progress + cleaner tabbed layout */
.cinema-clean-room {
  width: min(100vw - 48px, 1560px);
}
.cinema-clean-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
}
.cinema-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  gap: 18px;
  align-items: start;
}
.cinema-player.dark-panel {
  padding: 18px;
  overflow: hidden;
}
.cinema-drawer {
  position: sticky;
  top: 88px;
  max-height: calc(100dvh - 116px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 16px;
}
.cinema-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.cinema-drawer-head h2 {
  margin: 2px 0 0;
  font-size: clamp(1.4rem, 2.4vw, 2.1rem);
}
.cinema-drawer-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 750;
}
.cinema-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  margin-bottom: 14px;
  border: 1px solid var(--white-line);
  border-radius: 999px;
  background: rgba(255,255,255,.05);
}
.cinema-tabs button {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}
.cinema-tabs button.active {
  color: var(--ink);
  background: var(--paper);
}
.cinema-tab-panel {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.cinema-tab-panel.hidden { display: none !important; }
.cinema-panel-form {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--white-line);
  border-radius: 24px;
  padding: 14px;
}
.cinema-panel-form .panel-head,
.cinema-tab-panel > .panel-head {
  margin-bottom: 12px;
}
.cinema-panel-form h3,
.cinema-tab-panel h3 {
  margin: 0;
  font-size: 1.02rem;
}
.cinema-panel-form .panel-head span,
.cinema-tab-panel > .panel-head span {
  display: block;
  color: var(--muted);
  font-size: .88rem;
  margin-top: 3px;
}
.cinema-movie-list {
  display: grid;
  gap: 10px;
}
.cinema-file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.cinema-stored-actions {
  justify-content: end;
  flex-wrap: wrap;
}
.storage-status {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--white-line);
  border-radius: 18px;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  font-weight: 800;
}
.video-shell {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: rgba(0, 0, 0, .28);
}
.video-shell video {
  display: block;
  width: 100%;
  min-height: clamp(300px, 48vw, 640px);
  max-height: calc(100dvh - 350px);
  background: #050407;
  border-radius: inherit;
}
.play-gate {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px;
  background: rgba(8, 7, 12, .82);
  color: var(--paper);
  font-weight: 800;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .24);
  backdrop-filter: blur(14px);
}
.play-gate[hidden] { display: none !important; }
.cinema-load-box {
  margin-top: 14px;
  border: 1px solid var(--white-line);
  border-radius: 22px;
  padding: 12px;
  background: rgba(255,255,255,.055);
}
.cinema-load-head,
.ready-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.cinema-load-head strong {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
  overflow-wrap: anywhere;
}
#loadPercent {
  color: var(--gold);
  font-weight: 950;
  font-size: 1.12rem;
}
.cinema-progress-bar {
  height: 9px;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.10);
  margin-top: 9px;
}
.cinema-progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(215,168,110,.72), rgba(255,249,240,.92));
  transition: width .18s ease;
}
.cinema-load-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 750;
}
.cinema-load-meta span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.cinema-sync-row {
  margin-top: 12px;
  flex-wrap: wrap;
}
.cinema-ready-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.ready-summary,
.ready-card {
  border: 1px solid var(--white-line);
  border-radius: 18px;
  padding: 10px 12px;
  background: rgba(255,255,255,.06);
  display: grid;
  gap: 5px;
}
.ready-summary { grid-column: 1 / -1; }
.ready-summary span,
.ready-card span,
.ready-card small,
.ready-card em {
  color: var(--muted);
  font-size: .86rem;
}
.ready-card em {
  font-style: normal;
  overflow-wrap: anywhere;
}
.ready-card small {
  font-weight: 750;
}
.ready-card.is-ready {
  border-color: rgba(215, 168, 110, .55);
  background: rgba(215, 168, 110, .12);
}
.ready-card.is-waiting { opacity: .92; }
@media (max-width: 1180px) {
  .cinema-layout { grid-template-columns: 1fr; }
  .cinema-drawer {
    position: static;
    max-height: none;
  }
  .cinema-tab-panel { max-height: none; overflow-y: visible; }
  .video-shell video { max-height: none; min-height: 240px; }
}
@media (max-width: 680px) {
  .cinema-clean-room { width: min(100vw - 24px, 1560px); }
  .cinema-player.dark-panel,
  .cinema-drawer { padding: 12px; }
  .cinema-file-item { grid-template-columns: 1fr; }
  .cinema-stored-actions { justify-content: stretch; }
  .cinema-stored-actions button { flex: 1 1 120px; }
  .cinema-load-meta { flex-direction: column; gap: 4px; }
}

/* v1.2.14: cinema as full viewport player with slide-in side panels */
body.route-cinema {
  overflow: hidden;
}
body.route-cinema .page {
  min-height: 100dvh;
  padding: 14px;
}
body.route-cinema .wrap,
body.route-cinema .main,
body.route-cinema .room-view,
body.route-cinema .cinema-stage-room,
body.route-cinema .cinema-overlay-layout {
  width: 100%;
  height: 100%;
  min-height: calc(100dvh - 28px);
}
body.route-cinema .wrap {
  max-width: none;
}
body.route-cinema .topbar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1120px, calc(100vw - 28px));
  z-index: 820;
  margin: 0;
}
body.route-cinema .main {
  padding: 0;
  margin: 0;
}
body.route-cinema .background {
  filter: saturate(1.04) brightness(.86);
}
body.route-cinema .background::after {
  background: radial-gradient(circle at 30% 20%, rgba(215,168,110,.22), transparent 34%), linear-gradient(90deg, rgba(8,6,11,.78), rgba(8,6,11,.52));
}
body.route-cinema .cinema-clean-hero {
  display: none !important;
}
body.route-cinema .cinema-stage-room {
  position: relative;
  overflow: hidden;
  border-radius: 34px;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 28px 90px rgba(0,0,0,.42);
  background: rgba(7,6,10,.74);
}
body.route-cinema .cinema-overlay-layout {
  position: relative;
  display: block;
  gap: 0;
}
body.route-cinema .cinema-player.dark-panel {
  position: absolute;
  inset: 0;
  padding: 0;
  border-radius: inherit;
  overflow: hidden;
  border: 0;
  background: rgba(0,0,0,.42);
}
body.route-cinema .cinema-video-viewport,
body.route-cinema .cinema-player .video-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: inherit;
  background: #050407;
}
body.route-cinema .cinema-player .video-shell video {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  object-fit: contain;
  border-radius: inherit;
  background: #050407;
}
body.route-cinema .cinema-now-strip {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 5;
  max-width: min(760px, calc(100vw - 180px));
  padding: 11px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(8,7,12,.68);
  color: rgba(255,249,240,.86);
  font-weight: 850;
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
  overflow-wrap: anywhere;
}
body.route-cinema .play-gate {
  left: 50%;
  right: auto;
  bottom: 82px;
  transform: translateX(-50%);
  width: min(620px, calc(100vw - 52px));
  text-align: center;
  z-index: 9;
}
body.route-cinema .cinema-panel-toggle {
  position: absolute;
  top: 50%;
  z-index: 730;
  transform: translateY(-50%);
  min-width: 0;
  padding: 13px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  color: var(--paper);
  background: rgba(13,10,18,.74);
  box-shadow: 0 18px 56px rgba(0,0,0,.34);
  backdrop-filter: blur(18px);
}
body.route-cinema .cinema-panel-toggle:hover,
body.route-cinema .cinema-panel-toggle.active {
  background: var(--paper);
  color: var(--ink);
}
body.route-cinema .cinema-panel-toggle-left { left: 16px; }
body.route-cinema .cinema-panel-toggle-right { right: 16px; }
body.route-cinema .cinema-slide-panel {
  position: absolute;
  top: 88px;
  bottom: 18px;
  z-index: 740;
  width: min(430px, calc(100vw - 58px));
  padding: 16px;
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(14,11,18,.84);
  box-shadow: 0 24px 90px rgba(0,0,0,.46);
  backdrop-filter: blur(24px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  transition: transform .28s ease, opacity .22s ease;
  opacity: .98;
}
body.route-cinema .cinema-setup-panel {
  right: 18px;
  grid-template-rows: auto auto minmax(0, 1fr);
  transform: translateX(calc(100% + 34px));
}
body.route-cinema .cinema-controls-panel {
  left: 18px;
  transform: translateX(calc(-100% - 34px));
}
body.route-cinema .cinema-slide-panel.open {
  transform: translateX(0);
}
body.route-cinema .cinema-panel-backdrop {
  position: absolute;
  inset: 0;
  z-index: 700;
  background: rgba(0,0,0,.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
body.route-cinema .cinema-any-panel-open .cinema-panel-backdrop {
  opacity: 1;
  pointer-events: auto;
}
body.route-cinema .cinema-slide-head {
  margin-bottom: 0;
  align-items: flex-start;
}
body.route-cinema .cinema-close-panel {
  flex: 0 0 auto;
  font-size: 1.35rem;
  line-height: 1;
}
body.route-cinema .cinema-tabs {
  margin-bottom: 0;
}
body.route-cinema .cinema-tab-panel,
body.route-cinema .cinema-controls-panel > .cinema-ready-grid,
body.route-cinema .cinema-setup-panel > .cinema-tab-panel {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}
body.route-cinema .cinema-controls-panel .cinema-load-box {
  margin-top: 0;
}
body.route-cinema .cinema-controls-panel .cinema-sync-row {
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
body.route-cinema .cinema-controls-panel .ready-item {
  width: 100%;
  justify-content: flex-start;
}
body.route-cinema .cinema-ready-grid {
  margin-top: 0;
  grid-template-columns: 1fr;
  align-content: start;
  overflow-y: auto;
}
body.route-cinema .cinema-movie-list {
  padding-bottom: 8px;
}
body.route-cinema .cinema-file-item {
  grid-template-columns: 1fr;
  align-items: stretch;
}
body.route-cinema .cinema-stored-actions {
  justify-content: stretch;
}
body.route-cinema .cinema-stored-actions button {
  flex: 1 1 118px;
}
body.route-cinema .cinema-panel-form {
  max-width: none;
}
@media (max-width: 820px) {
  body.route-cinema .page { padding: 10px; }
  body.route-cinema .topbar {
    top: 10px;
    width: calc(100vw - 20px);
  }
  body.route-cinema .cinema-stage-room {
    border-radius: 26px;
  }
  body.route-cinema .cinema-slide-panel {
    top: 86px;
    bottom: 10px;
    width: calc(100vw - 28px);
  }
  body.route-cinema .cinema-controls-panel { left: 14px; }
  body.route-cinema .cinema-setup-panel { right: 14px; }
  body.route-cinema .cinema-panel-toggle {
    top: auto;
    bottom: 18px;
    transform: none;
    z-index: 760;
  }
  body.route-cinema .cinema-panel-toggle-left { left: 18px; }
  body.route-cinema .cinema-panel-toggle-right { right: 18px; }
  body.route-cinema .cinema-now-strip {
    left: 14px;
    right: 14px;
    bottom: 72px;
    max-width: none;
  }
  body.route-cinema .play-gate {
    bottom: 126px;
  }
}
@media (max-width: 560px) {
  body.route-cinema .topbar {
    position: fixed;
  }
  body.route-cinema .cinema-slide-panel {
    padding: 12px;
    border-radius: 22px;
  }
  body.route-cinema .cinema-panel-toggle span {
    font-size: .9rem;
  }
}
body.route-cinema .cinema-controls-panel {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

/* v1.2.15: cleaner cinema edge handles + subtitle management */
body.route-cinema .cinema-panel-toggle {
  width: 42px;
  height: 148px;
  min-width: 0;
  padding: 0;
  top: 50%;
  bottom: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-radius: 0 18px 18px 0;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(16,13,23,.82), rgba(9,8,13,.72));
  color: rgba(255,249,240,.86);
  box-shadow: 0 18px 60px rgba(0,0,0,.38);
  backdrop-filter: blur(22px) saturate(1.1);
}
body.route-cinema .cinema-panel-toggle span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .68rem;
  font-weight: 950;
}
body.route-cinema .cinema-panel-toggle-left {
  left: -1px;
  transform: translateY(-50%);
}
body.route-cinema .cinema-panel-toggle-right {
  right: -1px;
  transform: translateY(-50%);
  border-radius: 18px 0 0 18px;
}
body.route-cinema .cinema-panel-toggle-right span {
  transform: none;
}
body.route-cinema .cinema-panel-toggle-left:hover,
body.route-cinema .cinema-panel-toggle-left.active {
  transform: translateY(-50%) translateX(6px);
}
body.route-cinema .cinema-panel-toggle-right:hover,
body.route-cinema .cinema-panel-toggle-right.active {
  transform: translateY(-50%) translateX(-6px);
}
body.route-cinema .cinema-panel-toggle:hover,
body.route-cinema .cinema-panel-toggle.active {
  background: linear-gradient(180deg, rgba(255,249,240,.96), rgba(233,220,204,.94));
  color: #19131b;
}
body.route-cinema .cinema-slide-panel {
  width: min(470px, calc(100vw - 58px));
}
body.route-cinema .cinema-controls-panel {
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
}
body.route-cinema .cinema-subtitle-control-box,
body.route-cinema .cinema-subtitle-options {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.055);
  border-radius: 22px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
body.route-cinema .cinema-subtitle-options.hidden {
  display: none !important;
}
body.route-cinema .cinema-subtitle-option-head {
  display: grid;
  gap: 3px;
}
body.route-cinema .cinema-subtitle-option-head strong {
  color: var(--paper);
  font-weight: 950;
}
body.route-cinema .cinema-subtitle-option-head span,
body.route-cinema .cinema-subtitle-line {
  color: rgba(255,249,240,.62);
  font-size: .84rem;
  font-weight: 750;
}
body.route-cinema .cinema-subtitle-ready {
  color: #f0c981;
}
body.route-cinema .cinema-subtitle-missing {
  color: rgba(255,249,240,.44);
}
body.route-cinema .subtitle-delay-field {
  display: grid;
  gap: 7px;
  font-size: .82rem;
  font-weight: 900;
  color: rgba(255,249,240,.72);
}
body.route-cinema .subtitle-delay-field input {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.08);
  color: var(--paper);
  font: inherit;
  font-weight: 850;
}
body.route-cinema .subtitle-delay-field input:disabled,
body.route-cinema .cinema-subtitle-tune-row button:disabled {
  opacity: .48;
  cursor: not-allowed;
}
body.route-cinema .cinema-subtitle-tune-row {
  justify-content: stretch;
}
body.route-cinema .cinema-subtitle-tune-row button {
  flex: 1 1 auto;
}
body.route-cinema .cinema-file-item {
  gap: 12px;
}
body.route-cinema .cinema-file-item .item-main {
  min-width: 0;
}
body.route-cinema .cinema-stored-actions {
  gap: 7px;
}
body.route-cinema .cinema-stored-actions button {
  flex: 1 1 calc(50% - 8px);
}
body.route-cinema .cinema-panel-form em {
  opacity: .65;
  font-style: normal;
  font-weight: 850;
}
@media (max-width: 820px) {
  body.route-cinema .cinema-panel-toggle {
    top: 50%;
    bottom: auto;
    width: 40px;
    height: 124px;
  }
  body.route-cinema .cinema-panel-toggle-left { left: -1px; transform: translateY(-50%); }
  body.route-cinema .cinema-panel-toggle-right { right: -1px; transform: translateY(-50%); }
  body.route-cinema .cinema-panel-toggle-left:hover,
  body.route-cinema .cinema-panel-toggle-left.active { transform: translateY(-50%) translateX(5px); }
  body.route-cinema .cinema-panel-toggle-right:hover,
  body.route-cinema .cinema-panel-toggle-right.active { transform: translateY(-50%) translateX(-5px); }
}

/* v1.2.16: cinema stored movie posters + readable drawers + upload progress */
body.route-cinema .cinema-slide-panel {
  --muted: rgba(255,249,240,.62);
  --line: rgba(255,249,240,.15);
  color: rgba(255,249,240,.9);
}
body.route-cinema .cinema-slide-panel h2,
body.route-cinema .cinema-slide-panel h3,
body.route-cinema .cinema-slide-panel label,
body.route-cinema .cinema-slide-panel strong {
  color: rgba(255,249,240,.94);
}
body.route-cinema .cinema-slide-panel span,
body.route-cinema .cinema-slide-panel .panel-head span,
body.route-cinema .cinema-panel-form .panel-head span,
body.route-cinema .cinema-tab-panel > .panel-head span,
body.route-cinema .cinema-slide-panel .upload-help,
body.route-cinema .cinema-slide-panel .form-actions {
  color: rgba(255,249,240,.64);
}
body.route-cinema .cinema-tabs button:not(.active) {
  color: rgba(255,249,240,.58);
}
body.route-cinema .cinema-tabs button.active {
  color: #19131b;
}
body.route-cinema .cinema-slide-panel input,
body.route-cinema .cinema-slide-panel select,
body.route-cinema .cinema-slide-panel textarea {
  color: rgba(255,249,240,.92);
  background: rgba(255,255,255,.085);
  border-color: rgba(255,255,255,.16);
}
body.route-cinema .cinema-slide-panel input::placeholder,
body.route-cinema .cinema-slide-panel textarea::placeholder {
  color: rgba(255,249,240,.38);
}
body.route-cinema .cinema-slide-panel .file-picker-row {
  background: rgba(255,255,255,.075);
  border-color: rgba(255,255,255,.15);
}
body.route-cinema .cinema-slide-panel .file-picker-name {
  color: rgba(255,249,240,.62);
}
body.route-cinema .cinema-movie-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}
body.route-cinema .cinema-movie-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,.075), rgba(255,255,255,.035));
  box-shadow: 0 14px 42px rgba(0,0,0,.22);
}
body.route-cinema .cinema-movie-poster {
  aspect-ratio: 2 / 3;
  width: 86px;
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(145deg, rgba(215,168,110,.22), rgba(155,108,255,.18), rgba(255,255,255,.055));
  background-size: cover;
  background-position: center;
  overflow: hidden;
  display: grid;
  place-items: end stretch;
  box-shadow: inset 0 -42px 56px rgba(0,0,0,.42), 0 12px 26px rgba(0,0,0,.26);
}
body.route-cinema .cinema-movie-poster.no-poster {
  place-items: center;
  padding: 8px;
  text-align: center;
  background:
    radial-gradient(circle at 22% 18%, rgba(215,168,110,.28), transparent 34%),
    linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.035));
}
body.route-cinema .cinema-movie-poster.no-poster strong,
body.route-cinema .cinema-movie-poster.has-poster span {
  width: 100%;
  padding: 8px;
  color: rgba(255,249,240,.95);
  font-size: .78rem;
  line-height: 1.12;
  font-weight: 950;
  overflow-wrap: anywhere;
}
body.route-cinema .cinema-movie-info {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
}
body.route-cinema .cinema-movie-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
body.route-cinema .cinema-movie-topline strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  letter-spacing: -.02em;
}
body.route-cinema .cinema-movie-topline span,
body.route-cinema .cinema-movie-meta {
  color: rgba(255,249,240,.56);
  font-size: .8rem;
  font-weight: 800;
}
body.route-cinema .cinema-movie-topline span {
  flex: 0 0 auto;
}
body.route-cinema .cinema-poster-ready {
  color: #f0c981 !important;
  font-weight: 850;
  font-size: .82rem;
}
body.route-cinema .cinema-poster-missing {
  color: rgba(255,249,240,.42) !important;
  font-weight: 850;
  font-size: .82rem;
}
body.route-cinema .cinema-movie-card .cinema-stored-actions {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
body.route-cinema .cinema-movie-card .cinema-stored-actions button {
  width: 100%;
  min-height: 38px;
  padding-inline: 10px;
}
body.route-cinema .cinema-upload-progress {
  margin-top: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.055);
  border-radius: 22px;
  padding: 12px;
}
body.route-cinema #uploadPercent {
  color: var(--gold, #d7a86e);
  font-weight: 950;
}
body.route-cinema #cinemaUploadButton:disabled {
  opacity: .55;
  cursor: wait;
}
@media (max-width: 560px) {
  body.route-cinema .cinema-movie-card {
    grid-template-columns: 72px minmax(0, 1fr);
    padding: 8px;
  }
  body.route-cinema .cinema-movie-poster {
    width: 72px;
    border-radius: 13px;
  }
  body.route-cinema .cinema-movie-card .cinema-stored-actions {
    grid-template-columns: 1fr;
  }
}

/* ==============================
   Shared Space 2.0 overrides
   ============================== */
.topbar-inner { max-width: min(1360px, calc(100vw - 32px)); }
.room-nav { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
.room-nav::-webkit-scrollbar { display: none; }
.room-nav a { white-space: nowrap; }

/* Cinema: less ugly controls, less intrusive media label */
.cinema-now-strip {
  left: 18px !important;
  bottom: 18px !important;
  right: auto !important;
  width: auto !important;
  max-width: min(420px, calc(100vw - 90px)) !important;
  padding: 9px 13px !important;
  border-radius: 999px !important;
  font-size: .82rem !important;
  line-height: 1.1 !important;
  opacity: .82 !important;
  pointer-events: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cinema-panel-toggle {
  width: 34px !important;
  height: 132px !important;
  min-height: 132px !important;
  padding: 0 !important;
  border-radius: 18px !important;
  opacity: .78;
  backdrop-filter: blur(18px);
}
.cinema-panel-toggle span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .72rem;
}
.cinema-panel-toggle:hover,
.cinema-panel-toggle.active { opacity: 1; }
.cinema-panel-toggle-left { left: 10px !important; }
.cinema-panel-toggle-right { right: 10px !important; }
.cinema-slide-panel { color: var(--paper); }
.cinema-slide-panel input,
.cinema-slide-panel textarea,
.cinema-slide-panel select { color: var(--paper); background: rgba(255,255,255,.08); }
.cinema-slide-panel input::placeholder,
.cinema-slide-panel textarea::placeholder { color: rgba(245,239,229,.56); }
.cinema-slide-panel .file-picker-name,
.cinema-slide-panel .upload-help,
.cinema-slide-panel .muted,
.cinema-slide-panel small,
.cinema-slide-panel span { color: rgba(245,239,229,.72); }
.cinema-slide-panel h2,
.cinema-slide-panel h3,
.cinema-slide-panel strong,
.cinema-slide-panel label { color: var(--paper); }
.cinema-upload-progress { display: grid; gap: 8px; }
.cinema-movie-list { max-height: min(65vh, 720px); overflow: auto; padding-right: 6px; }
.cinema-movie-card { min-height: 120px; }

/* Library modal: centered, not jammed under the navbar */
.library-modal.modal-backdrop,
#libraryModal.modal-backdrop {
  place-items: center !important;
  align-items: center !important;
  padding-top: max(90px, env(safe-area-inset-top)) !important;
  padding-bottom: 42px !important;
}
.library-modal-card.modal-card {
  max-height: min(760px, calc(100vh - 150px)) !important;
  overflow: auto !important;
  margin: 0 auto !important;
}

/* Chat */
.chat-room { width: min(1500px, calc(100vw - 36px)); margin: 0 auto; }
.chat-shell {
  display: grid;
  grid-template-columns: 290px minmax(420px, 1fr) 320px;
  min-height: min(760px, calc(100vh - 190px));
  overflow: hidden;
  padding: 0;
}
.chat-contact-panel,
.chat-info-panel {
  padding: 18px;
  border-right: 1px solid rgba(255,255,255,.08);
  overflow: auto;
}
.chat-info-panel { border-right: 0; border-left: 1px solid rgba(255,255,255,.08); }
.chat-conversation-panel { display: grid; grid-template-rows: auto 1fr auto auto; min-height: 0; }
.chat-conversation-head {
  display: flex; justify-content: space-between; gap: 14px; align-items: center;
  padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.chat-conversation-head span { display: block; color: var(--paper-soft); font-size: .9rem; margin-top: 2px; }
.chat-contact-list { display: grid; gap: 8px; }
.chat-contact {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 10px; border-radius: 18px; background: transparent; color: var(--paper);
}
.chat-contact.active,
.chat-contact:hover { background: rgba(255,255,255,.10); }
.chat-contact span:last-child { display: grid; gap: 2px; }
.chat-contact small { color: var(--paper-soft); }
.chat-avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #7b61ff); color: #fff; font-weight: 900;
  background-size: cover; background-position: center;
}
.chat-messages { overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.chat-message { display: flex; gap: 10px; align-items: flex-end; max-width: 82%; }
.chat-message.own { margin-left: auto; }
.chat-bubble {
  padding: 12px 14px; border-radius: 22px; background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.08); color: var(--paper);
}
.chat-message.own .chat-bubble { background: var(--paper); color: var(--ink); }
.chat-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; font-size: .75rem; opacity: .76; }
.chat-bubble p { margin: 0; white-space: normal; overflow-wrap: anywhere; }
.chat-compose { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.chat-compose input { border-radius: 999px; }
.chat-compose-status { padding: 0 20px 14px; color: var(--paper-soft); font-weight: 800; }
.chat-tool-card { border: 1px solid rgba(255,255,255,.10); border-radius: 22px; padding: 14px; margin-bottom: 12px; background: rgba(255,255,255,.05); }
.chat-tool-card textarea { min-height: 120px; }
.chat-letter { display: grid; gap: 8px; min-width: min(340px, 70vw); }
.chat-letter.locked { padding: 12px; border-radius: 18px; background: rgba(215,168,110,.16); border: 1px solid rgba(215,168,110,.36); }
.chat-request-card { display: grid; gap: 5px; min-width: 260px; padding: 12px; border-radius: 18px; background: rgba(215,168,110,.14); border: 1px solid rgba(215,168,110,.32); }
.chat-request-card a { font-weight: 900; text-decoration: none; color: inherit; }
.chat-attachment img,
.chat-attachment video { max-width: min(360px, 70vw); max-height: 240px; border-radius: 16px; display: block; margin-top: 8px; object-fit: contain; }
.chat-gif-box { margin-top: 16px; }
.gif-library { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 270px; overflow: auto; }
.gif-thumb { aspect-ratio: 1; border-radius: 14px; background-size: cover; background-position: center; min-height: 70px; padding: 0; }
@media (max-width: 1100px) { .chat-shell { grid-template-columns: 1fr; } .chat-contact-panel, .chat-info-panel { border: 0; border-bottom: 1px solid rgba(255,255,255,.08); } .chat-message { max-width: 96%; } }

/* Agenda period tracker */
.period-panel { margin-top: 18px; }
.period-layout { display: grid; grid-template-columns: minmax(340px, .9fr) minmax(300px, .7fr); gap: 18px; align-items: start; }
.period-entry small { display: block; color: var(--paper-soft); margin-top: 5px; }
@media (max-width: 860px) { .period-layout { grid-template-columns: 1fr; } }

/* Stats 2.0 */
.discord-stats-section { width: 100%; margin-top: 10px; }
.section-label { color: var(--paper-soft); text-transform: uppercase; letter-spacing: .28em; font-size: .78rem; font-weight: 900; margin: 0 0 10px 4px; }
.stats-discord-grid { margin-bottom: 18px; }
.personal-stats-panel { margin-top: 18px; }
.counter-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.counter-card { padding: 16px; border-radius: 22px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.10); display: grid; gap: 8px; }
.counter-card span { color: var(--paper-soft); font-weight: 900; }
.counter-card strong { font-size: 2.2rem; letter-spacing: -.06em; }
@media (max-width: 900px) { .counter-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .counter-grid { grid-template-columns: 1fr; } }

/* Pinwall pages */
.pinwall-room { width: min(1420px, calc(100vw - 36px)); margin: 0 auto; }
.pinwall-layout { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 18px; align-items: start; }
.pinwall-form-panel { position: sticky; top: 110px; max-height: calc(100vh - 130px); overflow: auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-list,
.recipe-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.shop-card,
.recipe-card { overflow: hidden; border-radius: 24px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.10); }
.shop-image,
.recipe-image { aspect-ratio: 4/3; background: linear-gradient(135deg, rgba(215,168,110,.34), rgba(90,66,125,.24)); background-size: cover; background-position: center; display: grid; place-items: center; padding: 18px; text-align: center; font-weight: 950; }
.shop-image.has-image span,
.recipe-image.has-image span { opacity: 0; }
.shop-body,
.recipe-body { padding: 14px; display: grid; gap: 8px; }
.shop-body > div:first-child { display: flex; justify-content: space-between; gap: 10px; }
.shop-body small,
.recipe-body small { color: var(--paper-soft); font-weight: 800; }
.recipe-body ul,
.recipe-body ol { padding-left: 20px; margin: 8px 0; color: var(--paper-soft); }
@media (max-width: 900px) { .pinwall-layout { grid-template-columns: 1fr; } .pinwall-form-panel { position: static; max-height: none; } }

/* ==============================
   Shared Space 2.0.1 cleanup pass
   ============================== */
:root {
  --soft-peach: #f3b77e;
  --period-red: #de6f76;
  --period-blue: #73a9e9;
}
.topbar { z-index: 1200; }
.topbar-inner {
  width: min(1180px, calc(100vw - 40px));
  max-width: min(1180px, calc(100vw - 40px)) !important;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  overflow: visible;
}
.room-nav {
  min-width: 0;
  justify-content: center;
  overflow: visible !important;
}
.room-nav a { padding-inline: clamp(10px, 1.2vw, 18px); }
.top-actions { align-items: center; min-width: 0; }
.profile-chip {
  max-width: 210px;
  min-width: 0;
  overflow: hidden;
}
.profile-chip span:last-child,
#topName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.more-nav { position: relative; z-index: 1500; }
.more-nav summary {
  list-style: none;
  width: 44px;
  min-height: 40px;
  display: grid;
  place-content: center;
  gap: 4px;
  border-radius: 999px;
  border: 1px solid var(--white-line);
  background: var(--white-soft);
  cursor: pointer;
}
.more-nav summary::-webkit-details-marker { display: none; }
.more-nav summary span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 99px;
  background: var(--paper);
}
.more-nav-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 210px;
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 22px;
  border: 1px solid var(--white-line);
  background: rgba(17, 13, 22, .94);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}
.more-nav-menu a {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 14px;
  color: var(--paper-soft);
  font-weight: 800;
}
.more-nav-menu a:hover,
.more-nav-menu a.active { background: var(--paper); color: var(--ink); }
@media (max-width: 820px) {
  .topbar-inner { grid-template-columns: 1fr auto; border-radius: 28px; }
  .brand { grid-column: 1; justify-content: flex-start; }
  .room-nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto !important; padding-bottom: 2px; }
  .top-actions { grid-column: 2; grid-row: 1; }
  .profile-chip #topName { display: none; }
}

/* File picker reliability: real buttons must receive the click. */
.file-picker-button { pointer-events: auto !important; border: 0; border-radius: 999px; background: var(--paper); color: var(--ink); padding: 10px 15px; font-weight: 900; box-shadow: none; white-space: nowrap; }
.file-picker-name { pointer-events: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.native-upload-field[role="group"] { font-weight: 900; color: inherit; }
.native-upload-field[role="group"] .file-picker-row { margin-top: 7px; }

/* Library upload modal: centered, lower than nav, no weird auto scroll. */
.library-modal.modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 5000 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 118px 22px 42px !important;
  background: rgba(5, 4, 7, .52);
}
.library-modal-card.modal-card {
  width: min(820px, calc(100vw - 44px)) !important;
  max-height: min(760px, calc(100dvh - 170px)) !important;
  border-radius: 30px !important;
}
.library-modal-card .modal-topline {
  top: 0 !important;
  margin: -22px -22px 16px !important;
  padding: 22px 22px 14px !important;
}
@media (max-height: 760px) {
  .library-modal.modal-backdrop { align-items: flex-start !important; padding-top: 86px !important; }
  .library-modal-card.modal-card { max-height: calc(100dvh - 110px) !important; }
}

/* Chat: centered Messenger-ish layout, not flung across the whole screen. */
.chat-room.messenger-room {
  width: min(1240px, calc(100vw - 40px));
  margin: 28px auto 0;
}
.messenger-shell.chat-shell {
  grid-template-columns: 270px minmax(430px, 1fr) 285px;
  min-height: min(760px, calc(100dvh - 145px));
  border-radius: 32px;
}
.chat-panel-title { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 14px; }
.chat-panel-title h2 { font-size: 1rem; }
.chat-panel-title span { color: var(--paper-soft); font-weight: 700; }
.chat-search-fake { border-radius: 999px; padding: 12px 14px; background: rgba(255,255,255,.08); color: var(--paper-soft); margin-bottom: 14px; font-weight: 750; }
.chat-media-uploader { display: grid; gap: 9px; margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.chat-media-uploader > span { color: var(--paper-soft); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.messenger-conversation { background: rgba(0,0,0,.08); }
.messenger-tools { background: rgba(255,255,255,.025); }
.chat-message { max-width: 78%; }
.chat-message.own .chat-bubble { background: #efe9df; }
.gif-library { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gif-thumb { min-height: 92px; }
@media (max-width: 1120px) {
  .messenger-shell.chat-shell { grid-template-columns: 240px minmax(0, 1fr); }
  .messenger-tools { grid-column: 1 / -1; border-left: 0; border-top: 1px solid rgba(255,255,255,.08); }
}
@media (max-width: 760px) {
  .chat-room.messenger-room { width: calc(100vw - 22px); }
  .messenger-shell.chat-shell { grid-template-columns: 1fr; min-height: auto; }
  .chat-contact-panel, .chat-info-panel { max-height: none; }
}

/* Agenda period badges */
.agenda-headline { display: flex; align-items: end; justify-content: space-between; gap: 18px; max-width: none; }
.period-calendar-event { background: rgba(222, 111, 118, .16) !important; border-color: rgba(222, 111, 118, .46) !important; }
.period-calendar-event strong::before { content: "● "; color: #ff98a0; }
.period-upcoming { border-left: 4px solid var(--period-red); }
@media (max-width: 720px) { .agenda-headline { display: grid; } }

/* Period tracker standalone UI */
.period-app-room {
  --period-bg: #f2bd83;
  --period-card: rgba(255, 255, 255, .93);
  --period-ink: #231f20;
  --period-muted: rgba(35, 31, 32, .62);
  width: min(1280px, calc(100vw - 40px));
  margin: 24px auto 0;
  color: var(--period-ink);
}
.period-app-shell {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(340px, 1fr) minmax(280px, .9fr);
  gap: 28px;
  align-items: start;
  padding: 38px;
  border-radius: 40px;
  background:
    radial-gradient(circle at 8% 35%, rgba(255,255,255,.32), transparent 20%),
    radial-gradient(circle at 88% 16%, rgba(255,255,255,.22), transparent 18%),
    linear-gradient(135deg, #f3c18c, #f0af75);
  box-shadow: var(--shadow);
}
.period-phone-card {
  min-height: 520px;
  padding: 22px;
  border-radius: 28px;
  background: var(--period-card);
  color: var(--period-ink);
  box-shadow: 0 22px 70px rgba(65, 39, 24, .18);
  border: 1px solid rgba(255,255,255,.7);
}
.period-phone-top, .period-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.period-kicker, .period-phone-card .eyebrow { color: var(--period-muted); text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 900; }
.period-phone-card h1 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.06em; margin: 4px 0 0; }
.period-phone-card h2 { font-size: 1.15rem; }
.period-agenda-link, .period-back-ghost { color: #538fe2; font-weight: 900; background: transparent; box-shadow: none; padding: 7px 8px; }
.period-week-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 26px 0; }
.period-day-dot { display: grid; place-items: center; gap: 2px; min-height: 54px; border-radius: 18px; color: var(--period-muted); }
.period-day-dot.active { background: #f1b677; color: white; }
.period-day-dot b { font-size: .8rem; }
.period-day-dot i { font-style: normal; font-weight: 900; }
.period-orb {
  width: min(250px, 70vw);
  aspect-ratio: 1;
  margin: 26px auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  background: #db7378;
  color: white;
  outline: 2px dotted rgba(219, 115, 120, .7);
  outline-offset: 14px;
}
.period-orb strong { font-size: 4rem; line-height: .9; }
.period-orb span, .period-orb small { font-weight: 900; }
.period-orb small { opacity: .9; max-width: 150px; }
.period-orb:not(.active-period) { background: #74a9e9; outline-color: rgba(116,169,233,.65); }
.period-insights, .period-profile-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 24px; }
.period-profile-metrics { grid-template-columns: repeat(2, 1fr); }
.period-insights article, .period-profile-metrics article {
  border-radius: 16px;
  padding: 14px;
  background: #f7f4f1;
  display: grid;
  gap: 4px;
}
.period-insights span, .period-profile-metrics span { color: var(--period-muted); font-size: .8rem; font-weight: 900; }
.period-insights strong, .period-profile-metrics strong { font-size: 1.65rem; color: #de7076; }
.period-log-form { display: grid; gap: 14px; margin-top: 20px; }
.period-date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.period-log-form input, .period-log-form select, .period-log-form textarea {
  background: #f7f4f1;
  color: var(--period-ink);
  border-color: rgba(0,0,0,.06);
}
.period-soft-section { border-radius: 18px; background: #f7f4f1; padding: 14px; display: grid; gap: 10px; }
.period-choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.period-choice, .period-flow-choice { cursor: pointer; }
.period-choice input, .period-flow-choice input { position: absolute; opacity: 0; pointer-events: none; }
.period-choice span, .period-flow-choice span {
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: white;
  color: var(--period-muted);
  font-weight: 900;
  font-size: .78rem;
  text-align: center;
  padding: 7px;
}
.period-choice input:checked + span, .period-flow-choice input:checked + span { background: #df7077; color: white; }
.period-flow-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.period-note-label textarea { min-height: 94px; }
.period-form-actions { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.period-form-actions span { color: var(--period-muted); font-weight: 900; }
.period-form-actions button { background: #f0b374; color: white; min-width: 160px; }
.period-profile-avatar { width: 84px; height: 84px; margin: 24px auto 10px; border-radius: 50%; background: #f2eeee; display: grid; place-items: center; font-size: 2.2rem; color: #df7077; }
.period-profile-card { text-align: center; }
.period-history { text-align: left; margin-top: 24px; }
.period-history-card { display: flex; justify-content: space-between; gap: 10px; align-items: start; padding: 12px; border-radius: 16px; background: #f7f4f1; margin-top: 10px; }
.period-history-card span, .period-history-card small { display: block; color: var(--period-muted); margin-top: 3px; }
@media (max-width: 1080px) { .period-app-shell { grid-template-columns: 1fr; } .period-phone-card { min-height: auto; } }
@media (max-width: 560px) { .period-app-room { width: calc(100vw - 18px); } .period-app-shell { padding: 12px; gap: 14px; border-radius: 26px; } .period-date-row, .period-choice-grid, .period-flow-grid, .period-insights { grid-template-columns: 1fr 1fr; } }

/* Shopping + Cooking: softer app-card UI inspired by supplied refs. */
.app-ui-room { width: min(1320px, calc(100vw - 40px)); margin: 28px auto 0; }
.app-phone-layout { display: grid; grid-template-columns: minmax(360px, .95fr) minmax(360px, .75fr); gap: 28px; align-items: start; }
.app-phone-board {
  min-height: min(780px, calc(100dvh - 150px));
  padding: 24px;
  border-radius: 34px;
  background: rgba(255,255,255,.94);
  color: #1f1d1f;
  box-shadow: 0 28px 90px rgba(0,0,0,.22);
  overflow: auto;
}
.app-screen-top { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.app-screen-top h1 { font-size: clamp(2rem, 4vw, 3.6rem); color: #1f1d1f; }
.app-count-pill { border-radius: 999px; background: #f0f0f0; color: rgba(0,0,0,.62); padding: 9px 12px; font-weight: 900; }
.app-search { min-height: 52px; border-radius: 16px; background: white; display: flex; align-items: center; padding: 0 18px; color: rgba(0,0,0,.38); font-weight: 800; box-shadow: 0 12px 26px rgba(0,0,0,.08); margin-bottom: 22px; }
.app-card-list { display: grid !important; grid-template-columns: 1fr !important; gap: 18px !important; }
.app-list-card { border: 0 !important; background: #fff !important; color: #1f1d1f !important; border-radius: 24px !important; box-shadow: 0 16px 40px rgba(0,0,0,.10); overflow: hidden; }
.app-card-image { aspect-ratio: 16/7 !important; min-height: 150px; background-color: #f2c590; background-image: linear-gradient(135deg, #f2c590, #e7e2dc); background-size: cover !important; background-position: center !important; color: #1f1d1f !important; }
.app-card-image.has-image { background-color: #ddd !important; }
.app-card-body { padding: 18px 22px 22px !important; color: #1f1d1f !important; }
.app-card-body strong { font-size: 1.25rem; }
.app-card-body small, .app-card-body p, .app-card-body li { color: rgba(0,0,0,.62) !important; }
.app-card-body .secondary { background: #f1f1f1; color: #1f1d1f; }
.app-phone-form { border-radius: 34px; max-height: min(780px, calc(100dvh - 150px)); overflow: auto; }
.app-phone-form textarea { min-height: 90px; }
@media (max-width: 900px) { .app-phone-layout { grid-template-columns: 1fr; } .app-phone-board, .app-phone-form { min-height: auto; max-height: none; } }

/* route sizing after nav cleanup */
body[data-route="chat"] .wrap,
body[data-route="period"] .wrap,
body[data-route="shopping"] .wrap,
body[data-route="cooking"] .wrap { max-width: none; }

/* Shared Space 2.0.2 interaction/layout repair pass */
[hidden], .hidden { display: none !important; }
button, summary, [role="button"], .file-picker-button { touch-action: manipulation; }
summary { cursor: pointer; user-select: none; }

/* Topnav: stop clipping and make the 3-line menu actually visible. */
.topbar, .topbar-inner, .top-actions, .more-nav { overflow: visible !important; }
.more-nav[open] .more-nav-menu {
  position: fixed !important;
  top: 82px !important;
  right: 22px !important;
  z-index: 9000 !important;
  width: min(240px, calc(100vw - 32px));
}
.more-nav summary { color: var(--paper); }
@media (max-width: 820px) {
  .more-nav[open] .more-nav-menu { top: 74px !important; right: 12px !important; }
}

/* Map: keep the map usable and prevent the header/search row from eating itself. */
body.route-map .topbar { z-index: 2600 !important; width: min(760px, calc(100vw - 28px)) !important; }
body.route-map .topbar-inner { overflow: visible !important; }
body.route-map .map-searchbar {
  z-index: 2200 !important;
  top: 88px !important;
  left: 14px !important;
  right: 14px !important;
  width: auto !important;
  grid-template-columns: 44px minmax(0, 1fr) auto auto !important;
}
body.route-map .map-drawer { z-index: 2100 !important; top: 154px !important; }
body.route-map .map-modal { z-index: 5000 !important; }
@media (min-width: 1180px) {
  body.route-map .topbar { width: min(720px, 50vw) !important; }
  body.route-map .map-searchbar { left: calc(min(720px, 50vw) + 28px) !important; top: 14px !important; }
  body.route-map .map-drawer { top: 88px !important; }
}
@media (max-width: 760px) {
  body.route-map .map-style-select { display: none !important; }
  body.route-map .map-searchbar { top: 132px !important; grid-template-columns: 42px minmax(0,1fr) !important; }
  body.route-map .map-searchbar > #addMapPin { display: none !important; }
  body.route-map .map-drawer { top: 200px !important; }
}

/* Library: turn upload/settings into right-side drawers, not awkward center modals. */
.library-modal.modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 6200 !important;
  display: block !important;
  padding: 0 !important;
  background: rgba(3, 3, 6, .45) !important;
  backdrop-filter: blur(14px) saturate(1.05);
}
.library-modal.modal-backdrop.hidden { display: none !important; }
.library-modal-card.modal-card {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  width: min(560px, 100vw) !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  border-radius: 30px 0 0 30px !important;
  overflow: auto !important;
  padding: 26px !important;
  background: linear-gradient(180deg, rgba(24, 24, 34, .98), rgba(8, 7, 12, .98)) !important;
  color: var(--paper) !important;
  box-shadow: -26px 0 90px rgba(0,0,0,.55) !important;
}
.library-modal-card .modal-topline {
  position: sticky !important;
  top: -26px !important;
  margin: -26px -26px 20px !important;
  padding: 26px 26px 16px !important;
  background: linear-gradient(180deg, rgba(20,20,28,.99), rgba(20,20,28,.88)) !important;
  z-index: 3 !important;
}
.library-modal-card input,
.library-modal-card select,
.library-modal-card textarea {
  color: var(--paper) !important;
  background: rgba(255,255,255,.08) !important;
  border-color: rgba(255,255,255,.18) !important;
}
.library-modal-card input::placeholder,
.library-modal-card textarea::placeholder { color: rgba(255,249,240,.45) !important; }

/* Generic side drawers for shopping/cooking. */
.app-phone-layout { grid-template-columns: minmax(360px, 1fr) !important; }
.app-drawer-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 6200 !important;
  display: block !important;
  background: rgba(4,4,8,.45) !important;
  backdrop-filter: blur(14px);
}
.app-drawer-backdrop.hidden { display: none !important; }
.app-side-drawer {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  width: min(560px, 100vw) !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  border-radius: 30px 0 0 30px !important;
  overflow: auto !important;
  box-shadow: -26px 0 90px rgba(0,0,0,.55) !important;
}
.app-screen-top .button-row { align-items: center; }
.app-screen-top .button-row button { min-height: 42px; }

/* Chat: bigger, centered, and popup tools instead of cramped side forms. */
.big-chat-room.chat-room.messenger-room {
  width: min(1580px, calc(100vw - 28px)) !important;
  margin: 18px auto 0 !important;
}
.big-chat-room .messenger-shell.chat-shell {
  grid-template-columns: 285px minmax(560px, 1fr) 265px !important;
  min-height: min(850px, calc(100dvh - 122px)) !important;
  height: calc(100dvh - 126px) !important;
}
.big-chat-room .chat-messages { min-height: 0; }
.big-chat-room .chat-message { max-width: 72%; }
.chat-popup {
  position: fixed !important;
  inset: 0 !important;
  z-index: 6400 !important;
  display: grid !important;
  place-items: center !important;
  padding: 22px !important;
  background: rgba(3,3,7,.55) !important;
  backdrop-filter: blur(16px);
}
.chat-popup.hidden { display: none !important; }
.chat-popup-card {
  width: min(560px, calc(100vw - 32px)) !important;
  max-height: calc(100dvh - 44px) !important;
  overflow: auto !important;
  border-radius: 30px !important;
}
.chat-bet-amount-row { display: grid; grid-template-columns: 1fr 52px 52px; gap: 10px; align-items: end; }
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 8px 20px 0;
  color: var(--paper-soft);
  font-size: .9rem;
  font-weight: 800;
}
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--paper-soft);
  animation: typing-bounce 1s infinite ease-in-out;
}
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-4px); opacity: 1; } }
@media (max-width: 1180px) {
  .big-chat-room .messenger-shell.chat-shell { grid-template-columns: 240px minmax(0, 1fr) !important; height: auto !important; }
  .big-chat-room .messenger-tools { grid-column: 1 / -1; }
}

/* Casino request popup + cleaner amount stepper. */
.casino-compose.modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 6400 !important;
  display: grid !important;
  place-items: center !important;
  padding: 20px !important;
  background: rgba(3,3,7,.55) !important;
  backdrop-filter: blur(16px);
}
.casino-compose.modal-backdrop.hidden { display: none !important; }
.casino-bet-popup { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow: auto; border-radius: 32px; }
.casino-popup-form { display: grid; gap: 16px; }
.casino-amount-stepper { display: grid; grid-template-columns: 1fr 54px 54px; gap: 10px; align-items: end; }
.casino-amount-stepper button { min-height: 54px; font-size: 1.35rem; }
.casino-clean-bet { transition: transform .15s ease, background .15s ease; }
.casino-clean-bet:hover { transform: translateY(-1px); }

/* Period tracker: make pills feel like real buttons and stop text selecting. */
.period-choice span,
.period-flow-choice span {
  user-select: none;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,.04);
  transition: transform .12s ease, background .12s ease;
}
.period-choice span:hover,
.period-flow-choice span:hover { transform: translateY(-1px); }
.period-log-form button[type="submit"] { min-height: 52px; }
.period-phone-card input,
.period-phone-card select,
.period-phone-card textarea { font-size: 1rem; }

/* Agenda timezones */
.agenda-timezone-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1); }
#timezoneFields { display: grid; gap: 10px; }
#timezoneFields label { display: grid; gap: 6px; }
#timezoneFields small { color: var(--paper-soft); font-weight: 800; }

/* Stats: bundle Discord as one clean block instead of two floating islands. */
.discord-stats-section {
  width: min(1420px, calc(100vw - 40px));
  margin: 0 auto 10px;
}
.stats-top-grid.stats-discord-grid,
.stats-lower {
  width: min(1420px, calc(100vw - 40px));
  margin-inline: auto;
}
.stats-top-grid.stats-discord-grid {
  grid-template-columns: minmax(420px, 1.1fr) minmax(320px, .7fr) !important;
  align-items: stretch;
}
.stats-lower {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 18px !important;
}
.stats-lower .call-details {
  width: 100%;
  max-width: none;
}
.stats-lower .call-details[open] {
  display: block;
}
.call-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.2rem;
  font-weight: 950;
}
.call-details summary::after { content: '−'; opacity: .8; }
.call-details:not([open]) summary::after { content: '+'; }
.room-label-editor summary { pointer-events: auto !important; }

/* File inputs: keep browser-native input hidden where we use custom buttons. */
.visually-hidden-file {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
}

/* v2.0.3: date picker, map search moved into Places drawer, and larger readable chat tools */
input[type="date"], input[type="datetime-local"] {
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: .95;
}

body.route-map .topbar {
  z-index: 1800 !important;
}
body.route-map .map-shell {
  overflow: hidden !important;
}
body.route-map .map-drawer-tab {
  left: 18px;
  top: 92px;
  min-height: 44px;
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(15, 16, 25, .82);
  color: var(--paper);
  border: 1px solid rgba(255,249,240,.18);
  box-shadow: 0 16px 55px rgba(0,0,0,.32);
  backdrop-filter: blur(18px) saturate(1.2);
}
body.route-map .map-drawer:not(.collapsed) + .map-drawer-tab,
body.route-map .map-drawer-tab[hidden] {
  display: none;
}
body.route-map .map-drawer {
  top: 84px !important;
  left: 16px !important;
  bottom: 16px !important;
  width: min(430px, calc(100vw - 32px)) !important;
  z-index: 1200 !important;
}
body.route-map .map-drawer.collapsed {
  transform: translateX(calc(-100% - 30px)) !important;
}
body.route-map .map-drawer-search.map-searchbar,
.map-drawer .map-drawer-search.map-searchbar {
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  width: 100% !important;
  max-width: none !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
  margin: 18px 0 16px !important;
  padding: 12px !important;
  border-radius: 24px !important;
  background: rgba(255,255,255,.07) !important;
  border: 1px solid rgba(255,255,255,.13) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}
body.route-map .map-drawer-search .map-search-form,
.map-drawer-search .map-search-form {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 8px !important;
  min-width: 0 !important;
}
body.route-map .map-drawer-search input,
.map-drawer-search input {
  height: 46px !important;
  min-width: 0 !important;
}
.map-drawer-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
body.route-map .map-drawer-search .map-style-select,
.map-drawer-search .map-style-select,
body.route-map .map-drawer-search button,
.map-drawer-search button {
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}
body.route-map .map-drawer-search .map-search-results,
.map-drawer-search .map-search-results {
  position: static !important;
  width: 100% !important;
  max-height: 280px !important;
  margin-top: 2px !important;
  background: rgba(8,10,18,.92) !important;
  border-color: rgba(255,255,255,.16) !important;
}
body.route-map .map-searchbar:not(.map-drawer-search) {
  display: none !important;
}
@media (max-width: 760px) {
  body.route-map .map-drawer { top: 80px !important; }
  body.route-map .map-drawer-search .map-search-form { grid-template-columns: 1fr !important; }
  .map-drawer-actions { grid-template-columns: 1fr; }
}

.chat-popup-card {
  width: min(980px, calc(100vw - 40px)) !important;
  max-height: calc(100dvh - 38px) !important;
  padding: clamp(22px, 3vw, 38px) !important;
  border-radius: 34px !important;
  background: rgba(16, 15, 22, .94) !important;
  color: var(--paper) !important;
  border: 1px solid rgba(255,255,255,.14) !important;
}
.chat-popup-card .modal-topline {
  align-items: flex-start;
  margin-bottom: 18px;
}
.chat-popup-card .modal-topline span,
.chat-popup-card .eyebrow,
.chat-popup-card .form-actions {
  color: rgba(255,249,240,.72) !important;
}
.chat-popup-card input,
.chat-popup-card textarea,
.chat-popup-card select {
  background: rgba(255,255,255,.09) !important;
  color: var(--paper) !important;
  border-color: rgba(255,255,255,.15) !important;
}
.chat-popup-card input::placeholder,
.chat-popup-card textarea::placeholder {
  color: rgba(255,249,240,.52) !important;
}
#letterForm textarea[name="text"] {
  min-height: min(44vh, 380px) !important;
}
#letterForm.chat-tool-card,
#requestForm.chat-tool-card {
  padding: clamp(18px, 2.5vw, 28px) !important;
  border-radius: 28px !important;
  background: rgba(255,255,255,.055) !important;
}
#letterForm .form-actions,
#requestForm .form-actions {
  position: sticky;
  bottom: -10px;
  padding-top: 12px;
  background: linear-gradient(180deg, transparent, rgba(16,15,22,.94) 38%);
}

/* ODH_UPLOAD_QUEUE_2_0_6_START */
.library-upload-file-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  font-size: .82rem;
  opacity: .86;
}
.library-file-preview.has-warning {
  border-color: rgba(255, 100, 120, .55) !important;
  box-shadow: 0 0 0 1px rgba(255, 100, 120, .18) inset;
}
.cinema-upload-queue-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.045);
}
.cinema-upload-queue {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}
.cinema-upload-job {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.055);
}
.cinema-upload-job.is-uploading {
  border-color: rgba(215,166,110,.42);
  background: rgba(215,166,110,.08);
}
.cinema-upload-job.is-done {
  border-color: rgba(120,210,150,.32);
}
.cinema-upload-job.is-error {
  border-color: rgba(255,100,120,.42);
}
.cinema-upload-job-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.cinema-upload-job-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cinema-upload-job-top span {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .7;
}
.cinema-upload-job small {
  color: var(--muted);
  line-height: 1.35;
}
/* ODH_UPLOAD_QUEUE_2_0_6_END */




/* ODH_MENU_COPY_CLEANUP_2_0_8_START */
/* Keep the 3-line dropdown tied to the hamburger on every route, including fullscreen Cinema. */
.topbar,
.topbar-inner,
.top-actions,
.more-nav {
  overflow: visible !important;
}
.topbar { z-index: 2147480000 !important; }
.more-nav { position: relative !important; z-index: 2147481000 !important; }
.more-nav summary { position: relative !important; z-index: 2147481500 !important; }
.more-nav-menu {
  box-sizing: border-box !important;
  position: fixed !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  width: min(320px, calc(100vw - 24px)) !important;
  max-height: calc(100vh - 92px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  z-index: 2147482000 !important;
  background: rgba(17, 13, 22, .97) !important;
  color: var(--paper) !important;
  box-shadow: 0 28px 80px rgba(0,0,0,.42) !important;
}
.more-nav-menu a { color: rgba(255,249,240,.72) !important; }
.more-nav-menu a:hover,
.more-nav-menu a.active { color: var(--ink) !important; background: var(--paper) !important; }
body.route-cinema .topbar { z-index: 2147480000 !important; }
body.route-cinema .more-nav-menu { backdrop-filter: blur(24px) !important; }
@media (max-width: 720px) {
  .more-nav-menu { width: min(280px, calc(100vw - 20px)) !important; }
}
/* ODH_MENU_COPY_CLEANUP_2_0_8_END */


/* v2.0.9: native file buttons, hideable GIF panel, direct images, Tenor/search UI */
.native-file-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 950;
  cursor: pointer;
  overflow: hidden;
  border: 0;
  box-shadow: 0 10px 28px rgba(0,0,0,.16);
  user-select: none;
}
.native-file-chip input[type="file"] {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  opacity: 0 !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  clip: auto !important;
  clip-path: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.native-file-chip span { pointer-events: none; }
.chat-compose {
  grid-template-columns: auto auto minmax(0, 1fr) auto !important;
  align-items: center;
}
.chat-compose-file {
  min-height: 44px;
  padding-inline: 14px;
  background: rgba(255,255,255,.11);
  color: var(--paper);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: none;
}
.chat-gif-hidden {
  grid-template-columns: 285px minmax(560px, 1fr) 0 !important;
}
.chat-gif-hidden .messenger-tools,
.chat-gif-hidden #chatGifPanel {
  display: none !important;
}
.tenor-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin: 10px 0;
}
.tenor-search-form input {
  min-width: 0;
  min-height: 42px;
}
.tenor-card h3 { margin: 0; font-size: 1rem; }
.tenor-results { margin-top: 10px; }
.tenor-thumb { position: relative; overflow: hidden; }
.tenor-thumb::after {
  content: 'Tenor';
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 900;
  background: rgba(0,0,0,.62);
  color: white;
}
.chat-attachment small {
  display: block;
  margin-top: 4px;
  opacity: .65;
  font-size: .72rem;
  font-weight: 800;
}
.chat-attachment img,
.chat-attachment video {
  max-width: min(420px, 68vw) !important;
  max-height: 310px !important;
}
.chat-media-uploader .native-file-chip {
  width: 100%;
  background: rgba(255,255,255,.10);
  color: var(--paper);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: none;
}
.chat-request-card strong { font-size: 1rem; }
.chat-bet-amount-row:not(.hidden) { display: grid !important; }
/* macOS/Safari fix for existing cinema/library custom file pickers: the real native input sits over the fake button. */
.clickable-upload-field {
  position: relative !important;
}
.clickable-upload-field > input[type="file"].native-file-input {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  opacity: 0 !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  clip: auto !important;
  clip-path: none !important;
  margin: 0 !important;
  z-index: 5 !important;
}
.clickable-upload-field > .file-picker-row,
.clickable-upload-field > .upload-help {
  pointer-events: none !important;
}
@media (max-width: 1180px) {
  .chat-gif-hidden { grid-template-columns: 240px minmax(0, 1fr) !important; }
}
@media (max-width: 780px) {
  .chat-compose { grid-template-columns: 1fr 1fr !important; }
  .chat-compose input[name="text"] { grid-column: 1 / -1; }
  .chat-compose button[type="submit"] { grid-column: 1 / -1; }
}
