@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --bg-base: #090d16;
  --bg-card: rgba(18, 24, 38, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(56, 189, 248, 0.4);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #38bdf8;
  --accent-purple: #c084fc;
  --accent-amber: #fbbf24;
  --gradient-main: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(192, 132, 252, 0.08) 0%, transparent 45%);
}

/* Header */
.app-header {
  padding: 2rem 3rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}

.app-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.app-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 750px;
  line-height: 1.5;
}

.app-subtitle code {
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Feature Detection Banner */
#api-warning-banner {
  display: none; /* toggled via JS */
  max-width: 1500px;
  width: calc(100% - 6rem);
  margin: 0.5rem auto 1rem;
  padding: 1rem 1.5rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  color: #fde68a;
  font-size: 0.95rem;
  line-height: 1.5;
  backdrop-filter: blur(12px);
  animation: slideDown 0.4s ease-out;
}

#api-warning-banner code {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  color: var(--accent-amber);
  font-weight: 600;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Main Content Layout */
.app-main {
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 2rem;
  padding: 0 3rem 3rem;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}

/* Sidebar / Controls Card */
.control-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  backdrop-filter: blur(20px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  height: fit-content;
}

.panel-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-title::before {
  content: '';
  width: 8px;
  height: 20px;
  background: var(--gradient-main);
  border-radius: 4px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.control-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
}

.control-label span.val {
  color: var(--accent-blue);
  font-weight: 700;
}

/* Custom Inputs & Selects */
.path-shape-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.shape-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.6rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.shape-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.shape-btn.active {
  color: var(--text-primary);
  background: var(--gradient-main);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

select.control-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

select.control-select:hover,
select.control-select:focus {
  border-color: var(--border-hover);
}

/* Sliders */
input[type="range"].control-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
}

input[type="range"].control-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-blue);
  transition: transform 0.15s ease;
}

input[type="range"].control-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Tips Box */
.tips-box {
  background: rgba(56, 189, 248, 0.05);
  border: 1px dashed rgba(56, 189, 248, 0.25);
  border-radius: 14px;
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tips-box strong {
  color: var(--accent-blue);
  display: block;
  margin-bottom: 0.3rem;
}

/* Canvas Display Card */
.canvas-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  min-height: 640px;
}

canvas#editor-canvas {
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.35) 0%, rgba(15, 23, 42, 0.8) 100%);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: text;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
  max-width: 100%;
  height: auto;
}

/* Hidden Textarea for IME/Mobile Input */
textarea#hidden-input {
  position: absolute;
  top: -1000px;
  left: -1000px;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 1100px) {
  .app-main {
    grid-template-columns: 1fr;
  }
  .app-header, .app-main {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  #api-warning-banner {
    width: calc(100% - 3rem);
  }
}
