:root {
  color-scheme: dark;
  --bg: #17120f;
  --panel: rgba(42, 31, 25, 0.92);
  --panel-strong: #241a16;
  --text: #fff7ec;
  --muted: #d5bba0;
  --line: rgba(255, 225, 190, 0.16);
  --accent: #ffb35c;
  --accent-2: #ffd38a;
  --accent-3: #d9824b;
  --discord: #5865f2;
  --danger: #ff6b6b;
  --shadow: 0 24px 80px rgba(34, 18, 10, 0.36);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Tahoma, Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(255, 179, 92, 0.1) 0%, transparent 28%),
    linear-gradient(225deg, rgba(217, 130, 75, 0.09) 0%, transparent 34%),
    linear-gradient(180deg, #211611 0%, #17120f 48%, #120f0d 100%);
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 211, 138, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 211, 138, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent 78%);
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.site-header.compact {
  padding-bottom: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #24160d;
  letter-spacing: 0;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.top-nav a {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 225, 190, 0.06);
}

.top-nav a:hover {
  color: var(--text);
  border-color: rgba(255, 179, 92, 0.65);
}

.home-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 60px;
}

.compact-home {
  margin-top: 72px;
}

.home-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.hero-panel {
  max-width: 760px;
  padding: 72px 0 44px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.8rem);
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.hero-copy {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.8;
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
}

.btn.primary {
  background: var(--accent);
  color: #24160d;
}

.btn.ghost {
  border-color: var(--line);
  background: rgba(255, 225, 190, 0.07);
  color: var(--text);
}

.btn.discord {
  background: var(--discord);
  color: #fff;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.tool-card {
  min-height: 190px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 211, 138, 0.075), transparent),
    rgba(42, 31, 25, 0.84);
  box-shadow: var(--shadow);
}

.tool-card:hover {
  border-color: rgba(255, 179, 92, 0.72);
  transform: translateY(-2px);
}

.tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(255, 179, 92, 0.15);
  color: var(--accent-2);
  font-size: 0.8rem;
  font-weight: 800;
}

.tool-card h2 {
  margin: 18px 0 8px;
  font-size: 1.2rem;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.tool-layout {
  width: min(840px, calc(100% - 32px));
  margin: 36px auto 60px;
}

.tool-layout.wide {
  width: min(1080px, calc(100% - 32px));
}

.workspace {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
}

.editor,
.ahk-panel {
  display: grid;
  gap: 18px;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 86px;
  border: 1px dashed rgba(255, 225, 190, 0.3);
  border-radius: var(--radius);
  background: rgba(255, 225, 190, 0.055);
  cursor: pointer;
  color: var(--muted);
}

.dropzone span {
  pointer-events: none;
}

.dropzone input {
  display: none;
}

.dropzone:hover {
  border-color: var(--accent);
  color: var(--text);
}

.dropzone.is-dragging {
  border-color: var(--accent);
  background: rgba(255, 179, 92, 0.15);
  color: var(--text);
}

.preview-frame {
  display: grid;
  place-items: center;
  width: min(100%, 540px);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, rgba(255, 211, 138, 0.07) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 211, 138, 0.07) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 211, 138, 0.07) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 211, 138, 0.07) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.preview-frame.circle-output canvas {
  border-radius: 50%;
}

.color-tool-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px);
  gap: 12px;
  align-items: end;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
}

.swatch-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 225, 190, 0.055);
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.swatch-field span {
  font-weight: 800;
}

input[type="color"] {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  cursor: pointer;
}

.color-preview-frame {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 15, 10, 0.48);
}

.color-preview-frame canvas {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

canvas {
  width: 100%;
  height: 100%;
  max-width: 512px;
  max-height: 512px;
  border-radius: 6px;
  background: rgba(24, 15, 10, 0.55);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

label.field,
.control-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--text);
}

select {
  min-height: 42px;
  padding: 8px 10px;
}

.full {
  grid-column: 1 / -1;
}

.hotkey-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.script-output {
  display: none;
  min-height: 360px;
  margin-top: 18px;
  padding: 16px;
  direction: ltr;
  text-align: left;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.55;
}

.script-output.visible {
  display: block;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
}

.modal-panel {
  position: relative;
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.modal-panel h2 {
  margin: 0 0 14px;
  color: var(--accent-2);
}

.modal-panel p {
  margin: 10px 0;
  color: var(--text);
  line-height: 1.8;
}

.modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 225, 190, 0.07);
  color: var(--text);
  cursor: pointer;
}

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    justify-content: flex-start;
  }

  .tool-grid,
  .control-grid,
  .control-grid.two,
  .color-tool-grid,
  .hotkey-grid {
    grid-template-columns: 1fr;
  }

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

  .workspace {
    padding: 18px;
  }
}
