:root {
  --bg: #f6f3ec; --surface: #ffffff; --surface-2: #efeae0; --ink: #0d2233; --ink-2: #4a5d6c; --ink-3: #7b8b97;
  --line: #e0d9cc; --deep: #0b2a3f; --deep-2: #12405e; --lagoon: #1b8a8f; --lagoon-soft: #d7efee;
  --coral: #c2410c; --coral-hover: #a6370a; --danger: #b42318; --ok: #157347;
  --r: 14px; --r-sm: 9px; --shadow: 0 1px 2px rgba(13,34,51,.06), 0 6px 24px rgba(13,34,51,.06);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs-xs: .78rem; --fs-sm: .88rem; --fs-md: 1rem; --fs-lg: 1.2rem; --fs-xl: 1.55rem;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: var(--fs-md); line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, video { max-width: 100%; display: block; }
a { color: var(--lagoon); }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); font-weight: 800; }
h2 { font-size: var(--fs-lg); font-weight: 750; }
h3 { font-size: var(--fs-md); font-weight: 700; }
.muted { color: var(--ink-2); } .small { font-size: var(--fs-sm); } .xs { font-size: var(--fs-xs); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }

/* header */
.top { background: var(--deep); color: #eaf4f6; position: sticky; top: 0; z-index: 30; }
.top .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { font-weight: 800; letter-spacing: .02em; color: #fff; text-decoration: none; white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.brand svg { flex: none; }
.nav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav a { color: #b9d3db; text-decoration: none; padding: 8px 12px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav a.active { color: var(--deep); background: #e9f6f5; }
.top-right { display: flex; align-items: center; gap: 10px; }
.lang { display: flex; background: rgba(255,255,255,.08); border-radius: 999px; padding: 3px; }
.lang button { background: none; border: 0; color: #b9d3db; padding: 4px 9px; border-radius: 999px; cursor: pointer; font-size: var(--fs-xs); font-weight: 700; }
.lang button.on { background: #fff; color: var(--deep); }
.me-chip { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
@media (max-width: 760px) {
  .top .wrap { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 6px; gap: 8px 12px; }
  .brand { flex: 1 1 0; min-width: 0; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; }
  .top-right { flex: none; }
  .nav { order: 3; flex-basis: 100%; }
  .me-chip span { display: none; }
  .lang button { padding: 4px 7px; }
}

/* layout */
main { padding: 28px 0 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.pad { padding: 22px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .grid2 { grid-template-columns: 1fr; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 9px 16px; font-weight: 700; font-size: var(--fs-sm); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn.primary:hover { background: var(--coral-hover); }
.btn.deep { background: var(--deep); border-color: var(--deep); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: var(--fs-xs); }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 34px; height: 34px; padding: 0; border-radius: 50%; }

/* forms */
label.f { display: block; }
label.f > span { display: block; font-size: var(--fs-sm); font-weight: 700; margin-bottom: 6px; }
label.f > span em { font-style: normal; color: var(--coral); font-weight: 600; font-size: var(--fs-xs); margin-left: 6px; }
.inp { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: var(--r-sm); padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
.inp:focus { border-color: var(--lagoon); box-shadow: 0 0 0 3px rgba(27,138,143,.18); }
textarea.inp { min-height: 96px; resize: vertical; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg label { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; cursor: pointer; font-size: var(--fs-sm); font-weight: 600; display: flex; gap: 8px; align-items: center; background: #fff; }
.seg input { accent-color: var(--lagoon); }
.seg label:has(input:checked) { border-color: var(--lagoon); background: var(--lagoon-soft); }
@media (max-width: 620px) { .seg { grid-template-columns: 1fr; } }
.err { color: var(--danger); font-size: var(--fs-sm); font-weight: 600; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 800; padding: 0; margin-bottom: 4px; }

/* hero for closed / join */
.hero { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 40px 20px; background:
  radial-gradient(1200px 600px at 20% -10%, rgba(27,138,143,.35), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, rgba(194,65,12,.18), transparent 60%),
  linear-gradient(180deg, #0b2a3f 0%, #0e3a55 55%, #145a6e 100%); color: #eaf4f6; }
.hero .card { color: var(--ink); width: min(560px, 100%); }
.hero-title { text-align: center; margin-bottom: 26px; }
.hero-title h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); color: #fff; }
.hero-title p { color: #b9d3db; margin: 10px auto 0; max-width: 460px; }

/* avatar */
.av { border-radius: 50%; background: var(--lagoon-soft); color: var(--deep-2); display: grid; place-items: center; font-weight: 800; overflow: hidden; flex: none; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av-28 { width: 28px; height: 28px; font-size: .72rem; } .av-48 { width: 48px; height: 48px; } .av-72 { width: 72px; height: 72px; font-size: 1.3rem; } .av-120 { width: 120px; height: 120px; font-size: 2rem; }

/* role badge */
.badge { display: inline-block; font-size: var(--fs-xs); font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.badge.master { background: #e6effa; color: #1d4f91; } .badge.queen { background: #fdeee4; color: #9a3a0d; } .badge.organizer { background: var(--lagoon-soft); color: #11666a; }

/* people grid */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.person { display: flex; gap: 14px; padding: 16px; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; min-width: 0; }
.person:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(13,34,51,.1); }
.person .meta { min-width: 0; }
.person .meta p { margin: 6px 0 0; color: var(--ink-2); font-size: var(--fs-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .inp { max-width: 280px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: var(--fs-xs); font-weight: 700; cursor: pointer; }
.chip.on { background: var(--deep); color: #fff; border-color: var(--deep); }

/* profile */
.profile-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.contacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.contact { display: flex; flex-direction: column; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); text-decoration: none; color: var(--ink); background: #fff; min-width: 0; }
.contact b { font-size: var(--fs-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.contact span { overflow-wrap: anywhere; font-weight: 600; }

/* breadcrumbs */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-sm); margin-bottom: 14px; }
.crumbs a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--ink-3); }

/* media grid */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
@media (max-width: 520px) { .mgrid { grid-template-columns: repeat(3, 1fr); gap: 4px; } .tile .cap { display: none; } .tile, .tile .th { border-radius: 6px; } }
.tile { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; cursor: pointer; min-width: 0; }
.tile .th { aspect-ratio: 1; background: #dfe7ea; display: grid; place-items: center; color: var(--ink-3); position: relative; overflow: hidden; }
.tile .th img { width: 100%; height: 100%; object-fit: cover; }
.tile .cap { padding: 7px 9px; font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.tile .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(11,42,63,.82); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 6px; padding: 2px 6px; display: flex; gap: 4px; align-items: center; }
.tile.folder .th { background: linear-gradient(160deg, #e7f3f2, #d4e7ea); }
.tile.folder .th img { opacity: .9; }
.tile.folder .fo-label { position: absolute; inset: auto 0 0 0; padding: 22px 10px 8px; background: linear-gradient(transparent, rgba(11,42,63,.78)); color: #fff; font-weight: 700; font-size: var(--fs-sm); display: flex; align-items: center; gap: 6px; }
.tile .sel { position: absolute; top: 7px; left: 7px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(11,42,63,.35); display: none; place-items: center; color: #fff; }
.selecting .tile:not(.folder) .sel { display: grid; }
.tile.picked { outline: 3px solid var(--lagoon); outline-offset: -3px; }
.tile.picked .sel { background: var(--lagoon); }
.tile .more { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity .15s; background: rgba(255,255,255,.92); border: 0; }
.tile:hover .more, .tile .more:focus { opacity: 1; }
@media (hover: none) { .tile .more { opacity: 1; } }
.section-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 800; margin: 22px 0 10px; }

.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 26px; text-align: center; color: var(--ink-2); background: rgba(255,255,255,.5); }
.dragging .drop, .drop.over { border-color: var(--lagoon); background: var(--lagoon-soft); }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-2); }

/* uploader panel */
.upanel { position: fixed; right: 16px; bottom: 16px; width: min(380px, calc(100vw - 32px)); max-height: 60vh; display: flex; flex-direction: column; z-index: 40; }
.upanel .uhead { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); gap: 10px; }
.upanel .ulist { overflow: auto; padding: 6px 0; }
.uitem { padding: 8px 14px; font-size: var(--fs-sm); }
.uitem .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--lagoon); width: 0; transition: width .3s; }
.uitem.ok .bar i { background: var(--ok); } .uitem.bad .bar i { background: var(--danger); }

/* lightbox */
.lb { position: fixed; inset: 0; background: #05121c; z-index: 60; display: flex; flex-direction: column; color: #e7f0f3; }
.lb-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.lb-top .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: var(--fs-sm); }
.lb-top .btn { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; }
.lb-body { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; padding: 0 56px 18px; }
.lb-body img, .lb-body video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.1); border: 0; color: #fff; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.lb-nav:hover { background: rgba(255,255,255,.2); }
.lb-prev { left: 8px; } .lb-next { right: 8px; }
@media (max-width: 600px) { .lb-body { padding: 0 0 12px; } .lb-nav { background: rgba(0,0,0,.35); } }
.lb .nopv { text-align: center; max-width: 420px; padding: 20px 56px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(5,18,28,.5); z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal { width: min(440px, 100%); }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.tree { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.tree button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--surface-2); }
.tree button:hover, .tree button.on { background: var(--lagoon-soft); }

.menu { position: fixed; z-index: 80; min-width: 180px; padding: 6px; }
.menu button { display: flex; width: 100%; gap: 8px; align-items: center; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; font-size: var(--fs-sm); font-weight: 600; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--deep); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 600; z-index: 90; box-shadow: var(--shadow); }

.qr { background: #fff; padding: 12px; border-radius: var(--r-sm); border: 1px solid var(--line); width: 220px; }
.qr svg { width: 100%; height: auto; display: block; }
.linkbox { font-family: ui-monospace, monospace; font-size: var(--fs-xs); background: var(--surface-2); padding: 8px 10px; border-radius: 8px; overflow-wrap: anywhere; }
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.t td, table.t th { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.t th { font-size: var(--fs-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.stat { font-size: var(--fs-xl); font-weight: 800; }
.skel { background: linear-gradient(90deg, #ece6da, #f4efe6, #ece6da); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--r-sm); }
@keyframes sk { to { background-position: -200% 0; } }

@media print { .top, .no-print { display: none !important; } body { background: #fff; } .print-only { display: block !important; } }
.print-only { display: none; }
