:root {
  --amber: #f5b942;
  --amber-dark: #d99a1f;
  --bg: #fff8ec;
  --card: #ffffff;
  --text: #3a2e1a;
  --muted: #8a7a5f;
  --danger: #d64545;
  --green: #3d9970;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
.hidden { display: none !important; }
.screen { min-height: 100vh; display: flex; flex-direction: column; }
.card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(90, 60, 0, 0.12);
  padding: 14px 16px;
  margin: 10px;
}
.logo { text-align: center; color: var(--amber-dark); margin: 18px 0 4px; }
.logo.small { font-size: 1.1rem; margin: 0; text-align: left; }
.whoami { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.subtitle { text-align: center; color: var(--muted); margin: 0 0 16px; }
.auth-card { max-width: 420px; margin: 8vh auto; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { flex: 1; padding: 10px; border: 1px solid #e8d9b8; background: #fff; border-radius: 10px; cursor: pointer; }
.tab.active { background: var(--amber); border-color: var(--amber-dark); font-weight: 600; }
label { display: block; margin-bottom: 10px; font-size: 0.9rem; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="time"], textarea {
  width: 100%; padding: 10px; margin-top: 4px; border: 1px solid #e0d0a8; border-radius: 10px;
  font-size: 1rem; font-family: inherit; background: #fffdf7; color: var(--text);
}
textarea { resize: vertical; }
.btn {
  border: none; border-radius: 10px; padding: 10px 16px; font-size: 1rem; cursor: pointer;
  font-family: inherit;
}
.btn.primary { background: var(--amber); color: #3a2e1a; font-weight: 600; }
.btn.primary:hover { background: var(--amber-dark); }
.btn.danger { background: var(--danger); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; border: 1px solid #e0d0a8; color: var(--text); }
.btn.icon { background: transparent; font-size: 1.3rem; padding: 6px 10px; }
.btn.checkin { background: var(--green); color: #fff; font-weight: 700; font-size: 1.05rem; }
.error { color: var(--danger); min-height: 1.2em; font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.82rem; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; background: var(--card); box-shadow: 0 1px 4px rgba(90,60,0,0.12);
  position: sticky; top: 0; z-index: 5; flex-wrap: wrap;
}
.clocks { display: flex; gap: 14px; }
.clock { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.clock .city { font-size: 0.72rem; color: var(--muted); }
.clock .time { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.topbar-actions { display: flex; gap: 6px; }
.statusbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.status-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.checkin-status { font-size: 0.85rem; color: var(--muted); max-width: 46vw; }
#invite-box code {
  display: inline-block; background: #fff3d6; border: 1px dashed var(--amber-dark);
  padding: 6px 10px; border-radius: 8px; margin: 6px 8px 6px 0; font-size: 1rem;
}
.reminder-card { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.9rem; }
.reminder-card input { width: auto; }
.messages {
  flex: 1; overflow-y: auto; padding: 6px 10px 12px; display: flex; flex-direction: column; gap: 8px;
}
.msg {
  position: relative;
  max-width: 78%; padding: 9px 12px; border-radius: 14px; background: #fff;
  box-shadow: 0 1px 3px rgba(90,60,0,0.1); align-self: flex-start;
}
.msg.mine { align-self: flex-end; background: #ffe9b8; }
.msg.photo { max-width: min(78%, 460px); }
.msg .meta { font-size: 0.72rem; color: var(--muted); margin-bottom: 3px; }
.msg .text { white-space: pre-wrap; word-break: break-word; }
.msg img { max-width: 100%; max-height: 55vh; width: auto; object-fit: contain; border-radius: 10px; display: block; margin-top: 4px; cursor: zoom-in; }
.msg .dl { display: inline-block; margin-top: 6px; font-size: 0.8rem; color: var(--amber-dark); font-weight: 600; text-decoration: none; }
.msg .del {
  display: none; position: absolute; top: 4px; right: 6px; border: none; cursor: pointer;
  background: rgba(255,255,255,0.9); border-radius: 8px; font-size: 0.85rem; padding: 2px 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.msg.mine .del { right: auto; left: 6px; }
.msg:hover .del { display: block; }
.composer {
  display: flex; gap: 8px; align-items: flex-end; padding: 10px;
  background: var(--card); border-top: 1px solid #f0e2c4; position: sticky; bottom: 0;
}
.composer textarea { flex: 1; }
.modal {
  position: fixed; inset: 0; background: rgba(30, 20, 5, 0.75); z-index: 20;
  display: flex; align-items: center; justify-content: center;
}
.call-card { width: min(94vw, 560px); text-align: center; position: relative; }
#call-state-label { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
#remote-video { width: 100%; border-radius: 10px; background: #000; min-height: 200px; }
#local-video {
  position: absolute; right: 22px; top: 60px; width: 26%; border-radius: 8px;
  border: 2px solid #fff; background: #222;
}
.call-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: #3a2e1a; color: #fff; padding: 10px 18px; border-radius: 20px; z-index: 30;
  font-size: 0.9rem; max-width: 90vw; text-align: center;
}
@media (max-width: 560px) {
  .checkin-status { max-width: 100%; }
  .msg { max-width: 88%; }
  .clock .time { font-size: 0.95rem; }
}
