:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --key: #2f3546;
  --key-active: #474a52;
  --accent: #3b82f6;
  --danger: #ef4444;
  --success: #22c55e;
  --text: #e8eaed;
  --muted: #8b90a0;
  box-sizing: border-box;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
           env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.screen {
  width: min(420px, 100vw);
  height: min(720px, 100vh);
  background: var(--panel);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  padding: 6vh 5vw 4vh;
  gap: 3vh;
}

@media (min-width: 480px) {
  .screen {
    height: auto;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    padding: 32px 28px;
  }
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: clamp(12px, 3vw, 14px);
  color: var(--muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.2s;
}

.dot.online { background: var(--success); }
.dot.offline { background: var(--danger); }

.display {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 4vw, 20px);
}

.cell {
  width: clamp(48px, 16vw, 64px);
  height: clamp(56px, 18vw, 72px);
  border: 2px solid #333947;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 600;
  transition: border-color 0.15s, transform 0.1s;
}

.cell.filled {
  border-color: var(--accent);
}

.message {
  text-align: center;
  min-height: 1.4em;
  font-size: clamp(13px, 3.4vw, 15px);
  color: var(--muted);
}

.message.error { color: var(--danger); }
.message.success { color: var(--success); }

.keypad {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: clamp(8px, 2.5vw, 14px);
}

.key {
  border: none;
  border-radius: 14px;
  background: var(--key);
  color: var(--text);
  font-size: clamp(20px, 6vw, 30px);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background 0.08s, transform 0.08s;
}

.key:active,
.key.pressed {
  background: var(--key-active);
  transform: scale(0.95);
}

.key-cancel {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  font-size: clamp(13px, 3.6vw, 16px);
  letter-spacing: 0.03em;
}

.key-enter {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  font-size: clamp(13px, 3.6vw, 16px);
  letter-spacing: 0.03em;
}

.key-enter.ready {
  background: var(--accent);
  color: #fff;
}

.occupied {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 0 4vw;
}

.occupied-icon {
  font-size: clamp(40px, 12vw, 56px);
  line-height: 1;
}

.occupied-title {
  font-size: clamp(20px, 6vw, 26px);
  font-weight: 600;
}

.occupied-title.busy { color: var(--danger); }
.occupied-title.pending { color: var(--muted); }
.occupied-title.success { color: var(--success); }

.occupied-sub {
  font-size: clamp(13px, 3.4vw, 15px);
  color: var(--muted);
  min-height: 1.4em;
}
