:root {
  --bg: #0b141a;
  --panel: #111b21;
  --bar: #202c33;
  --bubble-me: #005c4b;
  --bubble-you: #202c33;
  --text: #e9edef;
  --muted: #8696a0;
  --accent: #00a884;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: #f6f6f0; /* notebook (default) ka halka background */
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.screen { height: 100dvh; display: flex; flex-direction: column; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Notebook (disguise) ---------- */
#notebook { background: #f6f6f0; color: #1c1c1e; }
.nb-bar {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 16px 18px 8px; padding-top: max(16px, env(safe-area-inset-top));
}
.nb-title { font-size: 28px; font-weight: 700; color: #1c1c1e; }
.nb-date { font-size: 13px; color: #9b9b9f; }
.nb-pad {
  flex: 1; width: 100%; border: none; outline: none; resize: none;
  background: #f6f6f0; color: #1c1c1e;
  font-size: 17px; line-height: 1.6; padding: 6px 18px 18px;
  font-family: ui-serif, Georgia, "Times New Roman", serif;
}
.nb-pad::placeholder { color: #c4c4c8; }

/* ---------- Setup screen ---------- */
#setup { align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.setup-box { width: 100%; max-width: 340px; text-align: center; }
.setup-box h1 { font-size: 56px; margin: 0 0 8px; }
.setup-box p { font-size: 14px; line-height: 1.5; }
.setup-box input {
  width: 100%; margin: 16px 0 12px; padding: 14px 16px;
  border: none; border-radius: 10px; background: var(--panel);
  color: var(--text); font-size: 16px; outline: none;
}
.setup-box button {
  width: 100%; padding: 14px; border: none; border-radius: 10px;
  background: var(--accent); color: #04221c; font-size: 16px; font-weight: 600;
}
.hint { font-size: 12px; margin-top: 12px; min-height: 16px; }

/* ---------- Chat screen ---------- */
#chat { background: var(--bg); }
.bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bar); padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
}
.title { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.on { background: #06d6a0; }
.dot.off { background: #6b7a82; }
.actions { display: flex; gap: 6px; }
.actions button {
  background: transparent; border: none; color: var(--text);
  font-size: 20px; padding: 6px 8px; border-radius: 8px;
}

.messages {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 6px; background: var(--bg);
}
.msg {
  max-width: 78%; padding: 7px 11px; border-radius: 10px;
  font-size: 15px; line-height: 1.35; word-wrap: break-word; white-space: pre-wrap; color: var(--text);
}
.msg.me { align-self: flex-end; background: var(--bubble-me); border-bottom-right-radius: 2px; }
.msg.you { align-self: flex-start; background: var(--bubble-you); border-bottom-left-radius: 2px; }
.msg .time { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; text-align: right; }
.sys { align-self: center; font-size: 12px; color: var(--muted); padding: 4px 0; }

/* typing indicator bubble */
.typing { align-self: flex-start; background: var(--bubble-you); padding: 9px 13px; border-radius: 10px; }
.typing span {
  display: inline-block; width: 6px; height: 6px; margin: 0 1px; border-radius: 50%;
  background: var(--muted); animation: blink 1.3s infinite both;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.composer {
  display: flex; gap: 8px; padding: 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--bar);
}
.composer input {
  flex: 1; padding: 12px 16px; border: none; border-radius: 22px;
  background: var(--panel); color: var(--text); font-size: 16px; outline: none;
}
.composer button {
  width: 46px; border: none; border-radius: 50%;
  background: var(--accent); color: #04221c; font-size: 18px;
}

/* ---------- Call overlay ---------- */
.call {
  position: fixed; inset: 0; background: #000; z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
#remoteVideo { width: 100%; height: 100%; object-fit: cover; background: #000; }
.voice-face {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 90px; background: #0b141a;
}
#localVideo {
  position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px;
  width: 96px; height: 140px; object-fit: cover; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.3); background: #111;
}
.call-stats {
  position: absolute; top: max(8px, env(safe-area-inset-top)); left: 8px;
  font-size: 11px; color: #9ff0d0; background: rgba(0,0,0,.5);
  padding: 5px 8px; border-radius: 6px; font-family: ui-monospace, monospace;
  max-width: 72%; line-height: 1.4; z-index: 60; white-space: pre-line;
}
.call-label {
  position: absolute; top: 38%; left: 0; right: 0; text-align: center;
  font-size: 18px; color: #e9edef; text-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.call-controls {
  position: absolute; bottom: max(28px, env(safe-area-inset-bottom)); left: 0; right: 0;
  display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap;
}
.call-controls button { border: none; border-radius: 30px; font-size: 16px; font-weight: 600; }
.ctl { width: 56px; height: 56px; border-radius: 50%; font-size: 22px; background: rgba(255,255,255,0.18); color: #fff; }
.ctl.active { background: #fff; color: #111; }
.accept { background: #06d6a0; color: #04221c; padding: 14px 26px; }
.hangup { background: #ef476f; color: #fff; width: 56px; height: 56px; border-radius: 50%; font-size: 14px; }
