:root {
  --bg: #f8f1f7;
  --panel: #fffafd;
  --panel-2: #fdf3f8;
  --ink: #2c2330;
  --muted: #8a7c8f;
  --line: #ead9e7;
  --accent: #d94f8a;
  --accent-ink: #fff7fb;
  --teal: #4fae9f;
  --shadow: 0 14px 36px rgba(69, 30, 60, 0.10);
  --radius: 22px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16121a;
    --panel: #211a25;
    --panel-2: #271f2b;
    --ink: #f4eaf3;
    --muted: #a795ab;
    --line: #392c3c;
    --accent: #ff7eb0;
    --accent-ink: #251019;
    --teal: #7fd8cd;
    --shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI Variable", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(217, 79, 138, 0.13), transparent 62%),
    radial-gradient(900px 480px at 98% 6%, rgba(79, 174, 159, 0.12), transparent 60%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* login */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px max(18px, env(safe-area-inset-left)) 24px max(18px, env(safe-area-inset-right));
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 30px 26px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.login-card h1 { margin: 2px 0 0; font-size: 30px; letter-spacing: -0.02em; }
.login-card p { margin: 0; line-height: 1.45; }
.mark { color: var(--accent); display: flex; justify-content: center; }
.mark svg { width: 54px; height: 54px; }
.mark svg path { stroke-linecap: round; }
input[type="password"] {
  width: 100%;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  outline: none;
}
input[type="password"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.muted { color: var(--muted); font-size: 14.5px; }
.error { color: #b0265b; min-height: 1.2em; font-size: 14px; }
@media (prefers-color-scheme: dark) { .error { color: #ff9fc2; } }

/* header */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 12px max(18px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.status { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--teal); }
.dot.warn { background: #e3a03c; }
.dot.bad { background: #d33d6f; }
.dot.off { background: #9c8fa1; }

/* layout */

main {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-left)) calc(40px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* composer */

.composer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 17.5px;
  line-height: 1.45;
  padding: 4px 2px;
  outline: none;
}
textarea::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }

.preview-wrap { position: relative; width: fit-content; }
.preview-wrap img {
  display: block;
  max-width: min(240px, 100%);
  max-height: 200px;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.drop {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.actions { display: flex; align-items: center; gap: 9px; }
.spacer { flex: 1; }

button, .round {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.round {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
}
.round svg { width: 22px; height: 22px; }
.round:active { transform: scale(0.96); }
.round.ghost { width: 38px; height: 38px; background: transparent; }
.round.ghost svg { width: 19px; height: 19px; }

.primary {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 16px;
  padding: 12px 24px;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 32%, transparent);
}
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: 0.55; }
.wide { width: 100%; padding: 14px 20px; }

.hint { margin: 0; font-size: 13px; color: var(--muted); }

/* feed */

.feed { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  display: block;
  animation: rise 0.22s ease-out both;
}
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.card .body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card .text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16.5px; line-height: 1.45; }
.card .meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; letter-spacing: 0.02em; }
.card .thumb {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 13px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  background: var(--panel-2);
}
.card .thumb.tall { max-height: 440px; object-fit: contain; background: var(--panel-2); }
.pill { border-radius: 999px; padding: 2px 8px; background: var(--panel-2); border: 1px solid var(--line); }
.pill.pending { color: #a2701f; border-color: #e8cb96; background: #fbf2de; }
@media (prefers-color-scheme: dark) { .pill.pending { color: #f0c579; background: #332818; border-color: #5b472c; } }
.card .delete {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 8px;
}
.card .delete:hover { color: var(--accent); }

.empty { text-align: center; color: var(--muted); font-size: 14.5px; padding: 16px 10px 30px; }

/* viewer */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(12, 8, 14, 0.94);
  display: grid;
  place-items: center;
  padding: 20px;
}
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer button { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; background: rgba(255, 255, 255, 0.14); color: #fff; border-color: rgba(255, 255, 255, 0.25); font-size: 22px; }

@media (max-width: 420px) {
  main { padding-top: 14px; }
  .brand span { display: none; }
}
