/* iamurph v3 — HomeView calling styles (v3.2).
 * Standalone stylesheet for homeview-call.html; also loaded by index.html
 * so the HomeView Call mini-app looks the same in the Apps hub.
 * Design constraints: 1088x1088 square HomeView screen AND a 448x364
 * short viewport. Big touch targets (>=48px), no fixed headers/footers
 * eating the screen, no horizontal overflow at either size. */
:root {
  --wc-bg: #0b0b10;
  --wc-card: #171724;
  --wc-card-2: #1e1e2e;
  --wc-text: #f2f2f7;
  --wc-muted: #9a9aad;
  --wc-accent: #7c5cff;
  --wc-accent-2: #4fd1c5;
  --wc-danger: #ff5c5c;
  --wc-warn: #ffb020;
  --wc-line: rgba(255, 255, 255, 0.09);
  --wc-radius: 16px;
}

.wc-page {
  background: var(--wc-bg);
  color: var(--wc-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
  min-height: 100dvh;
}
.wc-shell { max-width: 720px; margin: 0 auto; padding: 12px calc(16px + env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px)); }
.wc-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) 10px calc(16px + env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--wc-line);
  max-width: 720px; margin: 0 auto;
}
.wc-topbar a { color: var(--wc-accent-2); text-decoration: none; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.wc-topbar span { font-weight: 700; }

.wc-lobby, .wc-call { display: flex; flex-direction: column; gap: 12px; }
.wc-title { margin: 4px 0 0; font-size: 22px; }
.wc-h { margin: 6px 0 0; font-size: 17px; }
.wc-note { color: var(--wc-muted); font-size: 14px; margin: 0; }
.wc-empty { color: var(--wc-muted); text-align: center; padding: 16px 0; }
.wc-warn { color: var(--wc-warn); font-weight: 600; margin: 0; }
.wc-error { color: var(--wc-danger); font-weight: 600; margin: 0; }
.wc-error:empty { display: none; }

/* ---- Gate banner ---- */
.wc-gate {
  border: 1px solid var(--wc-line); border-radius: var(--wc-radius);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: var(--wc-card);
}
.wc-gate-untested { border-color: rgba(255, 176, 32, 0.55); }
.wc-gate-pass { border-color: rgba(79, 209, 197, 0.55); }
.wc-gate-blocked { border-color: rgba(255, 92, 92, 0.55); }
.wc-gate-text { margin: 0; font-weight: 700; font-size: 16px; }
.wc-test-note { margin: 0; }
.wc-override { font-size: 14px; }
.wc-override summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--wc-muted); }

/* ---- Buttons / inputs: >=48px touch targets ---- */
.wc-btn {
  appearance: none; border: 1px solid var(--wc-line); background: var(--wc-card-2);
  color: var(--wc-text); font: inherit; font-size: 15px; font-weight: 600;
  padding: 12px 18px; border-radius: 999px; cursor: pointer;
  min-height: 48px; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; text-decoration: none; text-align: center;
}
.wc-btn:hover { background: #262640; }
.wc-btn:active { transform: scale(0.97); }
.wc-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.wc-btn-primary { background: var(--wc-accent); border-color: var(--wc-accent); color: #fff; }
.wc-btn-primary:hover { background: #8d70ff; }
.wc-btn-danger { border-color: var(--wc-danger); color: var(--wc-danger); }
.wc-btn-danger:hover { background: rgba(255, 92, 92, 0.12); }
.wc-btn-big { flex: 1 1 140px; padding: 14px 18px; font-size: 16px; }
.wc-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.wc-input {
  width: 100%; font: inherit; color: var(--wc-text); background: #12121a;
  border: 1px solid var(--wc-line); border-radius: 10px; padding: 12px;
  min-height: 48px; outline: none; box-sizing: border-box;
}
.wc-input:focus { border-color: var(--wc-accent); }
.wc-form { display: flex; flex-direction: column; gap: 10px; }
.wc-form .wc-btn { align-self: flex-start; }

/* ---- Directory ---- */
.wc-dir { display: flex; flex-direction: column; gap: 10px; }
.wc-contact {
  display: flex; align-items: center; gap: 12px;
  background: var(--wc-card); border: 1px solid var(--wc-line);
  border-radius: var(--wc-radius); padding: 12px 14px;
}
.wc-contact-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.wc-contact-name { font-weight: 700; font-size: 16px; }
.wc-contact-handle, .wc-contact-id, .wc-presence { color: var(--wc-muted); font-size: 13px; }
.wc-contact .wc-btn { flex: none; }
.wc-choices {
  background: var(--wc-card); border: 1px solid var(--wc-accent);
  border-radius: var(--wc-radius); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}

/* ---- Cards (FaceTime, control surface, fallbacks) ---- */
.wc-card {
  background: var(--wc-card); border: 1px solid var(--wc-line);
  border-radius: var(--wc-radius); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.wc-control-state { font-weight: 700; margin: 0; }

/* ---- Call screen ---- */
.wc-state { font-weight: 700; font-size: 17px; margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--wc-card); border: 1px solid var(--wc-line); }
.wc-state-connecting { border-color: rgba(255, 176, 32, 0.55); color: var(--wc-warn); }
.wc-state-connected { border-color: rgba(79, 209, 197, 0.55); color: var(--wc-accent-2); }
.wc-state-failed { border-color: rgba(255, 92, 92, 0.55); color: var(--wc-danger); }
.wc-timer { font-size: 28px; font-weight: 700; margin: 0; text-align: center; font-variant-numeric: tabular-nums; }
.wc-videos { display: flex; gap: 10px; flex-wrap: wrap; }
.wc-remote-vid {
  width: 100%; max-width: 560px; aspect-ratio: 16 / 9; background: #000;
  border: 1px solid var(--wc-line); border-radius: var(--wc-radius);
}
.wc-local-vid {
  width: 100%; max-width: 200px; aspect-ratio: 4 / 3; background: #000;
  border: 1px solid var(--wc-line); border-radius: var(--wc-radius);
}
.wc-novideo {
  background: var(--wc-card); border: 1px dashed var(--wc-line);
  border-radius: var(--wc-radius); padding: 16px; text-align: center;
  color: var(--wc-muted); margin: 0;
}
.wc-controls { margin-top: 4px; }
.wc-chat { display: flex; flex-direction: column; gap: 8px; }
.wc-chat-log {
  background: var(--wc-card); border: 1px solid var(--wc-line);
  border-radius: var(--wc-radius); padding: 12px;
  max-height: 180px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.wc-chat-line { font-size: 15px; word-break: break-word; }
.wc-fallbacks { border-color: rgba(255, 176, 32, 0.4); }

/* ---- Incoming call bar ---- */
.wc-incoming {
  position: fixed; left: calc(16px + env(safe-area-inset-left, 0px)); right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 55;
  background: var(--wc-card); border: 1px solid var(--wc-accent);
  border-radius: var(--wc-radius); padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 560px; margin: 0 auto;
}

/* ---- Short viewport (HomeView 448x364 test size): compact, nothing clipped ---- */
@media (max-height: 420px) {
  .wc-shell { padding: 8px calc(12px + env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px)); }
  .wc-title { font-size: 18px; }
  .wc-timer { font-size: 20px; }
  .wc-remote-vid { max-width: 46%; aspect-ratio: 4 / 3; }
  .wc-local-vid { max-width: 120px; }
  .wc-videos { flex-wrap: nowrap; }
  .wc-chat-log { max-height: 90px; }
  .wc-gate { padding: 10px; gap: 6px; }
  .wc-note { font-size: 13px; }
}
@media (max-width: 480px) {
  .wc-remote-vid { aspect-ratio: 4 / 3; }
  .wc-local-vid { max-width: 140px; }
}
