@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");
@import url("https://fonts.googleapis.com/css2?family=Syne:wght@700&display=swap");

:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --line: #2c3846;
  --text: #eef3f8;
  --muted: #9aabbc;
  --accent: #3dcea7;
  --accent2: #f0a45d;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1d3b36 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #3a2a1d 0%, transparent 50%),
    var(--bg);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: row;
}

a.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 80;
  background: var(--accent);
  color: #06251c;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
}
a.skip-link:focus { left: 12px; }

nav.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px 24px;
  border-right: 1px solid var(--line);
  background: #121820;
  overflow-y: auto;
}
nav.sidebar .brand {
  font-family: Syne, sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 6px 12px 12px;
  color: var(--text);
  text-decoration: none;
  display: block;
}
nav.sidebar .brand:hover { color: var(--accent); }
nav.sidebar .nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 8px;
}
nav.sidebar .nav-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 12px;
  margin: 0;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
nav.sidebar .nav-section-toggle:hover { filter: brightness(1.08); }
nav.sidebar .nav-section-chevron {
  width: 0.55em;
  height: 0.55em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.75;
  flex: 0 0 auto;
  transition: transform .15s ease;
}
nav.sidebar .nav-section.open .nav-section-chevron {
  transform: rotate(45deg);
}
nav.sidebar .nav-section[data-group="만들기"] .nav-section-toggle {
  background: #1a3a34;
  border-color: #2a524a;
  color: #9fe0cd;
}
nav.sidebar .nav-section[data-group="재료"] .nav-section-toggle {
  background: #2a3140;
  border-color: #3d4a5c;
  color: #c5d4e6;
}
nav.sidebar .nav-section[data-group="올리기"] .nav-section-toggle {
  background: #3a2f22;
  border-color: #5a4632;
  color: #f0c49a;
}
nav.sidebar .nav-section[data-group="관리"] .nav-section-toggle {
  background: #2a2436;
  border-color: #433a55;
  color: #d4c8e8;
}
nav.sidebar .nav-section-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 2px 4px;
}
nav.sidebar .nav-section-items[hidden] { display: none !important; }
nav.sidebar a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: .9rem;
  padding: 8px 12px;
  border-radius: 10px;
}
nav.sidebar a:hover { color: var(--text); background: #1c2836; }
nav.sidebar a.on { color: var(--accent); background: #16352e; }
nav.sidebar .nav-user {
  margin-top: auto;
  padding: 14px 8px 4px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}
nav.sidebar .nav-user-name {
  font-size: .82rem;
  color: var(--muted);
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
nav.sidebar .nav-logout {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  background: #2a3644;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
  text-align: left;
}
nav.sidebar .nav-logout:hover { background: #3a1f1f; color: #ffd4d4; }
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 16, 0.55);
  z-index: 35;
}
.nav-toggle {
  display: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  background: #2a3644;
  color: var(--text);
  font-family: inherit;
  font-size: .85rem;
}

.app {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app > header {
  flex: 0 0 auto;
  width: 100%;
  padding: 16px 28px 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}
.app > header h1 {
  font-family: Syne, sans-serif;
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  margin: 4px 0 4px;
  letter-spacing: -0.03em;
}

.app-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 28px;
  border-bottom: 1px solid var(--line);
  background: #121820;
  min-height: 36px;
}
.app-status-text {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-status.is-busy .app-status-text { color: var(--accent2); }
.app-status.is-error .app-status-text { color: #ffb4b4; }
.app-status.is-ok .app-status-text { color: var(--accent); }

.log-details {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1015;
  padding: 0 12px 8px;
}
.log-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: .82rem;
  color: var(--muted);
  padding: 10px 0;
}
.log-details #log,
.log-details #list-log,
.log-details #make-log,
.log-details .log {
  min-height: 0;
  margin-top: 0;
  border: 0;
  padding: 0 0 8px;
  background: transparent;
  max-height: 180px;
  overflow: auto;
}

.make-steps {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.make-steps button {
  border: 1px solid var(--line);
  background: #121820;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  font-family: inherit;
}
.make-steps button.on {
  background: var(--accent);
  color: #06251c;
  border-color: var(--accent);
}
.make-steps button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.make-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0 0;
}
.make-bar .hint {
  color: var(--muted);
  font-size: .85rem;
}
.defaults-panel {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #121820;
  padding: 4px 14px 14px;
}
.defaults-panel summary {
  cursor: pointer;
  font-weight: 700;
  padding: 12px 0;
  list-style: none;
}
.defaults-panel summary::-webkit-details-marker { display: none; }
.defaults-panel .defaults-line {
  font-weight: 400;
  color: var(--muted);
  font-size: .85rem;
  margin-left: 8px;
}
.topic-search {
  width: min(360px, 100%);
  margin: 0 0 12px;
  background: #0b1015;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
}
[hidden] { display: none !important; }
.model-price {
  color: var(--accent2);
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 2px;
}
.topic-mode-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.make-bar .actions { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; margin-bottom: 8px; }
  nav.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform .18s ease;
    box-shadow: none;
  }
  nav.sidebar.open { transform: translateX(0); }
  .nav-backdrop.show { display: block; }
  .app > header, .app-status, main { padding-left: 16px; padding-right: 16px; }
}
