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

:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --border: #e0e0e0;
  --text: #1d1d1f;
  --muted: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --danger: #ff3b30;
  --success: #34c759;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

header a {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
}

header .btn {
  flex: unset;
  padding: 7px 16px;
  font-size: 13px;
}

#status-badge {
  font-size: 13px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  min-width: 90px;
  text-align: center;
  transition: all 0.2s ease;
  opacity: 0;
}
#status-badge.visible { opacity: 1; }
#status-badge.success { background: #d1f7dc; color: #1a7a35; }
#status-badge.error   { background: #ffe5e3; color: #c0392b; }
#status-badge.neutral { background: #e8e8ed; color: var(--muted); }

main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 680px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.qr-wrap {
  display: none;
  justify-content: center;
}

.qr-wrap.visible {
  display: flex;
}

#qrcode {
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
}

.textarea-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px 16px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

textarea:focus {
  border-color: var(--accent);
}

textarea.has_change {
  border-color: var(--success);
}

textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.counter {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.counter.warn { color: var(--danger); }

.actions {
  display: flex;
  gap: 12px;
}

.btn {
  flex: 1;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.2s;
  letter-spacing: -0.2px;
}

.btn:active:enabled { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover:enabled { background: #e8e8ed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:enabled { background: var(--accent-hover); }

footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 480px) {
  .card { padding: 20px; }
  header { padding: 14px 20px; }
}
