:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #131d33;
  --card-bg: rgba(25, 36, 61, 0.7);
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.4);
  --accent-red: #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.5);
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-x: hidden;
}

/* App Container */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(circle at 50% 20%, rgba(37, 99, 235, 0.15) 0%, rgba(10, 15, 29, 0.95) 75%);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
}

/* Top Navigation Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(10, 15, 29, 0.6);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.logo-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Notification Banner */
.push-status-card {
  margin: 14px 18px 0;
  padding: 14px 16px;
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(10px);
}

.push-info h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.push-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-subscribe {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-blue-glow);
}

.btn-subscribed {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
}

/* Screens Wrapper */
.screens-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  position: relative;
}

/* 1. Idle Screen */
.screen-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px;
}

.tutor-avatar-wrapper {
  position: relative;
  width: 150px;
  height: 150px;
  margin-bottom: 20px;
}

.tutor-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.tutor-status-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: var(--accent-green);
  border: 3px solid var(--bg-primary);
  border-radius: 50%;
}

.idle-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.idle-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 26px;
  max-width: 320px;
}

.btn-main-call {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 16px 40px;
  font-size: 17px;
  font-weight: 700;
  border-radius: 35px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px var(--accent-green-glow);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-main-call:active {
  transform: scale(0.96);
}

.quick-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  font-size: 13px;
  border-radius: 14px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* 2. Incoming Call Screen Modal */
.screen-incoming {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 29, 0.96);
  backdrop-filter: blur(20px);
  z-index: 100;
  display: none;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  padding: 60px 20px;
}

.screen-incoming.active {
  display: flex;
}

.ringing-pulse {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ringing-pulse::before,
.ringing-pulse::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--accent-green);
  opacity: 0.6;
  animation: pulse-ring 2s infinite ease-out;
}

.ringing-pulse::after {
  animation-delay: 1s;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}

.ringing-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  z-index: 2;
  border: 3px solid #fff;
}

.incoming-buttons {
  display: flex;
  justify-content: space-around;
  width: 100%;
  max-width: 300px;
}

.call-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  cursor: pointer;
  transition: transform 0.2s;
}

.call-btn:active {
  transform: scale(0.9);
}

.call-btn-accept {
  background: var(--accent-green);
  color: white;
  box-shadow: 0 0 30px var(--accent-green-glow);
}

.call-btn-decline {
  background: var(--accent-red);
  color: white;
  box-shadow: 0 0 30px var(--accent-red-glow);
}

/* 3. Active Call Screen */
.screen-active-call {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding-bottom: 24px;
}

.screen-active-call.active {
  display: flex;
}

.call-header {
  text-align: center;
  margin-top: 6px;
}

.call-tutor-name {
  font-size: 22px;
  font-weight: 700;
}

.call-timer {
  font-size: 15px;
  color: var(--accent-green);
  font-weight: 600;
  margin-top: 4px;
}

.call-mode-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 20px;
}

/* Audio Waveform */
.wave-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 50px;
  margin: 12px 0;
}

.wave-bar {
  width: 5px;
  height: 15px;
  background: var(--accent-blue);
  border-radius: 10px;
  transition: height 0.15s ease;
}

.wave-container.speaking .wave-bar {
  background: var(--accent-green);
  animation: wave 1s infinite ease-in-out;
}

.wave-container.speaking .wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-container.speaking .wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-container.speaking .wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-container.speaking .wave-bar:nth-child(5) { animation-delay: 0.4s; }
.wave-container.speaking .wave-bar:nth-child(6) { animation-delay: 0.2s; }

@keyframes wave {
  0%, 100% { height: 12px; }
  50% { height: 44px; }
}

/* Transcript Box */
.dialog-box {
  width: 100%;
  background: rgba(19, 29, 51, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 16px;
  max-height: 240px;
  min-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(10px);
}

.msg-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
}

.msg-ai {
  align-self: flex-start;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}

.msg-user {
  align-self: flex-end;
  background: var(--accent-blue);
  color: white;
  border-bottom-right-radius: 4px;
}

.grammar-tip {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.2);
  color: #fde047;
  font-size: 13px;
}

.status-hint {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 14px;
}

/* ★ 표준 스마트폰 통화 종료 컨트롤 (크고 직관적인 빨간색 수화기) */
.call-controls-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 20px;
}

.btn-phone-hangup {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ef4444;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px var(--accent-red-glow);
  transition: transform 0.15s ease, background 0.2s ease;
}

.btn-phone-hangup:active {
  transform: scale(0.92);
  background: #dc2626;
}

.btn-phone-hangup svg {
  width: 36px;
  height: 36px;
  fill: #ffffff;
}

.hangup-label {
  font-size: 12px;
  font-weight: 600;
  color: #f87171;
  margin-top: 8px;
}

/* ★ 예약 설정 모달 */
.schedule-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.schedule-modal.active {
  display: flex;
}

.schedule-card {
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.schedule-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.schedule-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.4;
}

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 8px;
}

/* 요일 선택 칩 */
.day-chips {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}

.day-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 12px;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.day-chip.selected {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: #60a5fa;
  box-shadow: 0 4px 12px var(--accent-blue-glow);
}

/* 시간 선택 */
.time-selector-row {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.custom-select {
  flex: 1;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Footer */
.app-footer {
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
