:root {
  --text: #1d1d1f;
  --muted: #86868b;
  --accent: #0071e3;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: #ffffff;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
}

body.drag-active {
  animation: breathe 1.6s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { background-color: #ffffff; }
  50% { background-color: #eef1f5; }
}

.stage {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  padding: 24px;
  text-align: center;
  user-select: none;
}

.stage-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: #f5f5f7;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  transition: transform .2s ease;
  overflow: hidden;
}

body.drag-active .stage-icon {
  transform: scale(1.08);
}

body.uploading .stage-icon {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(0, 113, 227, 0.16) 0,
    rgba(0, 113, 227, 0.16) 10px,
    rgba(0, 113, 227, 0.32) 10px,
    rgba(0, 113, 227, 0.32) 20px
  );
  background-size: 200% 200%;
  animation: wave-rise 0.6s linear infinite;
}

@keyframes wave-rise {
  from { background-position: 0 0; }
  to { background-position: 0 -28px; }
}

.stage-title {
  font-size: 26px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}

.stage-sub {
  font-size: 15px;
  color: var(--muted);
  margin: 0;
}

.stage-limit {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.75;
  margin: 0;
}

.code-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 90vw;
}

.code-trigger, .code-regenerate {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.code-trigger:hover, .code-regenerate:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}
.code-regenerate {
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
}

/* modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  width: min(360px, 90vw);
  background: var(--glass-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}
.modal-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}
.modal-card p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
}
.modal-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.6);
  font-size: 15px;
  color: var(--text);
  margin-bottom: 18px;
}
.modal-card input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn {
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 14px;
  cursor: pointer;
}
.btn-secondary {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}

/* toast */
.toast-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  z-index: 40;
  pointer-events: none;
}
.toast {
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 14px;
  text-align: center;
  padding: 14px 20px;
  transform: translateY(-100%);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast-success {
  background: rgba(52, 199, 89, 0.94);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.05);
}
.toast-error {
  background: rgba(255, 59, 48, 0.94);
  color: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.05);
}
