/* Meeks — soft, rounded theme built around #0E9594 */

:root {
  --brand: #0e9594;
  --brand-strong: #0b7a79;
  --brand-soft: #dff3f2;
  --brand-softer: #f0faf9;
  --pink: #ff8fab;
  --pink-soft: #ffeef2;
  --bg: #f3faf9;
  --dot: #d5eeec;
  --panel: #ffffff;
  --text: #25403f;
  --muted: #7b9493;
  --border: #d8ecea;
  --mine: var(--brand);
  --mine-text: #ffffff;
  --danger: #e5677f;
  --ok: #0e9594;
  --mid: #e0a13a;
  --shadow: 0 4px 16px rgb(14 149 148 / 0.10);
  --shadow-sm: 0 2px 6px rgb(14 149 148 / 0.10);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #2bb3b1;
    --brand-strong: #52c9c7;
    --brand-soft: #173837;
    --brand-softer: #132a2a;
    --pink: #ff9bb5;
    --pink-soft: #3a2029;
    --bg: #0f1f1f;
    --dot: #173030;
    --panel: #172a2a;
    --text: #e3f2f1;
    --muted: #8fb0ae;
    --border: #244343;
    --mine: #178e8d;
    --mine-text: #ffffff;
    --danger: #ff8a9f;
    --ok: #4fd1ce;
    --shadow: 0 4px 16px rgb(0 0 0 / 0.30);
    --shadow-sm: 0 2px 6px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--text);
  font: 15px/1.6 "Zen Maru Gothic", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Kosugi Maru",
    "BIZ UDPGothic", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--pink-soft); }
code { background: var(--brand-soft); color: var(--brand-strong); padding: 1px 6px; border-radius: 8px; font-size: 0.92em; }

/* ---------- controls ---------- */
button, input, textarea { font: inherit; color: inherit; }
button {
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
button:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
button:active { transform: translateY(0) scale(0.97); box-shadow: none; }
button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
button.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); background: var(--pink-soft); }
button.big { font-size: 1.1em; padding: 14px 24px; width: 100%; box-shadow: 0 6px 18px rgb(14 149 148 / 0.28); }
button:disabled, textarea:disabled, input:disabled {
  opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none;
}
input, textarea {
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
textarea { border-radius: 22px; }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.hint { color: var(--muted); font-size: 0.85em; }
.check { display: flex; gap: 6px; align-items: center; font-size: 0.9em; margin: 8px 0; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }

.logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; letter-spacing: 0.01em; color: var(--brand); text-decoration: none;
}
.logo::before {
  content: ""; width: 0.95em; height: 0.8em; flex-shrink: 0;
  background: var(--brand);
  border-radius: 50% 50% 50% 12% / 55% 55% 45% 20%; /* speech bubble */
  box-shadow: 0.35em -0.2em 0 -0.18em var(--pink);  /* little pink dot */
}

/* ---------- home ---------- */
body.home {
  height: auto; min-height: 100%; display: flex; flex-direction: column; align-items: center;
  padding: 48px 16px 0;
}
body.home main { width: 100%; max-width: 760px; display: flex; flex-direction: column; align-items: center; gap: 40px; flex: 1; }
.home-card {
  position: relative;
  width: 100%; max-width: 520px;
  background: var(--panel);
  border-radius: 32px;
  padding: 40px 32px 32px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.home-card::before, .home-card::after {
  content: ""; position: absolute; border-radius: 50%; z-index: 0; pointer-events: none;
}
.home-card::before { width: 180px; height: 180px; right: -60px; top: -70px; background: var(--brand-soft); }
.home-card::after { width: 70px; height: 70px; right: 90px; top: -30px; background: var(--pink-soft); }
.home-card > * { position: relative; z-index: 1; }
.home-card h1 { font-size: 2.8em; margin: 0; }
.home-card h2 { font-size: 1em; margin: 28px 0 10px; color: var(--brand-strong); }
.home-sub { border-top: 2px dashed var(--border); margin-top: 24px; }
.tagline { color: var(--muted); margin: 6px 0 24px; }

.features { width: 100%; }
.features h2 { text-align: center; color: var(--brand-strong); font-size: 1.3em; margin: 0 0 18px; }
.features ul {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px;
}
.features li { background: var(--panel); border-radius: 22px; padding: 18px 20px; box-shadow: var(--shadow-sm); }
.feat-icon {
  display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 12px;
  border-radius: 16px; background: var(--brand-soft);
}
.feat-icon svg {
  width: 24px; height: 24px; fill: none; stroke: var(--brand);
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.features h3 { margin: 0 0 6px; font-size: 1em; color: var(--brand-strong); }
.features p { margin: 0; font-size: 0.9em; color: var(--muted); }

.site-footer { width: 100%; text-align: center; padding: 32px 16px 24px; color: var(--muted); letter-spacing: 0.05em; }
.sidebar-footer { margin-top: auto; padding-top: 12px; text-align: center; color: var(--muted); letter-spacing: 0.05em; }

/* ---------- room ---------- */
body.room { display: flex; flex-direction: column; height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  position: relative; z-index: 2;
}
.logo.small { font-size: 1.25em; }
.room-info { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; }
#room-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 8px; }
.badge {
  font-size: 0.75em; color: var(--brand-strong); white-space: nowrap;
  background: var(--brand-soft); padding: 2px 10px; border-radius: 999px;
}
.warn { background: var(--pink-soft); padding: 8px 18px; font-size: 0.9em; }

.layout { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 250px; flex-shrink: 0;
  margin: 12px 0 12px 12px;
  padding: 14px 16px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar h3 { font-size: 0.78em; color: var(--brand); margin: 14px 0 2px; letter-spacing: 0.08em; }
.sidebar h3:first-child { margin-top: 0; }
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li { display: flex; gap: 6px; align-items: center; padding: 5px 8px; border-radius: 12px; }
.sidebar li:nth-child(odd) { background: var(--brand-softer); }
.sidebar li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route {
  margin-left: auto; font-size: 0.7em; padding: 1px 8px; border-radius: 999px;
  border: 1.5px solid currentColor; white-space: nowrap; font-weight: 600;
}
.route.ok { color: var(--ok); }
.route.mid { color: var(--mid); }
.route.relay { color: var(--muted); }
.fingerprint {
  font-family: ui-monospace, monospace; font-size: 1.05em; margin: 0;
  background: var(--brand-softer); border-radius: 12px; padding: 6px 10px; text-align: center; letter-spacing: 0.06em;
}

.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat.drop { outline: 3px dashed var(--brand); outline-offset: -10px; border-radius: 24px; }
.messages {
  flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg { max-width: min(640px, 82%); align-self: flex-start; animation: pop 0.18s ease-out; }
.msg.mine { align-self: flex-end; }
.msg .meta { font-size: 0.72em; color: var(--muted); display: flex; gap: 8px; align-items: center; padding: 0 6px 2px; }
.msg .name { font-weight: 700; color: var(--brand-strong); }
.msg.mine .meta { justify-content: flex-end; }
.msg .body {
  background: var(--panel);
  border-radius: var(--radius);
  border-top-left-radius: 6px;
  padding: 9px 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
}
.msg.mine .body {
  background: var(--mine); color: var(--mine-text);
  border-top-left-radius: var(--radius); border-top-right-radius: 6px;
}
.msg.mine .file-name { color: #fff; }
@keyframes pop { from { transform: translateY(6px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .msg { animation: none; } }

.file { display: flex; flex-direction: column; gap: 8px; }
.file .preview { max-width: 100%; max-height: 320px; border-radius: 14px; }
.file-name { color: var(--brand-strong); overflow-wrap: anywhere; font-weight: 600; }
.notice {
  align-self: center; font-size: 0.75em; color: var(--muted);
  background: var(--panel); padding: 2px 12px; border-radius: 999px;
}
.receipt { color: var(--brand); font-weight: 700; cursor: default; }
.tag { font-size: 0.95em; padding: 0 8px; border-radius: 999px; background: var(--pink-soft); color: var(--danger); font-weight: 600; }

.join-banner {
  margin: 12px 18px 0; padding: 12px 16px;
  background: var(--brand-soft); border-radius: var(--radius);
}
.join-banner p { margin: 0; }
.join-banner b { font-family: ui-monospace, monospace; letter-spacing: 0.06em; color: var(--brand-strong); }

.requests {
  margin: 12px 18px 0; padding: 12px 16px;
  background: var(--pink-soft); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 10px;
  max-height: 40vh; overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.request-card { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.request-card + .request-card { border-top: 2px dashed rgb(255 143 171 / 0.35); padding-top: 10px; }
.request-head { flex: 1 1 260px; display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.request-head span:first-child { font-weight: 700; }
.request-head span:first-child::before { content: "🔔 "; }
.request-card code { font-family: ui-monospace, monospace; }
.request-reply { flex: 1 1 100%; }
.request-reply input { font-size: 0.95em; padding: 7px 14px; }

.unread-divider {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.72em; color: var(--pink); font-weight: 700;
}
.unread-divider::before, .unread-divider::after { content: ""; flex: 1; border-top: 2px dotted var(--pink); }

.composer {
  display: flex; gap: 8px; align-items: flex-end;
  margin: 0 18px 14px; padding: 8px;
  background: var(--panel); border-radius: 28px; box-shadow: var(--shadow);
}
.composer textarea { flex: 1; resize: none; max-height: 160px; min-width: 0; border: none; box-shadow: none; }
.composer textarea:focus { box-shadow: none; }
.composer button { padding: 9px 20px; }
.file-btn {
  cursor: pointer; font-size: 1.15em; width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 50%; background: var(--brand-softer);
  transition: background 0.12s ease;
}
.file-btn:hover { background: var(--brand-soft); }

.videos { margin: 12px 18px 0; padding: 12px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.video-tools { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.tile { position: relative; background: #0b2b2b; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 9; }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .label {
  position: absolute; left: 8px; bottom: 8px; color: #fff; font-size: 0.78em;
  background: rgb(0 0 0 / 0.35); padding: 1px 10px; border-radius: 999px;
}

dialog {
  border: none; border-radius: 26px; background: var(--panel); color: var(--text);
  padding: 28px; box-shadow: 0 12px 40px rgb(14 149 148 / 0.25);
}
dialog form { display: flex; flex-direction: column; gap: 14px; min-width: 270px; }
dialog h2 { margin: 0; font-size: 1.15em; color: var(--brand-strong); }
dialog::backdrop { background: rgb(14 60 60 / 0.35); backdrop-filter: blur(3px); }

[hidden] { display: none !important; }

@media (max-width: 720px) {
  .sidebar { display: none; }
  .actions button:not(.primary) { display: none; }
  .msg { max-width: 90%; }
  .messages { padding: 14px; }
  .composer, .requests, .join-banner, .videos { margin-left: 10px; margin-right: 10px; }
  .home-card { padding: 32px 22px 24px; }
}
