* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #111318;
  --panel: #1a1d24;
  --border: #2a2e38;
  --text: #e8eaee;
  --muted: #8a919e;
  --accent: #e63946;
  --ok: #2fbf71;
  --err: #ff5a5f;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand { font-size: 14px; letter-spacing: 2px; color: var(--muted); }
.brand b { color: var(--text); font-weight: 700; }

.who {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}
.who:hover { color: var(--text); border-color: var(--muted); }

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 10px;
  min-height: 0;
}

textarea {
  flex: 1;
  min-height: 120px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  font-family: inherit;
  line-height: 1.45;
  resize: none;
  outline: none;
}
textarea:focus { border-color: var(--muted); }
textarea::placeholder { color: var(--muted); opacity: 0.7; }

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.thumbs:empty { display: none; }

.thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .doc {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--muted); text-align: center; padding: 4px;
  word-break: break-all; overflow: hidden;
}
.thumb .rm {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  cursor: pointer;
  padding: 0;
}

.actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

button {
  font-family: inherit;
  font-size: 15px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  padding: 13px 18px;
}

#send {
  flex: 1;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
#send:disabled { opacity: 0.5; cursor: default; }

.ghost {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
}
.ghost:hover { color: var(--text); }

.status {
  min-height: 20px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  flex-shrink: 0;
}
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.status a { color: inherit; }

#drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(230, 57, 70, 0.15);
  border: 3px dashed var(--accent);
  border-radius: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  z-index: 50;
  pointer-events: none;
}
body.dragging #drop-overlay { display: flex; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal[hidden] { display: none; }

.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-card h2 { font-size: 18px; }
.modal-card p { font-size: 13px; color: var(--muted); }
.modal-card input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px;
  font-size: 16px;
  outline: none;
}
.modal-card button { background: var(--accent); color: #fff; font-weight: 700; }
