:root {
  --bg: #0c1210;
  --bg-elevated: #121a17;
  --bg-panel: #15201c;
  --line: rgba(168, 214, 186, 0.12);
  --text: #e8f2ec;
  --muted: #8aa396;
  --accent: #3dff9a;
  --accent-dim: rgba(61, 255, 154, 0.14);
  --danger: #ff6b6b;
  --call: #1fbf6b;
  --call-press: #169653;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Syne", "DM Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(61, 255, 154, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(56, 189, 248, 0.08), transparent 50%),
    linear-gradient(165deg, #0a100e 0%, #0c1210 45%, #101816 100%);
  overflow-x: hidden;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.glow {
  pointer-events: none;
  position: fixed;
  width: 420px;
  height: 420px;
  right: -80px;
  bottom: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61, 255, 154, 0.18), transparent 68%);
  filter: blur(18px);
  animation: pulse 7s ease-in-out infinite;
  z-index: 0;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.topbar,
.stage,
.drawer {
  position: relative;
  z-index: 1;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 20px clamp(18px, 4vw, 40px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-dim), 0 0 28px rgba(61, 255, 154, 0.45);
  animation: markBlink 2.8s ease-in-out infinite;
}

@keyframes markBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.brand-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(18, 26, 23, 0.7);
  backdrop-filter: blur(10px);
  font-size: 0.82rem;
  color: var(--muted);
}

.status-chip[data-state="ready"] {
  color: var(--accent);
  border-color: rgba(61, 255, 154, 0.28);
}

.status-chip[data-state="error"] {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.3);
}

.status-chip[data-state="call"] {
  color: #7dd3fc;
  border-color: rgba(125, 211, 252, 0.3);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(18, 26, 23, 0.65);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.icon-btn:hover {
  border-color: rgba(61, 255, 154, 0.35);
  background: var(--accent-dim);
}

.icon-btn:active {
  transform: scale(0.96);
}

.stage {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(260px, 1fr);
  gap: 24px;
  align-items: start;
  padding: 8px clamp(18px, 4vw, 40px) 48px;
  max-width: 1100px;
}

.dialer,
.panel {
  background: linear-gradient(180deg, rgba(21, 32, 28, 0.95), rgba(14, 22, 19, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dialer {
  padding: 28px 24px 24px;
  animation: rise 0.55s ease both;
}

.side {
  display: grid;
  gap: 16px;
  animation: rise 0.7s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.number-display {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(1.7rem, 4vw, 2.15rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 8px 0 18px;
  border-bottom: 1px solid var(--line);
}

.number-display::placeholder {
  color: rgba(138, 163, 150, 0.45);
}

.quick-row {
  display: flex;
  gap: 8px;
  margin: 14px 0 18px;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.ghost-btn:hover {
  color: var(--text);
  border-color: rgba(61, 255, 154, 0.3);
  background: var(--accent-dim);
}

.ghost-btn.compact {
  padding: 5px 10px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.keypad button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  min-height: 64px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 2px;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}

.keypad button span {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1;
}

.keypad button small {
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.keypad button:hover {
  background: var(--accent-dim);
  border-color: rgba(61, 255, 154, 0.28);
}

.keypad button:active {
  transform: scale(0.96);
}

.call-actions {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  margin-top: 18px;
}

.backspace-btn {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.backspace-btn:hover {
  color: var(--text);
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08);
}

.call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  border-radius: 18px;
  background: linear-gradient(180deg, #2dd87a, var(--call));
  color: #04140c;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  box-shadow: 0 12px 30px rgba(31, 191, 107, 0.28);
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}

.call-btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 16px 36px rgba(31, 191, 107, 0.36);
}

.call-btn:active {
  transform: scale(0.985);
  background: var(--call-press);
}

.call-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  box-shadow: none;
}

.panel {
  padding: 18px 18px 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.panel h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.history {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 340px;
  overflow: auto;
}

.history li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}

.history .num {
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--text);
  text-decoration: none;
}

.history .num:hover {
  color: var(--accent);
}

.history .when {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: var(--muted);
}

.history .recall {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.empty {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.tip p {
  margin: 10px 0 4px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

.tip-number {
  font-family: var(--mono);
  color: var(--accent);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 6, 0.55);
  backdrop-filter: blur(3px);
  z-index: 20;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(400px, 100%);
  height: 100%;
  background: var(--bg-elevated);
  border-left: 1px solid var(--line);
  padding: 22px;
  transform: translateX(104%);
  transition: transform 0.28s ease;
  z-index: 30;
  overflow: auto;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.drawer-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-form label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.settings-form input {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0d1512;
  color: var(--text);
  padding: 12px 12px;
  font: inherit;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.settings-form input:focus {
  outline: 2px solid rgba(61, 255, 154, 0.35);
  border-color: transparent;
}

.save-btn {
  margin-top: 6px;
  border: 0;
  border-radius: 14px;
  min-height: 48px;
  background: var(--accent);
  color: #04140c;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
}

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .stage {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .status-chip {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* ===== Thème « téléphone » : fond noir, texte blanc, touches rondes ===== */
:root {
  --bg: #000;
  --bg-elevated: #0b0d10;
  --bg-panel: #0e1114;
  --line: rgba(255, 255, 255, 0.08);
  --text: #fff;
  --muted: #8b929b;
  --accent: #2ec4a6;
  --accent-dim: rgba(46, 196, 166, 0.14);
  --call: #2ec4a6;
  --call-press: #23a58b;
  --key: #15181d;
  --key-hover: #1f242b;
}

body {
  background: #000;
}

.grain,
.glow {
  display: none;
}

.brand-mark {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
  border-radius: 50%;
}

/* Carte composeur façon smartphone */
.dialer {
  background: linear-gradient(180deg, #0b0e12, #050608);
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 28px 28px 32px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  text-align: center;
}

.eyebrow {
  display: inline-block;
  margin: 0 auto 6px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}

.number-display {
  text-align: center;
  font-family: var(--font);
  font-weight: 400;
  font-size: clamp(1.9rem, 6vw, 2.4rem);
  letter-spacing: 0.01em;
  border-bottom: 0;
  padding: 14px 0 4px;
}

.number-display::placeholder {
  color: rgba(255, 255, 255, 0.22);
}

.quick-row {
  justify-content: center;
  margin: 6px 0 22px;
}

.ghost-btn {
  border-color: transparent;
  font-size: 0.78rem;
}

.ghost-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-color: transparent;
}

/* Pavé : touches circulaires */
.keypad {
  grid-template-columns: repeat(3, 72px);
  justify-content: center;
  gap: 16px 28px;
}

.keypad button {
  width: 72px;
  height: 72px;
  min-height: 0;
  border: 0;
  border-radius: 50%;
  background: var(--key);
  align-content: center;
  transition: background 0.15s, transform 0.1s;
}

.keypad button span {
  font-family: var(--font);
  font-size: 1.7rem;
  font-weight: 400;
}

.keypad button small {
  font-size: 0.55rem;
  color: var(--muted);
}

.keypad button:hover {
  background: var(--key-hover);
  border-color: transparent;
}

.keypad button:active {
  background: #2a3038;
  transform: scale(0.94);
}

/* Ligne d'appel : [vide] [appeler] [effacer] */
.call-actions {
  grid-template-columns: repeat(3, 72px);
  justify-content: center;
  align-items: center;
  gap: 28px;
  margin-top: 26px;
}

.call-btn {
  width: 72px;
  height: 72px;
  min-height: 0;
  border-radius: 50%;
  background: var(--call);
  color: #fff;
  box-shadow: 0 10px 30px rgba(46, 196, 166, 0.35);
}

.call-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 12px 36px rgba(46, 196, 166, 0.45);
}

.call-btn:active {
  background: var(--call-press);
  transform: scale(0.94);
}

.backspace-btn {
  width: 72px;
  height: 56px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.backspace-btn:hover {
  color: #fff;
  background: transparent;
  border: 0;
}

/* Panneaux latéraux */
.panel {
  background: var(--bg-panel);
  box-shadow: none;
  border-radius: 24px;
}

.status-chip,
.icon-btn {
  background: rgba(255, 255, 255, 0.04);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line);
}

.settings-form input {
  background: #000;
}

.save-btn {
  color: #fff;
}

@media (max-width: 400px) {
  .dialer { padding: 22px 12px 26px; }
  .keypad,
  .call-actions { grid-template-columns: repeat(3, 66px); gap: 14px 22px; }
  .keypad button,
  .call-btn,
  .backspace-btn { width: 66px; }
  .keypad button,
  .call-btn { height: 66px; }
}
