/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:  #30D158;
  --red:    #FF3B30;
  --bg:     #1C1C1E;
  --fg:     #FFFFFF;
  --gray:   rgba(235,235,245,0.6);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

html {
  background: #000; /* ensures safe-area edges are always black */
}

body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0A0A0F;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ── Screen management ── */
.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease;
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
}

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

/* ═══════════════════════════════════════
   SETUP SCREEN
═══════════════════════════════════════ */
#screen-setup {
  background: var(--bg);
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.setup-inner {
  display: flex; flex-direction: column;
  align-items: center;
  padding: 16px 28px 24px;
  height: 100%;
  justify-content: space-evenly;
}

.app-title {
  color: var(--fg);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Photo upload */
.photo-upload-area {
  position: relative;
  cursor: pointer;
}

.photo-upload-area input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; width: 100%; height: 100%;
  cursor: pointer;
}

.setup-photo-circle {
  width: 160px; height: 160px;
  border-radius: 50%;
  background: #3A3A3C;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,0.12);
}

.setup-photo-circle img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
}

.photo-ph {
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
}

.photo-ph span {
  font-size: 14px;
  color: var(--gray);
}

/* Form fields */
.setup-fields {
  width: 100%;
  display: flex; flex-direction: column;
  gap: 16px;
}

.field-group {
  display: flex; flex-direction: column; gap: 10px;
}

.field-group label {
  font-size: 15px;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field-group input[type="text"] {
  width: 100%;
  background: #2C2C2E;
  border: none; border-radius: 12px;
  padding: 18px 20px;
  font-size: 20px;
  color: var(--fg);
  outline: none;
  -webkit-appearance: none;
}

.delay-row {
  display: flex; gap: 12px;
}

.delay-unit {
  flex: 1;
  display: flex; align-items: center;
  background: #2C2C2E;
  border-radius: 12px;
  padding: 14px 16px;
  gap: 8px;
}

.delay-unit input[type="number"] {
  flex: 1; min-width: 0;
  background: transparent;
  border: none; outline: none;
  font-size: 32px; font-weight: 300;
  color: var(--fg);
  text-align: center;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

.delay-unit input[type="number"]::-webkit-inner-spin-button,
.delay-unit input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.delay-unit span {
  font-size: 17px; color: var(--gray);
}

/* ARM button */
.arm-btn {
  width: 100%;
  background: var(--green);
  color: white;
  border: none; border-radius: 16px;
  padding: 22px;
  font-size: 20px; font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: opacity 0.15s;
  -webkit-appearance: none;
}

.arm-btn:active { opacity: 0.8; }

.setup-note {
  font-size: 13px;
  color: var(--gray);
  text-align: center;
  line-height: 1.5;
}

/* ═══════════════════════════════════════
   WAITING SCREEN (fake lock screen)
═══════════════════════════════════════ */
#screen-waiting {
  background: radial-gradient(ellipse at 50% 30%, #2C2C3E 0%, #0A0A0F 100%);
  justify-content: center;
  align-items: center;
}

.lock-body {
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
}

.lock-date {
  font-size: 18px;
  font-weight: 400;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.3px;
}

.lock-time {
  font-size: clamp(110px, 36vw, 160px);
  font-weight: 100;
  color: #fff;
  letter-spacing: -6px;
  line-height: 0.95;
  font-feature-settings: "tnum";  /* tabular digits — no layout shift on tick */
}

.tap-hint {
  position: absolute;
  bottom: calc(88px + var(--safe-b));
  left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.85);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
  animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.85; }
  50%       { opacity: 1; }
}

.cancel-btn {
  position: absolute;
  bottom: calc(32px + var(--safe-b));
  left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,0.15);
  border: none; border-radius: 20px;
  padding: 10px 28px;
  color: rgba(255,255,255,0.7);
  font-size: 15px;
  cursor: pointer;
  -webkit-appearance: none;
}

/* ═══════════════════════════════════════
   SHARED: INCOMING CALL + ACTIVE CALL
═══════════════════════════════════════ */
#screen-call,
#screen-active {
  /* subtle top-center glow matching iOS */
  background: radial-gradient(
    circle at 50% 20%,
    #2a2a2a 0%,
    #1c1c1e 40%,
    #000 100%
  );
  flex-direction: column;
}

/* ── Contact header (top-left: photo + name) ── */
.ios-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: calc(var(--safe-t) + 46px) 20px 0;
}

.ios-photo-wrap {
  width: 92px; height: 92px;   /* ↑ from 72 */
  border-radius: 50%;
  background: #4A4A4C;
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

.ios-photo-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
}

.ios-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}

.ios-info {
  display: flex; flex-direction: column;
  gap: 0;
}

.ios-sub {
  font-size: 20px;                   /* ↑ from 15 */
  color: rgba(255,255,255,0.6);      /* dimmer than before */
  font-weight: 400;
  margin-bottom: 6px;
}

.ios-timer {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.ios-name {
  font-size: 34px;          /* ↑ from 30 */
  font-weight: 500;         /* lighter than 700 */
  color: #FFFFFF;
  letter-spacing: 0.2px;   /* slightly open */
  line-height: 1.2;
}

/* Middle spacer */
.ios-spacer { flex: 1; }

/* ── Bottom button section ── */
.ios-btn-section {
  display: flex; flex-direction: column;
  gap: 40px;                              /* ↑ from 20 */
  padding: 0 12px calc(36px + var(--safe-b));
}

.ios-btn-row {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: flex-start;
}

.ios-btn-item {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 88px;
}

.ios-btn-item span {
  font-size: 15px;          /* ↑ from 13 */
  color: #FFFFFF;
  font-weight: 400;
  text-align: center;
}

/* Ghost circle (Message, Remind Me, Audio, etc.) */
.ios-ghost-circle {
  width: 72px; height: 72px;          /* ↑ from 62 */
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.ios-btn-item:active .ios-ghost-circle,
.ios-btn-item:active .ios-color-circle { opacity: 0.7; }

/* Filled colored circle (Decline, Accept, End) */
.ios-color-circle {
  width: 84px; height: 84px;   /* ↑ from 70 */
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s;
}

.ios-red   { background: #FF3B30; }   /* iOS system red */
.ios-green { background: #34C759; }   /* iOS system green */
