/* TriniChat — mobile-first styles. Flag palette: red, black, white. */

:root {
  --red: #ce1126;
  --red-strong: #a90d1f;
  --black: #111111;
  --bg: #f6f3f0;
  --surface: #ffffff;
  --surface-2: #f1edea;
  --border: #e6e0db;
  --text: #16181a;
  --muted: #6b6f74;
  --chat-bg: #efe9e4;
  --bubble-in: #ffffff;
  --bubble-out: #ffe1e3;
  --bubble-out-text: #1b0d0f;
  --seen: #1d8cf0;
  --online: #1fa855;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1112;
    --surface: #17191b;
    --surface-2: #202326;
    --border: #2a2d31;
    --text: #eceef0;
    --muted: #9aa0a6;
    --chat-bg: #0c0d0e;
    --bubble-in: #1f2225;
    --bubble-out: #5a1720;
    --bubble-out-text: #fbecee;
    --seen: #53b6ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--red);
}

svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  flex: none;
}

.muted {
  color: var(--muted);
}

/* ---------- Boot ---------- */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.boot img {
  width: 72px;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    transform: scale(0.9);
    opacity: 0.7;
  }
}

/* ---------- Wordmark ---------- */

.wordmark {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wordmark span {
  color: var(--red);
}

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 600;
}

.btn.primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn.primary:active {
  background: var(--red-strong);
}

.btn.danger {
  color: var(--red);
}

.btn:disabled {
  opacity: 0.6;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  flex: none;
}

.icon-btn:hover {
  background: var(--surface-2);
}

.icon-btn.danger {
  color: var(--red);
}

.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--red);
  font-weight: 600;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

input:not([type='range']):not([type='file']),
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 16px; /* prevents iOS zoom on focus */
  font-weight: 400;
  outline: none;
}

input:focus-visible,
textarea:focus-visible {
  border-color: var(--red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 20%, transparent);
}

.stack {
  display: grid;
  gap: 12px;
}

.form-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--red);
  font-size: 14px;
}

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

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  vertical-align: 2px;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Auth ---------- */

.auth {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  padding: calc(40px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  background:
    linear-gradient(135deg, transparent 0 38%, #fff 38% 40%, var(--black) 40% 60%, #fff 60% 62%, transparent 62%) top right / 220px 220px no-repeat,
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  display: grid;
  gap: 18px;
  padding: 28px 22px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.brand-hero {
  text-align: center;
}

.hero-logo {
  width: 76px;
  height: 76px;
}

.brand-hero h1 {
  margin: 6px 0 4px;
  font-size: 34px;
}

.tagline {
  margin: 0;
  color: var(--muted);
}

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}

.seg button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-weight: 600;
  color: var(--muted);
}

.seg button[aria-selected='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.auth-form {
  display: grid;
  gap: 14px;
}

/* ---------- Layout ---------- */

.main {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  padding-top: var(--safe-top);
  min-width: 0;
}

.chat {
  display: none;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  position: relative;
  background: var(--chat-bg);
}

body.in-chat .sidebar {
  display: none;
}

body.in-chat .chat {
  display: flex;
}

@media (min-width: 768px) {
  .sidebar {
    width: 360px;
    flex: none;
    border-right: 1px solid var(--border);
  }

  body.in-chat .sidebar {
    display: flex;
  }

  .chat {
    display: flex;
  }

  .back {
    display: none !important;
  }
}

/* ---------- Sidebar ---------- */

.sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 6px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
}

.brand img {
  width: 34px;
  height: 34px;
}

.me-btn {
  border: 0;
  padding: 0;
  background: none;
  border-radius: 50%;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
}

.tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 18px;
  background: var(--surface-2);
  font-weight: 600;
  color: var(--muted);
}

.tabs button[aria-selected='true'] {
  background: var(--black);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .tabs button[aria-selected='true'] {
    background: var(--red);
  }
}

.search {
  position: relative;
  display: block;
  margin: 6px 12px 8px;
}

.search > span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: flex;
}

.search svg {
  width: 20px;
  height: 20px;
}

.search input {
  min-height: 40px !important;
  padding-left: 40px !important;
  border-radius: 20px !important;
  background: var(--surface-2) !important;
  border-color: transparent !important;
}

.net-banner {
  margin: 0 12px 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff4d6;
  color: #6b4f00;
  font-size: 13px;
  text-align: center;
}

.list {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 0 0 calc(12px + var(--safe-bottom));
  list-style: none;
}

.list-empty {
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
}

.conv-item:hover {
  background: var(--surface-2);
}

.conv-item.active {
  background: color-mix(in srgb, var(--red) 9%, var(--surface));
}

.ci-body {
  flex: 1;
  min-width: 0;
  padding-bottom: 10px;
  margin-bottom: -10px;
  border-bottom: 1px solid var(--border);
}

.ci-top,
.ci-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ci-name {
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ci-time {
  flex: none;
  font-size: 12px;
  color: var(--muted);
}

.has-unread .ci-time {
  color: var(--red);
  font-weight: 600;
}

.preview {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.has-unread .preview {
  color: var(--text);
}

.typing-text,
.online-text {
  color: var(--online) !important;
  font-weight: 500;
}

/* ---------- Avatars ---------- */

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  user-select: none;
}

.avatar.sm {
  width: 38px;
  height: 38px;
  font-size: 14px;
}

.avatar.lg {
  width: 72px;
  height: 72px;
  font-size: 26px;
}

.avatar .dot {
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--surface);
}

/* ---------- Chat pane ---------- */

.chat-empty {
  margin: auto;
  max-width: 320px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.chat-empty img {
  width: 96px;
  opacity: 0.9;
}

.chat-empty h2 {
  margin: 12px 0 6px;
  color: var(--text);
}

.chat-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  position: relative;
}

.chat-pane.dragging::after {
  content: 'Drop to send';
  position: absolute;
  inset: 8px;
  display: grid;
  place-items: center;
  border: 3px dashed var(--red);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  font-size: 20px;
  font-weight: 700;
  color: var(--red);
  z-index: 5;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + var(--safe-top)) 12px 8px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 2;
}

@media (min-width: 768px) {
  .chat-head {
    padding-left: 16px;
  }
}

.chat-head .avatar {
  width: 40px;
  height: 40px;
  font-size: 15px;
}

.chat-title {
  min-width: 0;
}

.chat-name {
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-status {
  font-size: 13px;
  color: var(--muted);
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--red) 4%, transparent) 0 2px, transparent 2px 26px);
}

@media (min-width: 768px) {
  .messages {
    padding: 14px 6%;
  }
}

.chat-intro {
  align-self: center;
  max-width: 340px;
  margin: 8px 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, #fff3c4 85%, var(--chat-bg));
  color: #5c4a00;
  font-size: 12.5px;
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  .chat-intro {
    background: #2b2614;
    color: #e7d58f;
  }
}

.day-sep {
  align-self: center;
  margin: 10px 0 6px;
  position: sticky;
  top: 4px;
  z-index: 1;
}

.day-sep span {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.loading {
  display: grid;
  place-items: center;
  padding: 24px;
}

.loading.older {
  padding: 10px;
}

.spinner {
  width: 22px;
  height: 22px;
  flex: none;
  border: 3px solid color-mix(in srgb, var(--red) 25%, transparent);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Message bubbles ---------- */

.msg {
  display: flex;
  flex-direction: column;
  max-width: min(78%, 520px);
  animation: pop 0.14s ease-out;
}

@keyframes pop {
  from {
    transform: translateY(4px);
    opacity: 0;
  }
}

.msg.in {
  align-self: flex-start;
}

.msg.out {
  align-self: flex-end;
  align-items: flex-end;
}

.msg + .msg {
  margin-top: 2px;
}

.msg.in + .msg.out,
.msg.out + .msg.in {
  margin-top: 8px;
}

.bubble {
  position: relative;
  padding: 6px 9px 6px 10px;
  border-radius: 12px;
  background: var(--bubble-in);
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-touch-callout: none;
}

.msg.out .bubble {
  background: var(--bubble-out);
  color: var(--bubble-out-text);
}

.msg.in .bubble {
  border-top-left-radius: 4px;
}

.msg.out .bubble {
  border-top-right-radius: 4px;
}

.text {
  display: inline;
  white-space: pre-wrap;
}

.text a {
  color: inherit;
  text-decoration: underline;
}

/* Time + ticks float bottom-right, text wraps around them. */
.meta {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 8px 0 -4px 10px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1;
  white-space: nowrap;
}

.msg.out .meta {
  color: color-mix(in srgb, var(--bubble-out-text) 55%, transparent);
}

.tick {
  display: inline-flex;
}

.tick svg {
  width: 16px;
  height: 16px;
}

.tick.seen {
  color: var(--seen);
}

.tick.failed {
  color: var(--red);
}

.big-emoji {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 2px;
}

.big-emoji .meta {
  float: none;
  display: flex;
  justify-content: flex-end;
  margin: 2px 0 0;
}

.big-emoji .text {
  font-size: 44px;
  line-height: 1.15;
}

.deleted {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-style: italic;
  color: var(--muted);
}

.deleted svg {
  width: 16px;
  height: 16px;
}

.retry {
  margin-top: 3px;
  border: 0;
  background: none;
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Attachments ---------- */

.attachment {
  display: grid;
  gap: 3px;
  margin: -2px -5px 2px -6px;
}

.attachment + .text {
  display: block;
  margin-top: 4px;
}

.media-img {
  display: block;
  max-width: min(280px, 66vw);
  max-height: 340px;
  min-width: 120px;
  min-height: 80px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--surface-2);
  cursor: zoom-in;
}

.media-video {
  display: block;
  max-width: min(300px, 70vw);
  max-height: 360px;
  border-radius: 9px;
  background: #000;
}

.expiry {
  padding: 0 6px;
  font-size: 11px;
  color: var(--muted);
}

.msg.out .expiry {
  color: color-mix(in srgb, var(--bubble-out-text) 55%, transparent);
}

.file,
.uploading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: 300px;
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: inherit;
  text-decoration: none;
}

.file.expired {
  opacity: 0.65;
}

.file-icon,
.file-dl {
  display: flex;
  color: var(--red);
}

.file-dl {
  color: var(--muted);
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 12px;
  color: var(--muted);
}

.progress {
  height: 4px;
  margin-top: 6px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--text) 12%, transparent);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  background: var(--red);
  transition: width 0.15s;
}

/* Audio / voice notes */
.audio {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 230px;
  padding: 4px 4px 0;
}

.ap-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
}

.ap-track {
  flex: 1;
  display: grid;
  gap: 2px;
}

.ap-bar {
  --p: 0%;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.ap-bar::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--red) var(--p), color-mix(in srgb, var(--text) 18%, transparent) var(--p));
}

.ap-bar::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--red) var(--p), color-mix(in srgb, var(--text) 18%, transparent) var(--p));
}

.ap-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--red);
  border: 0;
}

.ap-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  border: 0;
}

.ap-time {
  font-size: 11px;
  color: var(--muted);
}

.ap-speed {
  min-width: 38px;
  height: 26px;
  padding: 0 6px;
  border: 0;
  border-radius: 13px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* ---------- Composer ---------- */

.to-bottom {
  position: absolute;
  right: 14px;
  bottom: calc(80px + var(--safe-bottom));
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  z-index: 3;
}

.composer {
  padding: 6px 8px calc(8px + var(--safe-bottom));
  background: transparent;
}

.compose-row,
.record-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  padding: 2px 4px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.input-wrap textarea {
  flex: 1;
  min-height: 44px !important;
  max-height: 140px;
  padding: 11px 4px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  resize: none;
  line-height: 1.35;
}

.send-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--red) 40%, transparent);
  transition: transform 0.1s;
}

.send-btn:active {
  transform: scale(0.92);
}

.record-row {
  align-items: center;
  min-height: 48px;
  padding-left: 4px;
  border-radius: 24px;
}

.rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  animation: blink 1s infinite;
}

@keyframes blink {
  50% {
    opacity: 0.2;
  }
}

.rec-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.rec-label {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Emoji panel ---------- */

.emoji-panel {
  display: flex;
  flex-direction: column;
  height: min(300px, 42dvh);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.emoji-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.emoji-tabs button {
  flex: none;
  width: 40px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 20px;
  opacity: 0.6;
}

.emoji-tabs button[aria-selected='true'] {
  background: var(--surface-2);
  opacity: 1;
}

.emoji-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  align-content: start;
  padding: 6px;
}

.emoji {
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 26px;
}

.emoji:hover {
  background: var(--surface-2);
}

/* ---------- Sheets & overlays ---------- */

dialog.sheet {
  width: 100%;
  max-width: 440px;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--text);
  overflow: auto;
  padding-bottom: var(--safe-bottom);
}

@media (min-width: 768px) {
  dialog.sheet {
    margin: auto;
    border-radius: 20px;
  }
}

dialog.sheet::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 10px 4px 20px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 18px;
}

.sheet-body {
  display: grid;
  gap: 18px;
  padding: 10px 20px 22px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
}

.card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
}

.card h3,
.card p {
  margin: 0;
}

dialog.actions {
  display: grid;
  padding: 8px 8px calc(8px + var(--safe-bottom));
}

.action {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: none;
  font-size: 16px;
  text-align: left;
}

.action:hover {
  background: var(--surface-2);
}

.action span {
  display: flex;
  color: var(--muted);
}

.action.danger,
.action.danger span {
  color: var(--red);
}

.action.cancel {
  justify-content: center;
  font-weight: 600;
  color: var(--muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.92);
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lb-bar {
  position: absolute;
  top: calc(10px + var(--safe-top));
  right: 10px;
  display: flex;
  gap: 6px;
}

.lb-bar .icon-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: #222;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Notifications ---------- */

.banner {
  position: fixed;
  top: calc(10px + var(--safe-top));
  left: 50%;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(420px, calc(100% - 20px));
  padding: 10px 14px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  border-left: 4px solid var(--red);
  opacity: 0;
  transform: translate(-50%, -24px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.banner-body {
  min-width: 0;
}

.banner-name {
  font-weight: 700;
}

.banner-text {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sound-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.sound-picker button {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.sound-picker button[aria-checked='true'] {
  border-color: var(--red);
  color: var(--text);
}

.sound-emoji {
  font-size: 22px;
}

.notif-status {
  font-size: 13px;
}

/* ---------- Landing content (under the sign-in card) ---------- */

.landing {
  width: 100%;
  max-width: 760px;
  display: grid;
  gap: 32px;
}

.landing h2 {
  margin: 0 0 10px;
  font-size: 24px;
  letter-spacing: -0.01em;
}

.intro {
  text-align: center;
}

.intro p {
  margin: 0 auto;
  max-width: 600px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-grid li {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.feature-grid span {
  font-size: 26px;
}

.feature-grid h3 {
  margin: 6px 0 4px;
  font-size: 16px;
}

.feature-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.faq details {
  padding: 4px 16px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.faq summary {
  padding: 10px 0;
  font-weight: 600;
  cursor: pointer;
}

.faq details p {
  margin: 0 0 12px;
  color: var(--muted);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  padding: 8px 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
}

/* ---------- Privacy, terms and 404 pages ---------- */

.doc-page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.doc-header .brand {
  color: var(--text);
  text-decoration: none;
}

.doc-header .btn {
  min-height: 40px;
  text-decoration: none;
}

.doc {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 18px 40px;
  line-height: 1.65;
  font-size: 16px;
}

.doc h1 {
  margin: 8px 0 4px;
  font-size: 30px;
  letter-spacing: -0.02em;
}

.doc h2 {
  margin: 28px 0 6px;
  font-size: 19px;
}

.doc ul {
  padding-left: 22px;
}

.doc li {
  margin-bottom: 6px;
}

.not-found {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
}

.not-found img {
  width: 88px;
}

.not-found .btn {
  text-decoration: none;
}
