@font-face {
  font-family: "Hobbiton Brushhand";
  src: url("https://db.onlinewebfonts.com/t/02e58ddc3171ec36a8ff7cbdfabea119.woff2")
      format("woff2"),
    url("https://db.onlinewebfonts.com/t/02e58ddc3171ec36a8ff7cbdfabea119.woff")
      format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #090909;
  --card: #111111;
  --ink: #f0ece1;
  --muted: #b8afa1;
  --accent: #bb8a41;
  --line: #2f2b25;
  --field: #1a1a1a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1rem 0;
}

h1,
h2 {
  margin: 0 0 0.6rem;
}

p {
  margin: 0;
}

.layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding-bottom: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.full-width {
  grid-column: 1 / -1;
}

.studio-fullbleed {
  width: calc(100vw - 2.2rem);
  margin-left: calc(50% - 50vw + 1.1rem);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
}

.inline-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

input,
textarea,
select,
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  padding: 0.55rem 0.7rem;
  background: var(--field);
  color: var(--ink);
}

button {
  cursor: pointer;
  background: #1f1b17;
}

button:hover {
  border-color: var(--accent);
  color: #fff0d0;
}

.button-row {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.button-row.tight {
  margin-top: 0.5rem;
}

.hidden-control {
  display: none !important;
}

.crop-tools {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.toggle-chip {
  display: inline-flex;
  width: 100%;
}

.toggle-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-chip span {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem 0.75rem;
  font-size: 0.9rem;
  text-align: center;
  background: #191713;
  color: #ddcfb3;
  transition: all 0.16s ease;
}

.toggle-chip input:checked + span {
  border-color: #bf8a40;
  background: linear-gradient(180deg, #3a2b18 0%, #2f2213 100%);
  color: #ffe3ad;
  box-shadow: inset 0 0 0 1px rgba(255, 210, 130, 0.15);
}

.toggle-chip:hover span {
  border-color: #8b6a3a;
}

.advanced-panel {
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.6rem 0.7rem;
  background: #111111;
}

.advanced-panel summary {
  cursor: pointer;
  color: #d9c8a5;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.specs {
  display: grid;
  gap: 0.5rem;
  font-size: 0.97rem;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 0.35rem;
}

.spec-item span:first-child {
  color: var(--muted);
}

.note {
  margin-top: 0.9rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.preview-wrap {
  background: #0d0d0d;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
}

.studio-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 1rem;
}

.studio-controls {
  max-height: calc(100vh - 180px);
  overflow: auto;
  padding-right: 0.2rem;
  position: sticky;
  top: 0.6rem;
}

.studio-controls h3 {
  margin: 0.2rem 0 0.7rem;
  color: #d9c8a5;
}

.single-col {
  grid-template-columns: 1fr;
}

.layer-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem;
  min-height: 80px;
  max-height: 180px;
  overflow: auto;
  background: #121212;
}

.layer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
}

.layer-item span:first-child {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.layer-check {
  width: 14px;
  height: 14px;
}

.layer-item:hover {
  background: #1d1d1d;
}

.layer-item.selected {
  background: #2b241b;
  color: #f1dfba;
}

textarea {
  resize: vertical;
}

#previewCanvas {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 200px);
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  border: 1px solid #3a3228;
  background: #050505;
}

.studio-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.6rem;
}

.footer {
  padding-bottom: 1.2rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .studio-grid {
    grid-template-columns: 1fr;
  }

  .studio-fullbleed {
    width: 100%;
    margin-left: 0;
  }

  .studio-controls {
    position: static;
    max-height: none;
  }

  #previewCanvas {
    width: 100%;
    max-height: none;
  }
}
