:root {
  color-scheme: dark;
  --bg: #121212;
  --panel: #1e1e1e;
  --panel-soft: #242424;
  --text: #f4f4f4;
  --muted: #a8a8a8;
  --line: #3a3a3a;
  --accent: #ef7f2d;
  --accent-strong: #ff9448;
  --field: #191919;
}

:root.light {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-soft: #eeeeee;
  --text: #151515;
  --muted: #555555;
  --line: #d4d4d4;
  --accent: #d86516;
  --accent-strong: #b64d08;
  --field: #fafafa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 2rem);
  letter-spacing: 0;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab-button,
button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 7px 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.tab-button {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.tab-button.active {
  background: var(--accent);
  color: #111111;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.1rem;
}

.tab-panel {
  display: none;
  min-height: 560px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 0;
}

.tab-panel.active {
  display: block;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.single-field {
  display: block;
  max-width: 360px;
  margin-bottom: 16px;
}

label {
  color: var(--muted);
  font-size: 0.92rem;
}

select,
input {
  display: block;
  width: 100%;
  height: 38px;
  margin-top: 6px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  padding: 0 10px;
}

input[readonly] {
  color: var(--muted);
}

.output {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  padding: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.output.small {
  min-height: 150px;
}

.uuid-layout {
  max-width: 900px;
}

.uuid-layout button {
  margin: 2px 0 12px;
}

.uuid-fields {
  margin-top: 18px;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1100px);
    padding: 10px 0;
  }

  .topbar {
    align-items: flex-start;
  }

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

  .tab-panel {
    padding: 12px;
  }
}
