/* ── Reset & Base ────────────────────────────────────── */

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

html, body {
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  background: #111;
  font-family: 'Nokia', monospace;
}

/* ── App Container ──────────────────────────────────── */

#app {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  background: #111;
}

/* ── Start Overlay ──────────────────────────────────── */

#start-overlay {
  position: fixed;
  inset: 0;
  background: #111;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  transition: opacity 0.5s ease;
}

#start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#start-btn {
  font-family: 'Nokia', monospace;
  font-size: 24px;
  color: #c7f0d8;
  background: transparent;
  border: 2px solid #c7f0d8;
  padding: 16px 48px;
  cursor: pointer;
  letter-spacing: 4px;
  transition: background 0.2s, color 0.2s;
}

#start-btn:active {
  background: #c7f0d8;
  color: #111;
}

/* ── Phone Body ─────────────────────────────────────── */

.phone {
  width: min(85vw, 340px);
  background: linear-gradient(180deg, #3a3a3a 0%, #2c2c2c 10%, #252525 90%, #1e1e1e 100%);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 24px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 8px 32px rgba(0,0,0,0.8),
    0 2px 8px rgba(0,0,0,0.5);
  position: relative;
  user-select: none;
}

/* ── Phone Top / Branding ───────────────────────────── */

.phone-top {
  text-align: center;
  margin-bottom: 10px;
}

.nokia-brand {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold;
  font-size: 18px;
  color: #555;
  letter-spacing: 6px;
  text-transform: uppercase;
}

/* ── Screen Bezel ───────────────────────────────────── */

.screen-bezel {
  width: 100%;
  background: #333;
  border-radius: 8px;
  padding: 8px;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.5),
    0 1px 0 rgba(255,255,255,0.05);
}

/* ── LCD Screen ─────────────────────────────────────── */

.lcd {
  width: 100%;
  aspect-ratio: 7 / 4;
  background: #c7f0d8;
  border-radius: 4px;
  color: #43523d;
  font-family: 'Nokia', monospace;
  font-size: clamp(11px, 3vw, 16px);
  position: relative;
  overflow: hidden;
  image-rendering: pixelated;
}

/* Scanline overlay */
.lcd::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
  z-index: 5;
}

/* LCD flash animation for notifications */
.lcd.flash {
  animation: lcd-flash 0.3s ease 3;
}

@keyframes lcd-flash {
  0%, 100% { background-color: #c7f0d8; }
  50% { background-color: #d8ffe8; }
}

/* ── Screen States ──────────────────────────────────── */

.screen {
  position: absolute;
  inset: 0;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 1;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── IDLE Screen ────────────────────────────────────── */

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: clamp(8px, 2vw, 11px);
  line-height: 1;
}

.signal {
  letter-spacing: -1px;
  font-weight: bold;
}

.operator {
  font-size: clamp(7px, 1.8vw, 10px);
}

.battery {
  font-size: clamp(8px, 2vw, 11px);
}

.idle-clock {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(20px, 6vw, 32px);
  letter-spacing: 2px;
}

/* ── NOTIFICATION Screen ────────────────────────────── */

.notif-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.envelope {
  font-size: clamp(24px, 7vw, 36px);
  line-height: 1;
}

.notif-text {
  text-align: center;
  font-size: clamp(10px, 2.8vw, 14px);
  line-height: 1.4;
}

/* ── MESSAGE Screen ─────────────────────────────────── */

.msg-header {
  font-size: clamp(9px, 2.5vw, 13px);
  margin-bottom: 4px;
}

.msg-divider {
  height: 1px;
  background: #43523d;
  margin-bottom: 6px;
  opacity: 0.5;
}

.msg-body {
  flex: 1;
  font-size: clamp(10px, 2.8vw, 14px);
  line-height: 1.4;
  white-space: pre-wrap;
}

/* Blinking cursor for typewriter */
.msg-body::after {
  content: '|';
  animation: blink-cursor 0.6s step-end infinite;
}

.msg-body.done::after {
  content: '';
  animation: none;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── YES Screen ─────────────────────────────────────── */

.yes-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.heart-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: clamp(8px, 2.2vw, 12px);
  line-height: 1.1;
  white-space: pre;
}

.yes-text {
  font-size: clamp(10px, 2.8vw, 14px);
  margin-top: 4px;
}

.hearts-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.floating-heart {
  position: absolute;
  bottom: -20px;
  font-size: clamp(10px, 3vw, 16px);
  animation: float-heart 3s ease-out forwards;
  color: #43523d;
}

@keyframes float-heart {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-120px) scale(0.4);
    opacity: 0;
  }
}

/* ── NO Screen ──────────────────────────────────────── */

.no-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.no-text {
  font-size: clamp(20px, 6vw, 32px);
  text-align: center;
}

/* ── Soft Key Labels ────────────────────────────────── */

.soft-labels {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px 0;
  font-family: 'Nokia', monospace;
  font-size: clamp(9px, 2.2vw, 12px);
  color: #c7f0d8;
  min-height: 1.4em;
}

/* ── Buttons Area ───────────────────────────────────── */

.buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  background: #1a1a1a;
  color: #888;
  border: 1px solid #333;
  border-radius: 6px;
  font-family: 'Nokia', monospace;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 0 #000, inset 0 1px 0 rgba(255,255,255,0.04);
  transition: transform 0.05s, box-shadow 0.05s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #000, inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ── Soft Key Buttons ───────────────────────────────── */

.btn-row--soft {
  display: flex;
  width: 80%;
  justify-content: space-between;
}

.btn--soft {
  width: 36%;
  height: 28px;
  border-radius: 10px;
}

/* ── D-Pad ──────────────────────────────────────────── */

.btn-row--nav {
  display: grid;
  grid-template-areas:
    ".    up    ."
    "left ctr   right"
    ".    down  .";
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 2px;
  width: 45%;
  aspect-ratio: 1;
}

.btn--nav {
  border-radius: 4px;
  font-size: 0;
  min-height: 0;
}

#btn-up { grid-area: up; border-radius: 8px 8px 2px 2px; }
#btn-left { grid-area: left; border-radius: 8px 2px 2px 8px; }
#btn-right { grid-area: right; border-radius: 2px 8px 8px 2px; }
#btn-down { grid-area: down; border-radius: 2px 2px 8px 8px; }
.btn--nav-center {
  grid-area: ctr;
  border-radius: 50% !important;
  background: #222 !important;
}

/* ── Call / C / End Row ─────────────────────────────── */

.btn-row--call {
  display: flex;
  width: 75%;
  justify-content: space-between;
  align-items: center;
}

.btn--call-green,
.btn--call-red {
  width: 32%;
  height: 28px;
  border-radius: 10px;
}

.btn--call-green {
  color: #4a4;
}

.btn--call-red {
  color: #a44;
}

.btn--c {
  width: 24%;
  height: 24px;
  font-size: clamp(8px, 2vw, 11px);
  border-radius: 8px;
}

/* ── Number Pad ─────────────────────────────────────── */

.btn-row--num {
  display: flex;
  width: 80%;
  gap: 4%;
}

.btn--num {
  flex: 1;
  padding: 6px 0;
  flex-direction: column;
  gap: 0;
  min-height: 28px;
}

.num-main {
  font-size: clamp(10px, 2.5vw, 14px);
  line-height: 1;
  color: #999;
}

.num-sub {
  font-size: clamp(5px, 1.2vw, 7px);
  line-height: 1;
  color: #555;
  margin-top: 1px;
}

/* ── Phone Bottom ───────────────────────────────────── */

.phone-bottom {
  height: 8px;
}
