:root {
  --bg-canvas: #FAF8F5;
  --card-surface: #FFFFFF;
  --card-subtle: #F5F3EF;
  --border-light: #ECE7DF;
  --border-focus: #52D1B2;
  
  --ink-primary: #272C2B;
  --ink-secondary: #64706D;
  --ink-muted: #9BA6A3;
  
  --jelly-mint: #25D3A6;
  --jelly-mint-light: #E4FBF4;
  --jelly-mint-glow: rgba(37, 211, 166, 0.28);
  
  --jelly-pink: #FF6584;
  --jelly-pink-light: #FFF0F3;
  
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-card: 0 10px 30px -4px rgba(40, 48, 45, 0.05), 0 2px 8px -2px rgba(40, 48, 45, 0.03);
  --shadow-stage: inset 0 2px 6px rgba(255, 255, 255, 0.8), 0 16px 36px -8px rgba(37, 211, 166, 0.08), 0 4px 16px rgba(40, 48, 45, 0.04);
}

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

html, body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: max(6px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(37, 211, 166, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(255, 101, 132, 0.05) 0%, transparent 40%);
}

.app-layout {
  width: 100%;
  max-width: 420px;
  min-height: calc(100dvh - 14px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  box-sizing: border-box;
  transition: max-width 0.25s ease;
}

/* Tablet & PC Desktop Responsive Experience */
@media (min-width: 680px) {
  html, body {
    overflow: auto;
  }
  body {
    height: auto;
    min-height: 100vh;
    padding: 20px 16px;
    align-items: center;
  }
  .app-layout {
    max-width: 640px;
    height: auto;
    justify-content: flex-start;
    gap: 14px;
  }
  .stage-panel {
    flex: initial !important;
    height: 420px !important;
  }
  .dday-hero-card {
    padding: 16px 24px !important;
  }
  .dday-giant {
    font-size: 2.9rem !important;
  }
  .quote-panel {
    padding: 18px 22px !important;
    gap: 12px !important;
  }
  .quote-body {
    font-size: 0.94rem !important;
    line-height: 1.6 !important;
    padding: 13px 16px !important;
  }
}

@media (min-width: 900px) {
  .app-layout {
    max-width: 720px;
    gap: 16px;
  }
  .stage-panel {
    height: 480px !important;
  }
}

/* Card Base */
.card {
  background: var(--card-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

/* 1. Hero D-Day & Clock Card (Compact & Clean) */
.dday-hero-card {
  flex-shrink: 0;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--card-surface);
}

.dday-header-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dday-sub-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-secondary);
  letter-spacing: -0.01em;
}

.dday-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--card-subtle);
  border: 1px solid var(--border-light);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-lang-toggle:hover {
  background: var(--jelly-mint-light);
  color: var(--jelly-mint);
  border-color: var(--jelly-mint);
}

.btn-lang-toggle:active {
  transform: scale(0.96);
}

.lang-globe {
  font-size: 0.78rem;
  line-height: 1;
}

.lang-text {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.btn-dday-edit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--card-subtle);
  border: 1px solid var(--border-light);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-dday-edit:hover {
  background: var(--jelly-mint-light);
  color: var(--jelly-mint);
  border-color: var(--jelly-mint);
}

.edit-icon {
  width: 11px;
  height: 11px;
}

.dday-giant-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}

.dday-giant {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.05;
  color: var(--jelly-mint);
  letter-spacing: -0.04em;
  text-shadow: 0 4px 16px rgba(37, 211, 166, 0.2);
}

.clock-sub-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card-subtle);
  border: 1px solid var(--border-light);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.clock-live-time {
  font-family: 'Plus Jakarta Sans', monospace;
  font-weight: 800;
  color: var(--ink-primary);
  letter-spacing: -0.01em;
}

.pill-divider {
  color: var(--border-light);
  font-size: 0.75rem;
}

.clock-live-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

/* 2. Interactive 3D Mascot Stage (Compact Mobile Stage) */
.stage-panel {
  flex: 1 1 auto;
  min-height: 240px;
  background: radial-gradient(circle at 50% 25%, #E6FAF4 0%, #F5FBF9 65%, #FAF7F2 100%);
  box-shadow: var(--shadow-stage);
  border-color: #E2ECE8;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: background 0.6s ease;
}

.stage-panel.is-sleeping {
  background: radial-gradient(circle at 50% 25%, #E8EEFA 0%, #E3E9F6 65%, #DFE5F2 100%);
}

.stage-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient-glow {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(160, 245, 225, 0.55) 0%, transparent 70%);
  filter: blur(32px);
}

.studio-pedestal {
  position: absolute;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  width: 86%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(39, 44, 43, 0.08), transparent);
}

/* Speech Dialog */
.speech-dialog {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 84%;
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid rgba(39, 44, 43, 0.1);
  border-radius: var(--radius-lg);
  padding: 8px 16px;
  text-align: center;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 20px rgba(39, 44, 43, 0.06);
  z-index: 5;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.speech-dialog::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #FFFFFF;
  border-right: 1.5px solid rgba(39, 44, 43, 0.1);
  border-bottom: 1.5px solid rgba(39, 44, 43, 0.1);
}

.dialog-text {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-primary);
  word-break: keep-all;
}

/* Three.js Canvas */
#slime-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  cursor: grab;
  touch-action: none;
}

#slime-canvas.grabbing {
  cursor: grabbing;
}

/* Floating Pastel Dream Particles */
.particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.particle {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: floatPastelUp 1.5s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

.particle.pastel-bubble {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.98), rgba(180, 245, 230, 0.75) 55%, rgba(255, 210, 230, 0.6) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 14px rgba(160, 240, 220, 0.45), inset 0 -2px 5px rgba(255, 255, 255, 0.9);
}

.particle.pastel-heart {
  color: #FFB3C6;
  filter: drop-shadow(0 3px 8px rgba(255, 179, 198, 0.55));
}

.particle.pastel-star {
  color: #FFE599;
  filter: drop-shadow(0 3px 8px rgba(255, 229, 153, 0.55));
}

.particle.pastel-sparkle {
  color: #B5EAD7;
  filter: drop-shadow(0 3px 8px rgba(181, 234, 215, 0.55));
}

.particle.zzz {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: #A2B2EE;
  filter: drop-shadow(0 2px 6px rgba(162, 178, 238, 0.4));
}

@keyframes floatPastelUp {
  0% { opacity: 0; transform: translateY(10px) scale(0.65); }
  20% { opacity: 1; transform: translateY(-4px) scale(1.1); }
  75% { opacity: 0.9; transform: translateY(-35px) scale(1.0); }
  100% { opacity: 0; transform: translateY(-55px) scale(0.85); }
}

/* Stage Bottom Controls Bar */
.stage-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  z-index: 6;
  pointer-events: none;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border-light);
  padding: 4px 9px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  white-space: nowrap !important;
  flex-shrink: 1;
  min-width: 0;
  pointer-events: auto;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--jelly-mint);
  box-shadow: 0 0 6px var(--jelly-mint);
  flex-shrink: 0;
}

.status-text {
  font-size: 0.70rem;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-tabs {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 2.5px 3px;
  gap: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
  pointer-events: auto;
  white-space: nowrap !important;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.70rem;
  font-weight: 700;
  padding: 4px 7.5px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap !important; /* CRITICAL: Never break letters vertically */
  flex-shrink: 0;
  line-height: 1.1;
  user-select: none;
  -webkit-user-select: none;
}

.tab-icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.tab-btn:hover {
  color: var(--ink-primary);
}

.tab-btn.active {
  background: var(--ink-primary);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(39, 44, 43, 0.2);
}

/* Mobile Screens Optimization (Galaxy S, iPhone, foldables) */
@media (max-width: 380px) {
  .stage-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    gap: 4px;
  }
  .status-indicator {
    padding: 3.5px 7px;
    max-width: 105px;
  }
  .status-text {
    font-size: 0.66rem;
  }
  .tab-btn {
    padding: 3.5px 5.5px;
    font-size: 0.66rem;
    gap: 2px;
  }
  .tab-icon {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 330px) {
  .status-indicator {
    max-width: 85px;
  }
  .tab-icon {
    display: none; /* Hide icon on ultra-narrow phones to ensure 100% clean horizontal text */
  }
}

/* 3. Daily Quote Card (Compact Mobile) */
.quote-panel {
  flex-shrink: 0;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(145deg, #EFFBF7 0%, #FAF8F4 52%, #FFF2F6 100%);
  border: 1px solid #D7EEE6;
  box-shadow: 0 4px 20px rgba(35, 75, 65, 0.05);
}

.quote-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quote-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #179E82;
}

.badge-icon {
  width: 12px;
  height: 12px;
}

.quote-date {
  font-size: 0.72rem;
  font-weight: 600;
  color: #7A908A;
}

.quote-body {
  font-size: 0.79rem;
  line-height: 1.35;
  font-weight: 500;
  color: #1B2926;
  word-break: keep-all;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid rgba(215, 238, 232, 0.75);
  box-shadow: 0 2px 8px rgba(35, 75, 65, 0.03);
  margin: 0;
}

.quote-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.quote-footer .btn {
  flex: initial;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  height: 29px;
  font-size: 0.70rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.quote-footer .btn-icon {
  width: 12px;
  height: 12px;
}

.quote-footer .btn-ghost {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #D2ECE4;
  color: #276255;
  box-shadow: 0 1px 4px rgba(35, 75, 65, 0.04);
}

.quote-footer .btn-ghost:hover {
  background: #E6F7F2;
  color: #12826A;
  border-color: #B5E4D7;
}

.quote-footer .btn-solid {
  background: #233430;
  color: #FFFFFF;
  border: 1px solid #233430;
  box-shadow: 0 2px 6px rgba(35, 52, 48, 0.16);
}

.quote-footer .btn-solid:hover {
  background: #14221F;
}

.btn {
  flex: 1;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 11px 16px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1.5px solid transparent;
}

.btn-icon {
  width: 15px;
  height: 15px;
}

.btn-ghost {
  background: var(--card-subtle);
  border-color: var(--border-light);
  color: var(--ink-primary);
}

.btn-ghost:hover {
  background: #ECE7DF;
}

.btn-solid {
  background: var(--ink-primary);
  color: #FFFFFF;
}

.btn-solid:hover {
  background: #171B1A;
}

.btn:active {
  transform: scale(0.98);
}

/* Footer Info (Hidden on mobile for 100% clean 1-screen fit) */
.app-info {
  display: none;
}

/* Toast */
.toast-notification {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-primary);
  color: #FFFFFF;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Modal Backdrop & Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 28, 0.45);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  width: 100%;
  max-width: 400px;
  background: #FFFFFF;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 60px -12px rgba(20, 30, 25, 0.25);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(12px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.show .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink-primary);
  letter-spacing: -0.02em;
}

.btn-close {
  background: var(--card-subtle);
  border: none;
  color: var(--ink-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-close:hover {
  background: #E5E0D8;
  color: var(--ink-primary);
}

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

.input-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-secondary);
  margin-bottom: 4px;
  display: block;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  background: var(--card-subtle);
  border: 1px solid var(--border-light);
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  border-color: var(--jelly-mint);
  background: var(--jelly-mint-light);
  color: var(--jelly-mint);
}

.form-group {
  display: flex;
  flex-direction: column;
}

.text-input {
  width: 100%;
  background: #FAF8F5;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink-primary);
  outline: none;
  transition: border-color 0.15s ease;
}

.text-input:focus {
  border-color: var(--jelly-mint);
  background: #FFFFFF;
}

.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

/* Completely Hide & Remove Netlify Badge */
#nl-badge-frame,
#nl-hud-frame,
iframe#nl-badge-frame,
iframe#nl-hud-frame,
iframe[title*="Netlify"],
iframe[title*="Powered by"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  z-index: -99999 !important;
}
