/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg-canvas: #e6ebf2;
  --bg-surface: #ffffff;
  --bg-emphasis: #0b1220;
  --text-primary: #0f172a;
  --text-muted: #334155;
  --brand: #0f4cc9;
  --brand-strong: #0b3a9f;
  --border-soft: #b8c4d8;
  --danger: #b91c1c;
  --ok: #0f7a3d;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
}
body {
  font-family: 'Segoe UI', 'Trebuchet MS', 'Segoe UI Variable', sans-serif;
  background:
    radial-gradient(circle at 100% -10%, #fff6cc 0%, rgba(255, 246, 204, 0) 35%),
    linear-gradient(180deg, #f5f8fc 0%, var(--bg-canvas) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

/* ===== HEADER ===== */
header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 2px solid var(--border-soft);
  backdrop-filter: saturate(120%) blur(4px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.header-left { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.header-right { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; }
.logo img { display: block; height: 58px; width: auto; }
#project-title-header {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  background: #edf2fa;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
}

/* ===== BETA BANNER ===== */
.beta-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-bottom: 2px solid #f59e0b;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: #92400e;
  line-height: 1.5;
  font-weight: 500;
}
.beta-banner strong { color: #b45309; font-weight: 700; }
.beta-disclaimer {
  background: #fee2e2;
  border-left: 4px solid #dc2626;
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  color: #7f1d1d;
  line-height: 1.6;
}
.beta-disclaimer strong { color: #991b1b; font-weight: 700; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem;
  padding: 0.72rem 1.2rem; border-radius: var(--radius-md); font-weight: 700; font-size: 0.95rem;
  cursor: pointer; border: 2px solid transparent; transition: all 0.15s; min-height: 50px;
  white-space: nowrap; font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible,
.form-input:focus-visible,
.preview-btn:focus-visible,
.toggle-group button:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-secondary { background: #f8fafc; color: #1f2937; border-color: var(--border-soft); }
.btn-secondary:hover { background: #eef3fb; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-sm { padding: 0.56rem 0.9rem; font-size: 0.92rem; min-height: 46px; }

/* ===== TOGGLE GROUP ===== */
.toggle-group {
  .logo { display: inline-flex; align-items: center; font-size: 1.8rem; line-height: 1; }
}
.toggle-group button {
  padding: 0.48rem 0.95rem; font-size: 0.92rem; font-weight: 700; background: #f8fafc;
  color: var(--text-muted); border: 2px solid var(--border-soft); cursor: pointer; min-height: 46px; transition: all 0.15s;
  border-radius: 0.6rem;
}
.toggle-group button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ===== STATUS ===== */
.status-bar {
  font-size: 0.78rem; padding: 0.2rem 0.65rem; border-radius: 9999px; font-weight: 700;
}
.status-saved { background: #dcfce7; color: #16a34a; }
.status-saving { background: #fef9c3; color: #a16207; }
.status-error { background: #fee2e2; color: #dc2626; }

/* ===== SCREEN ===== */
.screen { display: none; }
.screen.active { display: block; }
.screen-content { max-width: 1020px; margin: 0 auto; padding: 1.5rem 1rem 4.2rem; }
.screen-content.wall-editor-screen { max-width: none; padding: 1.5rem; }
.screen-content-narrow { max-width: 700px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; gap: 1rem; flex-wrap: wrap;
}
.section-header h1 { font-size: 2rem; font-weight: 900; color: var(--text-primary); letter-spacing: -0.015em; }
.section-header h2 { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); }
.section-subtitle { color: var(--text-muted); font-size: 1rem; margin-top: 0.25rem; font-weight: 500; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
  border: 2px solid #d7dfed;
}

/* ===== PROJECTS GRID ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.project-card {
  background: #fff;
  border-radius: 0.85rem;
  padding: 1.25rem;
  border: 2px solid #d7dfed;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.project-card:hover { border-color: #5f8de6; box-shadow: 0 8px 24px rgba(15, 76, 201, 0.14); }
.project-card h3 { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); margin-bottom: 0.3rem; word-break: break-word; }
.project-meta { color: var(--text-muted); font-size: 0.92rem; margin-top: 0.25rem; }
.tags { display: flex; gap: 0.4rem; margin-top: 0.75rem; flex-wrap: wrap; }
.tag { font-size: 0.73rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 9999px; }
.tag-blue { background: #eff6ff; color: #1d4ed8; }
.tag-gray { background: #f1f5f9; color: #475569; }
.project-delete-btn {
  position: absolute; top: 0.75rem; right: 0.75rem;
  opacity: 0; transition: opacity 0.15s;
}
.project-card:hover .project-delete-btn { opacity: 1; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 4rem 1rem; color: #94a3b8; }
.empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-title { font-size: 1.05rem; font-weight: 600; color: #64748b; }
.empty-hint { font-size: 0.875rem; margin-top: 0.3rem; color: #94a3b8; }

/* ===== SUMMARY ===== */
.summary-card { margin-bottom: 1.5rem; }
.summary-title { font-size: 0.9rem; font-weight: 800; color: #334155; margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 0.04em; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; text-align: center; }
@media (max-width: 480px) { .summary-grid { grid-template-columns: repeat(2, 1fr); } }
.summary-value { font-size: 1.8rem; font-weight: 900; color: var(--brand); }
.summary-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; font-weight: 600; }

/* ===== WALLS LIST ===== */
.walls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; }
.wall-card {
  background: #fff; border-radius: 0.9rem; padding: 1rem;
  border: 2px solid #d7dfed; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 0.75rem; transition: all 0.15s;
}
.wall-card:hover { border-color: #5f8de6; }
.wall-card-body { flex: 1; min-width: 0; }
.wall-card h4 { font-weight: 800; color: var(--text-primary); margin-bottom: 0.3rem; word-break: break-word; }
.wall-meta { font-size: 0.9rem; color: var(--text-muted); line-height: 1.7; }
.wall-openings-hint { font-size: 0.78rem; color: #1d4ed8; margin-top: 0.25rem; }

/* ===== FORM ===== */
.form-group { margin-bottom: 0.9rem; }
.form-label { display: block; font-size: 0.86rem; font-weight: 700; color: #334155; margin-bottom: 0.28rem; }
.form-input {
  width: 100%; padding: 0.7rem 0.72rem; border: 2px solid #b7c4da; border-radius: 0.6rem;
  font-size: 1rem; background: #fff; transition: border-color 0.15s; min-height: 52px;
  font-family: inherit; color: var(--text-primary); font-weight: 600;
}
.form-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,76,201,0.16); }

/* ===== WALL FORM GRID ===== */
.wall-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
@media (max-width: 580px) { .wall-form-grid { grid-template-columns: 1fr; } }
.wall-form-grid .full-width { grid-column: 1 / -1; }

/* ===== WALL EDITOR LAYOUT ===== */
.wall-editor-container {
  display: grid;
  grid-template-columns: minmax(350px, 450px) 1fr;
  gap: 1.4rem;
  max-width: none;
  align-items: stretch;
  height: calc(100vh - 80px - 3rem);
}
@media (max-width: 1200px) { .wall-editor-container { grid-template-columns: 1fr; gap: 1.5rem; height: auto; align-items: start; } }
.wall-editor-form { min-width: 0; max-height: 100%; overflow-y: auto; padding-right: 0.5rem; }
.wall-editor-preview { min-width: 0; display: flex; flex-direction: column; }
.wall-editor-preview .card { display: flex; flex-direction: column; height: 100%; max-height: none; position: static; }
.wall-preview-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; border: 1px solid #dbe4f0; border-radius: 0.6rem; background: #f8fafc; padding: 0.75rem; position: relative; overflow: auto; }
#wall-preview-svg { flex: 1; width: 100%; height: 100%; display: block; background: transparent; border-radius: 0.4rem; border: 1px solid #e2e8f0; cursor: grab; user-select: none; transition: transform 0.1s ease-out; }
#wall-preview-svg:active { cursor: grabbing; }
.preview-legend { overflow-y: auto; flex-shrink: 0; padding-top: 1rem; border-top: 1px solid #ddd; }
@media (max-width: 1200px) {
  .wall-editor-form { max-height: none; overflow-y: visible; }
  .wall-editor-preview .card { position: static; max-height: none; }
  .wall-preview-wrap { height: auto; aspect-ratio: 1000 / 520; min-height: auto; }
  #wall-preview-svg { aspect-ratio: 1000 / 520; }
}

/* ===== OPENINGS ===== */
.opening-row {
  background: #f8fafc; border-radius: 0.5rem; padding: 0.875rem;
  border: 1px solid #e2e8f0; margin-bottom: 0.75rem;
}
.opening-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 0.6rem; }
@media (max-width: 540px) { .opening-grid { grid-template-columns: 1fr 1fr; } }

/* ===== COMPACT INPUT VIEW ===== */
.input-compact-preview {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}
.input-compact-preview h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.5rem;
}
.compact-table {
  width: 100%;
  font-size: 0.75rem;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
  table-layout: fixed;
}
.compact-table th {
  text-align: left;
  padding: 0.35rem 0.5rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  color: #64748b;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.compact-table th:first-child,
.compact-table td:first-child {
  width: 2rem;
  text-align: center;
}
.compact-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  white-space: nowrap;
}
.compact-table .opening-selected-row {
  background: #eff6ff;
}
.compact-table .opening-selected-row td {
  border-bottom-color: #bfdbfe;
}
.compact-empty {
  text-align: center;
  color: #94a3b8;
}
@media (max-width: 768px) {
  .wall-editor-form { padding-right: 0; }
  .card { padding: 0.7rem; }
  .section-header { margin-bottom: 0.45rem; }
  .opening-row {
    padding: 0.55rem;
    margin-bottom: 0.4rem;
  }
  .opening-grid {
    gap: 0.45rem;
    margin-bottom: 0.4rem;
  }
  .compact-mobile-cards thead { display: none; }
  .compact-mobile-cards,
  .compact-mobile-cards tbody,
  .compact-mobile-cards tr,
  .compact-mobile-cards td {
    display: block;
    width: 100%;
  }
  .compact-mobile-cards tr {
    border: 1px solid #e2e8f0;
    border-radius: 0.35rem;
    background: #fff;
    padding: 0.18rem 0.3rem;
    margin-bottom: 0.2rem;
  }
  .compact-mobile-cards td {
    border: 0;
    padding: 0.05rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    font-size: 0.65rem;
    line-height: 1.2;
  }
  .compact-mobile-cards td::before {
    content: attr(data-label);
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .compact-mobile-cards .td-actions {
    display: none;
  }
  .compact-mobile-cards .compact-empty {
    display: block;
    text-align: center;
  }
}

/* ===== WALL PREVIEW ===== */
.preview-header { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 0.75rem 0; flex-wrap: wrap; }
.preview-title { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); flex: 1; min-width: 150px; }
.preview-controls { display: flex; gap: 0.5rem; }
.preview-btn {
  padding: 0.55rem 0.9rem;
  font-size: 1rem;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 0.6rem;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 46px;
  font-family: inherit;
  font-weight: 700;
  color: #334155;
}
.preview-btn:hover { background: #e2e8f0; }
.preview-btn:active { transform: scale(0.97); }

.preview-layer-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.65rem 0;
}

.preview-layer-item {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.35rem 0.55rem;
  background: #f8fafc;
  border: 1px solid #d5dfef;
  border-radius: 999px;
}

.preview-layer-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  cursor: pointer;
}

.preview-layer-item label {
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
}
@media (max-width: 1200px) {
  #wall-preview-svg { aspect-ratio: 1000 / 520; height: auto; }
}
#wall-preview-svg.fullscreen-active {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; aspect-ratio: auto; border-radius: 0; z-index: 9999; background: transparent;
}
#preview-fullscreen-dialog {
  border: none; border-radius: 0.875rem; padding: 0; max-width: 100vw; width: 100vw; height: 100vh; max-height: 100vh;
}
#preview-fullscreen-dialog::backdrop { background: rgba(0,0,0,0.5); }
.preview-fullscreen-header {
  position: absolute; top: 1rem; right: 1rem; z-index: 10000; display: flex; gap: 0.5rem;
}
.preview-fullscreen-close {
  padding: 0.6rem 1.2rem; background: #fff; border: none; border-radius: 0.5rem; cursor: pointer; font-weight: 600; font-size: 0.9rem; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.preview-fullscreen-close:hover { background: #f1f5f9; }
.preview-legend { margin-top: 0.75rem; font-size: 0.8rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.legend-item { display: flex; align-items: center; gap: 0.35rem; }
.legend-color { width: 16px; height: 16px; border-radius: 2px; }

/* ===== SPECIFICATION ===== */
.preview-spec { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid #e2e8f0; }
.preview-spec h4 { font-size: 0.85rem; font-weight: 700; color: #334155; margin-bottom: 0.5rem; }
.spec-table { width: 100%; font-size: 0.75rem; border-collapse: collapse; }
.spec-table th { text-align: left; padding: 0.35rem 0.5rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-weight: 600; color: #64748b; }
.spec-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid #f1f5f9; }
.spec-table tr:hover { background: #f8fafc; }


/* ===== FORM ACTIONS ===== */
.form-actions {
  display: flex; gap: 0.75rem; flex-wrap: wrap;
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #e2e8f0;
}

/* ===== DIALOG ===== */
dialog {
  border: none; border-radius: 0.875rem; padding: 0;
  max-width: min(92vw, 440px); width: 100%; max-height: 92vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
dialog::backdrop { background: rgba(15,23,42,0.55); }
.dialog-body { padding: 1.75rem; }
.dialog-body h2 { font-size: 1.2rem; font-weight: 800; color: #1e293b; margin-bottom: 1.25rem; }
.dialog-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.dialog-actions .btn { flex: 1; }

/* ===== TOAST ===== */
#toast-container {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; align-items: center;
  gap: 0.5rem; pointer-events: none;
}
.toast {
  padding: 0.6rem 1.2rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18); animation: fadeIn 0.2s ease; white-space: nowrap;
}
.toast-success { background: #16a34a; color: #fff; }
.toast-error { background: #dc2626; color: #fff; }
.toast-info { background: #1e40af; color: #fff; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.2s ease; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }

/* ===== SUBSCRIBE SECTION ===== */
.subscribe-section {
  margin-top: 2.5rem;
  padding: 2rem 1.5rem;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: 0.75rem;
  text-align: center;
}
.subscribe-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.subscribe-section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 0.4rem;
}
.subscribe-section > p {
  color: #475569;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.subscribe-form-row {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
  margin: 0 auto;
}
.subscribe-email-input { flex: 1; min-width: 0; }
.subscribe-success { color: #16a34a; font-weight: 600; font-size: 1rem; margin-top: 0.75rem; }
.subscribe-error { color: #dc2626; font-size: 0.875rem; margin-top: 0.75rem; }
@media (max-width: 480px) {
  .subscribe-form-row { flex-direction: column; }
}

.wall-form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

@media (max-width: 900px) {
  .header-inner {
    padding: 0.65rem 0.75rem;
    gap: 0.6rem;
  }

  .header-left,
  .header-right {
    width: 100%;
  }

  .header-right {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.2rem;
  }

  .logo img {
    height: 46px;
  }

  .screen-content {
    padding: 1rem 0.7rem 5.8rem;
  }

  .screen-content.wall-editor-screen {
    padding: 0.85rem 0.55rem 6.2rem;
  }

  .section-header h1 {
    font-size: 1.55rem;
  }

  .section-header h2 {
    font-size: 1.22rem;
  }

  .projects-grid,
  .walls-grid,
  .wall-form-grid {
    grid-template-columns: 1fr;
  }

  .wall-form-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.96);
    border-top: 2px solid #d8e1f0;
    backdrop-filter: blur(4px);
  }

  .wall-form-actions .btn {
    width: 100%;
  }

  .wall-form-actions .btn-danger {
    grid-column: 1 / -1;
  }

  .preview-controls {
    width: 100%;
    justify-content: space-between;
  }

  .preview-btn {
    flex: 1;
    min-width: 0;
  }

  #preview-zoom-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    font-size: 0.95rem;
    font-weight: 700;
  }

  .preview-layer-item {
    width: 100%;
    justify-content: flex-start;
    border-radius: 0.75rem;
    padding: 0.45rem 0.6rem;
  }

  .preview-layer-item label {
    font-size: 0.96rem;
  }

  .form-input,
  .btn,
  .toggle-group button,
  .preview-btn {
    min-height: 54px;
  }
}

/* ===== CHANGELOG DIALOG =====*/

/* ===== FIELD LAYOUT OVERRIDE (v2) ===== */
:root {
  --field-canvas: #e8e6df;
  --field-surface: #f7f5ef;
  --field-panel: #f0ede6;
  --field-line: #c0b9ab;
  --field-line-strong: #8c8473;
  --field-ink: #1f1c17;
  --field-muted: #5c574d;
  --field-accent: #c96f00;
  --field-accent-strong: #9a5400;
}

body {
  color: var(--field-ink);
  background:
    linear-gradient(90deg, rgba(128, 120, 102, 0.09) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(rgba(128, 120, 102, 0.09) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--field-canvas);
}

header {
  background: #171412;
  border-bottom: 1px solid #3a3329;
  backdrop-filter: none;
}

.header-inner {
  max-width: 1160px;
  padding: 0.55rem 0.8rem;
}

#project-title-header {
  background: transparent;
  color: #dbd3c6;
  padding: 0;
}

.header-support-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.toggle-group button,
#btn-changelog,
#btn-install,
#btn-back {
  background: #262019;
  color: #f3efe7;
  border: 1px solid #4e463a;
  border-radius: 0.2rem;
  min-height: 40px;
}

.toggle-group button.active {
  background: var(--field-accent);
  border-color: var(--field-accent);
  color: #fff;
}

.btn {
  border-radius: 0.2rem;
  min-height: 46px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.btn-primary {
  background: var(--field-accent);
  border-color: var(--field-accent);
}

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

.btn-secondary {
  background: #e8e3d8;
  border-color: #b6ac97;
  color: #312d24;
}

.btn-danger {
  background: #a2372f;
  border-color: #8f2c25;
}

.screen-content,
.screen-content.wall-editor-screen {
  max-width: 1160px;
}

.section-header h1,
.section-header h2 {
  color: #262118;
  letter-spacing: 0.02em;
}

.section-subtitle {
  color: var(--field-muted);
}

.beta-banner {
  background: #f7d88c;
  border-bottom: 1px solid #c69624;
  color: #5b3f06;
}

.card,
.project-card,
.wall-card,
.opening-row,
dialog {
  background: var(--field-surface);
  border: 1px solid var(--field-line);
  border-radius: 0.2rem;
  box-shadow: none;
}

.wall-editor-container {
  grid-template-columns: minmax(360px, 430px) 1fr;
  height: auto;
  align-items: start;
}

.wall-editor-form,
.wall-editor-preview {
  gap: 0.7rem;
}

.wall-editor-form .card,
.wall-editor-preview .card {
  background: var(--field-surface);
}

.form-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5a5245;
}

.form-input {
  min-height: 44px;
  border: 1px solid #b8af9d;
  border-radius: 0.12rem;
  background: #efebe2;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f1c17;
}

.preview-header {
  margin-bottom: 0.45rem;
}

.preview-controls {
  margin-left: auto;
}

.preview-btn {
  border-radius: 0.16rem;
  min-height: 40px;
  border: 1px solid #b7ae9f;
  background: #e7e1d5;
}

.preview-zoom-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  font-size: 0.85rem;
  color: #5f594d;
  font-weight: 700;
}

.preview-mode-tabs {
  display: inline-flex;
  border: 1px solid #b7ae9f;
  margin: 0 auto 0.7rem;
  width: fit-content;
}

.preview-mode-tab {
  border: 0;
  background: #ece7dd;
  color: #50493e;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.42rem 0.95rem;
}

.preview-mode-tab.active {
  background: #1f1b17;
  color: #fff;
}

.preview-layer-toggles {
  background: var(--field-panel);
  border: 1px solid #c4bbac;
  padding: 0.55rem;
}

.preview-layer-item {
  border: 1px solid #c5beaf;
  background: #ece7dd;
  border-radius: 0.2rem;
}

.preview-legend {
  border-top: 1px solid #c8bfaf;
  color: #574f43;
}

.preview-spec {
  border-top: 1px solid #c8bfaf;
}

.preview-spec h4 {
  color: #352f25;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
}

.spec-table th,
.compact-table th {
  background: #e5dfd2;
  border-bottom: 1px solid #b9b09f;
  color: #514a3f;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.68rem;
}

.spec-table td,
.compact-table td {
  border-bottom: 1px solid #d5cdbf;
}

.opening-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
  gap: 0.5rem;
}

.opening-toolbar-title {
  font-size: 0.74rem;
  color: #4a4439;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.opening-editor-panel {
  margin-top: 0.75rem;
  border-top: 1px solid #c6bfae;
  padding-top: 0.75rem;
}

.opening-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.opening-table-row {
  cursor: pointer;
}

.opening-selected-row {
  background: #d9e3f1;
}

.wall-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  background: var(--field-panel);
  border: 1px solid #c2b9ab;
  padding: 0.7rem;
  margin-bottom: 0.9rem;
}

.wall-overview-item {
  border-bottom: 1px dotted #b5ab99;
  padding-bottom: 0.35rem;
}

.wall-overview-label {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #645d50;
  font-weight: 800;
}

.wall-overview-value {
  font-size: 1rem;
  color: #221f19;
  font-weight: 700;
  margin-top: 0.15rem;
}

.wall-overview-edit {
  width: 100%;
}

@media (max-width: 980px) {
  .header-support-link {
    display: none;
  }

  .screen-content,
  .screen-content.wall-editor-screen {
    padding: 0.7rem 0.45rem 5.8rem;
  }

  .wall-editor-container {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }

  .wall-editor-preview {
    order: 1;
  }

  .wall-editor-form {
    order: 2;
    padding-right: 0;
  }

  .card,
  .project-card,
  .wall-card {
    padding: 0.75rem;
  }

  .preview-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .preview-btn,
  .btn,
  .form-input,
  .toggle-group button {
    min-height: 56px;
  }

  .wall-form-actions {
    grid-template-columns: 1fr 1fr;
    background: #f3efe6;
    border-top: 1px solid #bcb4a7;
    gap: 0.45rem;
    padding: 0.5rem;
  }

  .wall-form-actions .btn-danger {
    grid-column: 1 / -1;
  }

  .opening-grid {
    grid-template-columns: 1fr;
  }

  .wall-overview-grid {
    grid-template-columns: 1fr;
  }
}
