/* ============================================================
   20minuteswithmitch.com — Google-Meet-flavored gag site
   ============================================================ */

:root {
  --bg: #202124;
  --bg-2: #17181a;
  --surface: #2d2e30;
  --text: #e8eaed;
  --text-dim: #9aa0a6;
  --accent: #8ab4f8;
  --accent-solid: #1a73e8;
  --danger: #ea4335;
  --danger-hi: #f28b82;
  --good: #34a853;
  --ctrl: rgba(255, 255, 255, 0.10);
  --ctrl-hi: rgba(255, 255, 255, 0.20);
  --chip: rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Google Sans", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---- screen visibility state machine ---- */
.screen { display: none; }
body.screen-lobby      #lobby      { display: flex; }
body.screen-connecting #connecting { display: flex; }
body.screen-call       #call       { display: flex; }
body.screen-end        #call       { display: flex; }   /* frozen call sits behind the overlay */
body.screen-end        #end        { display: flex; }

/* generic svg icon */
.icon { display: inline-flex; align-items: center; justify-content: center; }
.icon svg { width: 22px; height: 22px; fill: currentColor; display: block; }
.icon-sm svg { width: 15px; height: 15px; }

/* ============================================================
   LOBBY
   ============================================================ */
#lobby {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 20px 24px;
  text-align: center;
  background:
    radial-gradient(1200px 600px at 50% -10%, #303236 0%, var(--bg) 55%),
    var(--bg);
}

.lobby-inner {
  max-width: 720px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand {
  font-size: 14px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 28px;
}

.headline {
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.12;
  font-weight: 700;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.subhead {
  font-size: clamp(18px, 2.4vw, 22px);
  color: var(--text-dim);
  margin: 0 0 40px;
}

.connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  cursor: pointer;
  background: var(--accent-solid);
  color: #fff;
  font: inherit;
  font-size: clamp(16px, 2.2vw, 19px);
  font-weight: 600;
  padding: 16px 30px;
  border-radius: 999px;
  box-shadow: 0 6px 22px rgba(26, 115, 232, 0.45);
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.connect-btn:hover { background: #2b7de9; transform: translateY(-1px); box-shadow: 0 10px 28px rgba(26, 115, 232, 0.55); }
.connect-btn:active { transform: translateY(0); }
.connect-btn:disabled { opacity: 0.7; cursor: default; }

.cam-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.7);
  animation: camPulse 1.8s infinite;
}
@keyframes camPulse {
  0%   { box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.65); }
  70%  { box-shadow: 0 0 0 9px rgba(52, 168, 83, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 168, 83, 0); }
}

.cam-note {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

.disclaimer {
  max-width: 640px;
  margin: 40px auto 0;
  font-size: 11px;
  line-height: 1.5;
  color: #6f757b;
}

/* ============================================================
   CONNECTING
   ============================================================ */
#connecting {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  gap: 22px;
  background: var(--bg-2);
}
.spinner {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.connecting-text { color: var(--text-dim); font-size: 17px; margin: 0; }

/* ============================================================
   CALL
   ============================================================ */
#call {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
}

.stage { position: absolute; inset: 0; background: #000; }
.remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.stage-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-dim);
  font-size: 15px;
  letter-spacing: 0.02em;
  background:
    radial-gradient(700px 380px at 50% 42%, #1c1f24 0%, #0a0b0d 70%);
}
.stage-placeholder.hidden { display: none; }
.ph-pulse {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(138, 180, 248, 0.18);
  box-shadow: 0 0 0 0 rgba(138, 180, 248, 0.4);
  animation: phPulse 1.6s ease-out infinite;
}
@keyframes phPulse {
  0%   { box-shadow: 0 0 0 0 rgba(138, 180, 248, 0.45); }
  70%  { box-shadow: 0 0 0 22px rgba(138, 180, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(138, 180, 248, 0); }
}

/* top-left meeting title */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  z-index: 5;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.meet-title { font-size: 15px; font-weight: 500; color: #f1f3f4; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }

/* countdown pill */
.timer-pill {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  padding: 9px 18px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-family: "Roboto Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f1f3f4;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.timer-pill.warning {
  color: #ff6b6b;
  border-color: rgba(234, 67, 53, 0.6);
  animation: timerPulse 1s ease-in-out infinite;
}
@keyframes timerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234, 67, 53, 0); }
  50%      { box-shadow: 0 0 18px 2px rgba(234, 67, 53, 0.55); }
}

/* self view */
.selfview {
  position: absolute;
  right: 20px;
  bottom: 104px;
  width: 232px;
  height: 138px;
  border-radius: 14px;
  overflow: hidden;
  z-index: 7;
  background: var(--surface);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);          /* mirror, like Meet */
  display: block;
  background: #202124;
}
.selfview-off {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #3c4043, #202124);
}
.cam-reason {
  margin-top: 10px;
  padding: 0 10px;
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  color: var(--text-dim);
}
.cam-reason:empty { display: none; }
.selfview.is-off .local-video { display: none; }
.selfview.is-off .selfview-off { display: flex; }
.avatar {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: #5f6368;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 600;
}

/* name chips */
.name-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--chip);
  color: #fff;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 6;
  backdrop-filter: blur(2px);
}
.remote-chip { left: 20px; bottom: 108px; }
.remote-chip .icon-sm { color: var(--danger-hi); }
.self-chip { left: 8px; bottom: 8px; padding: 3px 8px; font-size: 12px; }

/* control bar */
.controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 10;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
}
.ctrl {
  width: 52px; height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--ctrl);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s ease, transform 0.1s ease;
}
.ctrl:hover { background: var(--ctrl-hi); }
.ctrl:active { transform: scale(0.94); }

/* toggled-off (muted) state on mic / camera */
.ctrl .icon-off { display: none; }
.ctrl.is-off .icon-on { display: none; }
.ctrl.is-off .icon-off { display: inline-flex; }
.ctrl.is-off { background: var(--danger); }
.ctrl.is-off:hover { background: var(--danger-hi); }

/* leave / hang-up */
.ctrl-leave {
  width: 66px;
  border-radius: 999px;
  background: var(--danger);
}
.ctrl-leave:hover { background: var(--danger-hi); }
.ctrl-leave .icon svg { transform: rotate(135deg); }

/* ============================================================
   END OVERLAY
   ============================================================ */
#end {
  position: fixed;
  inset: 0;
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 22px;
  text-align: center;
  background: rgba(6, 7, 9, 0.9);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.5s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.end-inner { max-width: 620px; }
.end-title {
  font-size: clamp(40px, 9vw, 76px);
  font-weight: 800;
  margin: 0 0 28px;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 20px rgba(234, 67, 53, 0.35);
}
.end-body {
  font-size: clamp(15px, 2.2vw, 18px);
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 34px;
}
.again-btn {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.again-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.45); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .selfview { width: 116px; height: 158px; right: 12px; bottom: 96px; }
  .remote-chip { bottom: 100px; left: 12px; }
  .controls { gap: 10px; }
  .ctrl { width: 48px; height: 48px; }
  .ctrl-leave { width: 60px; }
  .hide-sm { display: none; }
  .meet-title { display: none; }   /* avoid clashing with the centered timer on phones */
  .timer-pill { font-size: 19px; padding: 8px 15px; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cam-dot, .ph-pulse, .timer-pill.warning, .spinner { animation: none; }
  .connect-btn { transition: none; }
}
