﻿:root {
  color-scheme: light;
  --ink: #0f1a1c;
  --muted: #59636a;
  --accent: #ff6b35;
  --accent-deep: #cc3b06;
  --surface: #f6f1e9;
  --surface-2: #efe5d8;
  --surface-3: #ffffff;
  --stroke: #dccfbe;
  --shadow: 0 20px 40px rgba(15, 26, 28, 0.12);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --display: "Space Grotesk", "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--display);
  color: var(--ink);
  background: radial-gradient(circle at top left, #ffe6d7 0, #f6f1e9 45%, #f0e7dc 100%);
  min-height: 100vh;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
}

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

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-weight: 500;
  box-shadow: var(--shadow);
}

.brand-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px;
  box-shadow: inset 0 0 0 1px var(--stroke);
}

.segmented-btn {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s ease;
}

.segmented-btn.is-active {
  background: var(--surface-3);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.segmented-btn:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
}

.ghost {
  background: transparent;
  border: 1px solid var(--stroke);
  padding: 8px 16px;
  border-radius: 12px;
  font-family: var(--display);
  font-weight: 600;
  cursor: pointer;
}

.ghost:hover {
  background: var(--surface-2);
  border-color: var(--muted);
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ghost:active {
  background: var(--surface);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 24px;
  padding: 28px 32px 36px;
  flex: 1;
}

.pane {
  display: flex;
  flex-direction: column;
  background: var(--surface-3);
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--stroke);
  overflow: hidden;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--stroke);
  background: var(--surface);
}

.pane-header h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.status {
  font-size: 12px;
  color: var(--muted);
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 6px;
  transition: background 0.2s ease;
  vertical-align: middle;
}

.status--ok .status-dot   { background: #3dba6f; }
.status--busy .status-dot { background: #f0a020; }
.status--error .status-dot{ background: #e03e3e; }

textarea {
  flex: 1;
  border: none;
  resize: none;
  padding: 20px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  background: var(--surface-3);
  color: var(--ink);
}

textarea:focus {
  outline: none;
}

.preview-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #fff8f2, #f1e4d5);
  padding: 16px;
}

.preview-stage img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 16px 30px rgba(15, 26, 28, 0.15);
  background: #fff;
}

#preview-image {
  transition: opacity 0.2s ease;
}

.preview-shimmer {
  position: absolute;
  inset: 20px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.preview-stage.is-loading .preview-shimmer {
  opacity: 1;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.preview-error {
  position: absolute;
  inset: 20px;
  border-radius: 16px;
  border: 1px dashed var(--accent-deep);
  background: rgba(255, 246, 240, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--accent-deep);
}

.preview-error-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.cheatsheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 26, 28, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 20;
}

.cheatsheet-panel {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: 24px;
  width: min(520px, 92vw);
  background: var(--surface-3);
  border-radius: 24px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transform: translateX(110%);
  transition: transform 0.3s ease;
  z-index: 30;
  overflow: hidden;
}

.cheatsheet-open .cheatsheet-overlay {
  opacity: 1;
  pointer-events: auto;
}

.cheatsheet-open .cheatsheet-panel {
  transform: translateX(0);
}

.cheatsheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--stroke);
  background: var(--surface);
}

.cheatsheet-title {
  font-size: 18px;
  font-weight: 600;
}

.cheatsheet-sub {
  font-size: 12px;
  color: var(--muted);
}

.cheatsheet-content {
  padding: 16px 20px 24px;
  overflow-y: auto;
  display: grid;
  gap: 18px;
}

.cheatsheet-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cheatsheet-section pre {
  margin: 0;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--stroke);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}


.cheatsheet-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cheatsheet-section-header h3 {
  margin: 0;
}

.use-snippet {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 8px;
}

.preview-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
@media (max-width: 960px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

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

  .cheatsheet-panel {
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-radius: 0;
  }
}


