:root {
  --bg: #f2f6fb;
  --surface: rgba(255, 255, 255, 0.97);
  --surface-strong: #ffffff;
  --surface-soft: #f7fafe;
  --text: #10233f;
  --muted: #5f718a;
  --border: #d8e2ef;
  --shadow: 0 14px 36px rgba(15, 34, 62, 0.06);
  --primary: #0f6fff;
  --primary-dark: #0b57cc;
  --secondary: #1f3f6b;
  --accent: #2257ae;
  --accent-soft: #edf4ff;
  --ok-bg: #e8f8ef;
  --ok-text: #17623d;
  --info-bg: #edf5ff;
  --info-text: #215491;
  --error-bg: #ffe9ec;
  --error-text: #a42838;
  --ring: rgba(15, 111, 255, 0.2);
  --app-shell-max: 1400px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", "Noto Sans KR", sans-serif;
  background:
    radial-gradient(circle at 18% -8%, rgba(220, 232, 255, 0.9), transparent 34%),
    radial-gradient(circle at 92% 0%, rgba(233, 247, 255, 0.95), transparent 30%),
    linear-gradient(180deg, #f5f9ff 0%, #edf4fb 100%);
}

button,
input,
a {
  font: inherit;
}

button,
.download-button {
  border: none;
  border-radius: 12px;
  padding: 0.72rem 1rem;
  font-weight: 700;
  text-decoration: none;
  color: #ffffff;
  background: var(--primary);
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

button:hover:not(:disabled),
.download-button:hover {
  background: var(--primary-dark);
}

button:disabled,
.download-button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

button.ghost {
  border: 1px solid #b8c9df;
  color: var(--text);
  background: transparent;
}

button.ghost:hover:not(:disabled) {
  background: #f4f8fd;
}

input[type="file"],
input[type="number"] {
  width: 100%;
  border: 1px solid #c6d4e6;
  border-radius: 12px;
  padding: 0.72rem 0.82rem;
  background: var(--surface-strong);
  color: inherit;
}

input:focus-visible,
button:focus-visible,
.preset-card:focus-visible,
.toggle-card:focus-within {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.layout {
  display: grid;
  gap: 1rem;
  padding-bottom: 1.5rem;
}

.panel,
.sidebar-card,
.detail-card {
  border: 1px solid rgba(216, 226, 239, 0.92);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
}

.panel-head {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.panel-head--compact {
  gap: 0.55rem;
}

.panel h2,
.panel h3,
.detail-card h2 {
  margin: 0;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.small {
  font-size: 0.92rem;
}

.badge-row,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.34rem 0.72rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge {
  border: 1px solid #d2e2ff;
  background: var(--accent-soft);
  color: var(--accent);
}

.badge--ok {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: #c3e9d0;
}

.status-badge {
  border: 1px solid #d7deea;
  background: #f5f7fb;
  color: #51627a;
}

.status-badge--ok {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: #c3e9d0;
}

.status-badge--running {
  background: #fff6de;
  color: #8a5d12;
  border-color: #ecd59d;
}

.status-badge--error {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: #f0c4cb;
}

.workspace-grid {
  display: grid;
  gap: 1rem;
}

.composer-panel,
.sidebar-panel {
  min-width: 0;
}

.sidebar-panel {
  align-content: start;
}

.form-stack,
.result-stack {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.5rem;
}

.field > span {
  font-weight: 700;
}

.file-card,
.download-card,
.empty-state,
.sidebar-card {
  background: var(--surface-soft);
}

.file-card,
.download-card,
.empty-state,
.sidebar-card,
.detail-card {
  border-radius: 18px;
  border: 1px solid rgba(216, 226, 239, 0.88);
}

.file-card,
.download-card,
.empty-state,
.sidebar-card {
  padding: 1rem;
}

.empty-state {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
}

.inline-grid,
.toggle-grid,
.detail-grid {
  display: grid;
  gap: 0.9rem;
}

.preset-grid {
  display: grid;
  gap: 0.75rem;
}

.preset-card {
  display: grid;
  gap: 0.4rem;
  align-items: start;
  text-align: left;
  border: 1px solid #c6d4e6;
  border-radius: 18px;
  padding: 0.95rem;
  color: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 254, 0.98)),
    var(--surface-soft);
}

.preset-card strong {
  display: block;
}

.preset-card small {
  color: var(--muted);
  line-height: 1.5;
}

.preset-card.is-active {
  border-color: rgba(15, 111, 255, 0.38);
  box-shadow: inset 0 0 0 1px rgba(15, 111, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(15, 111, 255, 0.1), rgba(255, 255, 255, 0.98)),
    var(--surface-soft);
}

.toggle-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
  padding: 0.9rem;
  border: 1px solid #d2deed;
  border-radius: 18px;
  background: #f8fbff;
}

.toggle-card input {
  margin-top: 0.25rem;
  inline-size: 1rem;
  block-size: 1rem;
}

.toggle-card span {
  display: grid;
  gap: 0.3rem;
}

.toggle-card strong {
  font-size: 0.98rem;
}

.toggle-card small {
  color: var(--muted);
  line-height: 1.45;
}

.message {
  border-radius: 16px;
  padding: 0.82rem 0.92rem;
  border: 1px solid transparent;
  line-height: 1.5;
}

.message--info {
  color: var(--info-text);
  background: var(--info-bg);
  border-color: #cedef7;
}

.message--error {
  color: var(--error-text);
  background: var(--error-bg);
  border-color: #f0c4cb;
}

.preview-shell {
  position: relative;
  min-height: 260px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(15, 34, 62, 0.04), rgba(15, 34, 62, 0.08)),
    #eff5fd;
  border: 1px dashed #c3d3e6;
  overflow: hidden;
}

.preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
}

.fact-list {
  display: grid;
  gap: 0.62rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fact-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.72rem 0.82rem;
  border-radius: 14px;
  background: #fafcff;
  border: 1px solid rgba(216, 226, 239, 0.9);
}

.fact-list span:first-child {
  color: var(--muted);
}

.fact-list strong {
  text-align: right;
}

.download-card {
  display: grid;
  gap: 0.8rem;
}

.download-button {
  text-align: center;
}

.detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 0;
}

.detail-card {
  padding: 1.1rem;
  background: rgba(247, 250, 254, 0.94);
}

.detail-card ul {
  margin: 0.9rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.65;
}

.detail-card p {
  margin: 0.9rem 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.detail-card ol {
  margin: 0.9rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.65;
}

.detail-card details {
  margin-top: 0.65rem;
  border: 1px solid rgba(216, 226, 239, 0.98);
  border-radius: 14px;
  padding: 0.72rem 0.8rem;
  background: rgba(255, 255, 255, 0.88);
}

.detail-card summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}

.detail-card details p {
  margin-top: 0.45rem;
}

.updated-at {
  font-size: 0.95rem;
}

.tool-footer {
  padding-bottom: 1.5rem;
}

.tool-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.tool-footer__nav a {
  color: var(--secondary);
  text-decoration: none;
}

.tool-footer__note {
  margin: 0.9rem 0 0;
  color: var(--muted);
}

@media (min-width: 880px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.95fr);
  }

  .inline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toggle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 879px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
