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

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e3e6eb;
  --text: #1f2330;
  --muted: #6b7280;
  --accent: rgb(234, 29, 60);
  --accent-dark: rgb(196, 22, 49);
  --primary: #16a34a;
  --primary-dark: #15803d;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.06);
  --radius: 10px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.header {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: #fff;
  padding: 28px 24px;
  border-bottom: 1px solid #0b1220;
}
.header {
  position: relative;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
}
.lang-switch {
  position: absolute;
  top: 22px;
  right: 24px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  display: flex;
  gap: 8px;
  align-items: center;
  color: #cbd5e1;
}
.lang-switch a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.lang-switch a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.lang-switch a.active {
  background: var(--accent);
  color: #fff;
}
.lang-sep {
  opacity: 0.5;
}
.header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: #cbd5e1;
}

.layout {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(360px, 460px) 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.panel-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.preview-panel {
  position: sticky;
  top: 24px;
}

.group {
  border: none;
  padding: 0;
  margin: 0 0 18px;
}
.group legend {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  padding: 0;
}
.group label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
}
.req {
  color: var(--accent);
  margin-left: 2px;
}
.muted {
  color: var(--muted);
  font-weight: 400;
}
.hint {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 0;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"] {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 29, 60, 0.12);
}
input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 4px;
  font-size: 12px;
}

.photo-toggle {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}
.toggle-opt {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-top: 12px;
}

.preview-frame {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  overflow: auto;
  max-width: 100%;
}
#preview-root {
  background: #fff;
  padding: 16px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  display: inline-block;
  min-width: 525px;
}
.preview-empty {
  color: var(--muted);
  font-style: italic;
  padding: 24px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.btn {
  flex: 0 1 auto;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-dark);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}
.btn-emph { font-size: 13px; }
.btn-sub {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.85;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
  font-weight: 500;
  align-items: center;
  flex-direction: row;
  padding: 10px 14px;
}
.btn-secondary:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #cbd5e1;
}

.actions-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 0;
}

.instructions {
  margin-top: 22px;
  padding: 16px 18px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
}
.instructions h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #14532d;
}
.instructions ol {
  margin: 0;
  padding-left: 22px;
  font-size: 13px;
  color: #1f2937;
}
.instructions li { margin-bottom: 6px; }
.instructions code {
  background: #ecfccb;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.instructions kbd {
  background: #fff;
  border: 1px solid #94a3b8;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  font-family: inherit;
}
.copy-path {
  background: #fff;
  border: 1px solid #94a3b8;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 4px;
}
.copy-path:hover { background: #f1f5f9; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111827;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 50;
  animation: toast-in 0.2s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
