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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #94a3b8;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

html, body {
  height: 100%;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

.view {
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.hidden { display: none !important; }

/* Home */
.logo-area { text-align: center; padding: 48px 0 12px; }
.logo { font-size: 64px; margin-bottom: 8px; }
.logo-area h1 { font-size: 36px; font-weight: 700; letter-spacing: -1px; }
.tagline { color: var(--text-muted); margin-top: 4px; }

.home-actions { display: flex; flex-direction: column; gap: 12px; }
.find-row { display: flex; gap: 8px; }

/* Inputs */
.code-input {
  flex: 1;
  min-width: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 6px;
  text-align: center;
  text-transform: uppercase;
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
}
.code-input:focus { border-color: var(--primary); }

.content-textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 15px;
  resize: vertical;
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
  min-height: 180px;
}
.content-textarea:focus { border-color: var(--primary); }

.char-count { text-align: right; color: var(--text-muted); font-size: 13px; margin-top: -12px; }

/* Buttons */
.btn {
  padding: 14px 24px;
  border-radius: var(--radius);
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border: 2px solid var(--border); }
.btn-secondary:hover { border-color: var(--secondary); }
.btn-full { width: 100%; }

/* View header */
.view-header { display: flex; align-items: center; gap: 12px; padding-top: 8px; }
.view-header h2 { font-size: 24px; font-weight: 700; }
.back-btn {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-size: 15px; padding: 0; font-weight: 500;
}

/* Result */
.qr-box {
  display: flex;
  justify-content: center;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.qr-box canvas, .qr-box img { border-radius: 8px; }

.code-badge {
  text-align: center;
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 12px;
  color: var(--primary);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.code-hint { text-align: center; color: var(--text-muted); font-size: 14px; }
.countdown { text-align: center; color: var(--text-muted); font-size: 14px; font-variant-numeric: tabular-nums; }

/* Clip content view */
.clip-content {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  min-height: 120px;
  max-height: 50vh;
  overflow-y: auto;
}
.clip-content a { color: var(--primary); word-break: break-all; }
.copy-hint { text-align: center; color: var(--text-muted); font-size: 14px; min-height: 20px; }

/* Tips */
.tips { padding-left: 20px; color: var(--text-muted); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 999;
  animation: fadein .2s ease;
}
.toast.error { background: #dc2626; }
@keyframes fadein { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #64748b;
  }
}
