@font-face {
  font-family: 'YurukaFangTang';
  src: url('/fonts/YurukaFangTang.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
  --success: #10b981;
  --border: #334155;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 4px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  padding: 24px 16px;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 32px;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-info {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

/* Navigation */
.nav-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.nav-btn:hover {
  color: var(--text-main);
  background: var(--bg-secondary);
}

.nav-btn.active {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
}

/* Tab Panes */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Layout */
.playground-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

@media (max-width: 850px) {
  .playground-layout {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-main);
}

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.flex-1 {
  flex: 1;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.label-val-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.val-tag {
  font-size: 12px;
  color: var(--accent);
  font-family: monospace;
}

.form-control {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--accent);
}

.form-control-sm {
  padding: 4px 8px;
  font-size: 12px;
}

.form-range {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker {
  -webkit-appearance: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker::-webkit-color-swatch {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.custom-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-main);
}

.custom-checkbox input {
  accent-color: var(--accent);
  cursor: pointer;
}

/* Preview Section */
.preview-card {
  display: flex;
  flex-direction: column;
}

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

.canvas-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #090d16;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  padding: 24px;
  min-height: 280px;
  position: relative;
}

.canvas-box {
  position: relative;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
}

.canvas-box img {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: auto;
}

.preview-meta {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  font-family: monospace;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

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

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #475569;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Spinner */
.spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.hidden {
  display: none;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* API Docs Tab */
.api-block {
  margin-top: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.api-block h3 {
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--accent);
}

.code-box {
  background: #090d16;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: monospace;
  font-size: 13px;
  color: #e2e8f0;
  overflow-x: auto;
  margin: 10px 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.status-item {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius-md);
}

.status-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.status-val {
  font-size: 14px;
  font-weight: 600;
}

.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.deploy-steps {
  margin-left: 20px;
  line-height: 1.8;
  color: var(--text-muted);
  font-size: 14px;
}

.deploy-steps a {
  color: var(--accent);
  text-decoration: none;
}
