/* PC 깨우기 PWA — 폰 세로화면 우선 */

:root {
  --bg: #11131a;
  --card: #1b1f2a;
  --card2: #232838;
  --line: #2e3446;
  --text: #e8ecf5;
  --dim: #8a93a8;
  --on: #35d07f;
  --off: #566076;
  --wait: #f5b942;
  --accent: #4c8dff;
  --danger: #ff5f56;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic",
               "Apple SD Gothic Neo", sans-serif;
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden { display: none !important; }
.screen { max-width: 480px; margin: 0 auto; padding: 16px; }

/* ---------------- 잠금화면 ---------------- */

.lock-box { text-align: center; padding-top: 8vh; }
.lock-icon { font-size: 40px; }
.lock-box h1 { font-size: 22px; margin: 10px 0 4px; }
.sub { color: var(--dim); margin: 0 0 22px; font-size: 14px; }

.pin-dots {
  display: flex; justify-content: center; gap: 12px; height: 16px;
  margin-bottom: 8px;
}
.pin-dots i {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--line); display: block;
}
.pin-dots i.on { background: var(--accent); }

.pin-msg { min-height: 20px; font-size: 13px; color: var(--danger); margin-bottom: 12px; }

.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  max-width: 300px; margin: 0 auto;
}
.key {
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 16px; font-size: 24px; padding: 18px 0; cursor: pointer;
  transition: transform .06s, background .12s;
}
.key:active { transform: scale(.95); background: var(--card2); }
.key-sub, .key-go { font-size: 16px; }
.key-go { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------------- 메인 ---------------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.topbar h1 { font-size: 20px; margin: 0; }

.ghost {
  background: transparent; color: var(--dim); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.ghost:active { background: var(--card); }

.cards { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 16px;
}
.card-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 4px;
}
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--off); flex: none; }
.dot.on { background: var(--on); box-shadow: 0 0 10px var(--on); }
.dot.wait { background: var(--wait); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.card-name { font-size: 17px; font-weight: 600; }
.card-state { color: var(--dim); font-size: 13px; margin: 2px 0 14px 21px; }

.wake-btn {
  width: 100%; border: none; border-radius: 14px; padding: 18px;
  font-size: 18px; font-weight: 700; cursor: pointer;
  background: var(--accent); color: #fff;
  transition: transform .06s, opacity .15s;
}
.wake-btn:active { transform: scale(.98); }
.wake-btn:disabled { opacity: .45; cursor: default; }

.row2 { display: flex; gap: 10px; margin-top: 10px; }
.row2 button {
  flex: 1; border-radius: 12px; padding: 12px; font-size: 14px; cursor: pointer;
  background: var(--card2); color: var(--text); border: 1px solid var(--line);
}
.row2 button:disabled { opacity: .35; cursor: default; }
.row2 button:active:not(:disabled) { background: var(--line); }

/* ---------------- 기록 / 하단 ---------------- */

.logwrap { margin-top: 22px; }
.logwrap h2 { font-size: 13px; color: var(--dim); font-weight: 600; margin: 0 0 8px; }
.log { list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--dim); }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.log li span { color: var(--text); }

.foot { margin-top: 18px; text-align: center; }
.conn { font-size: 12px; color: var(--dim); }
.conn.bad { color: var(--danger); }

/* ---------------- 모달 / 토스트 ---------------- */

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  z-index: 20;
}
.modal-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 20px; max-width: 340px; width: 100%;
}
.modal-box h3 { margin: 0 0 8px; font-size: 17px; }
.modal-box p { margin: 0 0 18px; font-size: 14px; color: var(--dim); line-height: 1.5; }
.modal-btns { display: flex; gap: 10px; margin-top: 12px; }
.modal-btns button { flex: 1; padding: 12px; border-radius: 12px; font-size: 15px; cursor: pointer; }
.danger { background: var(--danger); color: #fff; border: none; }

/* 저장 안 한 작업이 있을 수 있는 앱 경고 */
.warn {
  background: rgba(245, 185, 66, .12);
  border: 1px solid rgba(245, 185, 66, .45);
  color: var(--wait);
  border-radius: 12px; padding: 11px 13px; font-size: 13px;
  line-height: 1.5; margin: 0 0 16px;
}
.card .warn { margin: 0 0 12px; }

/* 밀어서 확인 — 오탭 방지 */
.slider {
  position: relative; height: 54px; border-radius: 27px;
  background: var(--card2); border: 1px solid var(--line);
  overflow: hidden; touch-action: none; user-select: none;
}
.slider-fill {
  position: absolute; inset: 0; width: 0;
  background: var(--danger); opacity: .35;
}
.slider-label {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  font-size: 14px; color: var(--dim); pointer-events: none;
}
.slider-knob {
  position: absolute; top: 4px; left: 4px;
  width: 46px; height: 44px; border-radius: 22px;
  background: var(--danger); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; cursor: grab;
}
.slider-knob:active { cursor: grabbing; }
.slider.done .slider-label { color: #fff; }

/* 예약 취소 막대 */
.cancel-bar {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 95, 86, .12);
  border: 1px solid rgba(255, 95, 86, .45);
  border-radius: 14px; padding: 12px 14px; margin-top: 10px;
}
.cancel-bar span { flex: 1; font-size: 13px; color: var(--danger); }
.cancel-bar button {
  border: none; border-radius: 10px; padding: 10px 16px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  background: var(--danger); color: #fff;
}

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: var(--card2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 30;
  max-width: 90vw; text-align: center;
}
