/* Auto Conference - guest page
   Night-cockpit theme: deep blue-black, one cool accent, calm and legible. */

:root {
  --bg: #0a0e15;
  --bg-glow: #141f33;
  --surface: #131a26;
  --surface-press: #1b2536;
  --line: #24314a;
  --text: #e9eef7;
  --muted: #8b97ac;
  --accent: #3f9bff;
  --accent-deep: #2478d8;
  --danger: #e5484d;
  --amber: #f5b453;
  --radius: 16px;
  --font-body: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  --font-code: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", monospace;
}

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

html { height: 100%; }

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 70% at 50% -12%, var(--bg-glow) 0%, var(--bg) 58%) fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: max(24px, env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- brand header --- */

.brand {
  text-align: center;
  padding-top: 4vh;
  margin-bottom: 28px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: linear-gradient(180deg, rgba(63, 155, 255, 0.14), rgba(63, 155, 255, 0.05));
  border: 1px solid rgba(63, 155, 255, 0.28);
  border-radius: 18px;
}

.brand-mark svg { width: 30px; height: 30px; }

.brand h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
}

/* --- code display --- */

.code-display {
  font-family: var(--font-code);
  font-size: 40px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.28em;
  text-indent: 0.28em; /* re-center: letter-spacing adds trailing space */
  text-align: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 8px 12px;
  margin-bottom: 24px;
  user-select: none;
}

/* --- keypad --- */

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.key {
  min-height: 68px;
  font-family: var(--font-body);
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.12s ease, transform 0.08s ease;
  touch-action: manipulation;
}

.key:active {
  background: var(--surface-press);
  transform: scale(0.96);
}

.key-del { color: var(--muted); }
.key-del svg { width: 28px; height: 28px; }

/* --- primary button --- */

.primary-btn {
  margin-top: auto;
  min-height: 56px;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(63, 155, 255, 0.28);
  transition: opacity 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
  touch-action: manipulation;
}

.primary-btn:active { transform: scale(0.98); }

.primary-btn:disabled {
  opacity: 0.35;
  box-shadow: none;
  cursor: default;
}

/* --- name view --- */

.name-input {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease;
}

.name-input::placeholder { color: var(--muted); }

.name-input:focus { border-color: var(--accent); }

/* --- call view --- */

.view-call { padding: 12px 12px calc(116px + env(safe-area-inset-bottom)); }

.notice {
  margin-bottom: 12px;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--amber);
  background: rgba(245, 180, 83, 0.1);
  border: 1px solid rgba(245, 180, 83, 0.3);
  border-radius: 12px;
  text-align: center;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-content: start;
}

.tile {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
}

.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.tile span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: rgba(10, 14, 21, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 999px;
}

/* --- bottom control bar --- */

.controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 16px 0 calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(10, 14, 21, 0), rgba(10, 14, 21, 0.88) 40%);
}

.ctrl {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.08s ease;
  touch-action: manipulation;
}

.ctrl:active { transform: scale(0.94); }

.ctrl svg { width: 26px; height: 26px; }

/* on/off icon swap: JS toggles .off */
.ctrl .icon-off { display: none; }
.ctrl.off .icon-on { display: none; }
.ctrl.off .icon-off { display: block; }

.ctrl.off {
  background: rgba(229, 72, 77, 0.14);
  border-color: rgba(229, 72, 77, 0.4);
  color: var(--danger);
}

.ctrl-leave {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.ctrl-leave:active { background: #c73a3f; }

/* --- wider screens (tablet / desktop preview) --- */

@media (min-width: 720px) {
  .app { max-width: 480px; }
  .view-call .tiles { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
