@font-face {
  font-family: "Source Han Sans SC";
  src: url("./assets/fonts/SourceHanSansCN-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Source Han Sans SC";
  src: url("./assets/fonts/SourceHanSansCN-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Source Han Sans SC";
  src: url("./assets/fonts/SourceHanSansCN-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Source Han Sans SC";
  src: url("./assets/fonts/SourceHanSansCN-Heavy.otf") format("opentype");
  font-weight: 850;
  font-style: normal;
  font-display: block;
}

:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #6c6f73;
  --line: #dcdfe3;
  --paper: #f7f7f5;
  --surface: #ffffff;
  --accent: #0f7b6c;
  --accent-ink: #ffffff;
  --danger: #b64036;
  --focus: #246bfe;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "Source Han Sans SC";
  background: var(--paper);
  color: var(--ink);
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

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

.app {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  min-height: 100vh;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 24% 22%, #ffffff 0 10%, transparent 12%),
    linear-gradient(135deg, #111111 0%, #0f7b6c 45%, #d64b35 100%);
  box-shadow: 0 10px 24px rgba(15, 123, 108, 0.28);
}

.control-group {
  display: grid;
  gap: 10px;
}

.control-group label,
.group-head label,
.range-row label {
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
}

.group-head,
.range-row,
.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

textarea,
input[type="text"],
#subtitleInput {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  min-height: 108px;
  resize: vertical;
  padding: 14px;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 800;
}

#subtitleInput {
  height: 46px;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 500;
}

textarea:focus,
#subtitleInput:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(36, 107, 254, 0.13);
  background: #ffffff;
}

.ghost-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--ink);
  background: #f0f1f2;
  transition: background 160ms ease, transform 160ms ease;
}

.ghost-button:hover {
  background: #e5e7e9;
}

.ghost-button:active {
  transform: translateY(1px);
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.swatch {
  position: relative;
  aspect-ratio: 1.35;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(23, 23, 23, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.swatch::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 5px;
  border: 2px solid rgba(255, 255, 255, 0);
  transition: border-color 160ms ease, inset 160ms ease;
}

.swatch.active::after {
  inset: 5px;
  border-color: rgba(255, 255, 255, 0.92);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: #eceef0;
}

.segment {
  height: 36px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.segment.active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(18, 20, 22, 0.08);
}

.range-group {
  gap: 12px;
}

.range-row output {
  min-width: 38px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

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

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  margin-top: auto;
  border-radius: 8px;
  color: var(--accent-ink);
  background: #111111;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 16px 32px rgba(17, 17, 17, 0.18);
}

.primary-button:hover {
  background: var(--accent);
}

.primary-button.is-disabled,
.primary-button.is-disabled:hover {
  background: #111111;
  cursor: not-allowed;
  opacity: 0.62;
  pointer-events: none;
}

.primary-button:active {
  transform: translateY(1px);
  box-shadow: 0 10px 22px rgba(17, 17, 17, 0.14);
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(23, 23, 23, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 23, 23, 0.05) 1px, transparent 1px),
    #f2f3f4;
  background-size: 36px 36px;
}

.workspace-head {
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
}

.canvas-wrap {
  align-self: center;
  width: min(100%, calc((100vh - 112px) * 16 / 9));
  max-width: 1280px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #111111;
  box-shadow: 0 26px 60px rgba(18, 20, 22, 0.22);
  overflow: hidden;
}

#coverCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.primary-button:focus-visible {
  outline: 3px solid rgba(36, 107, 254, 0.34);
  outline-offset: 2px;
}

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

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    min-height: 56vh;
  }
}

@media (max-width: 560px) {
  .panel,
  .workspace {
    padding: 18px;
  }

  .panel {
    gap: 18px;
  }

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

  textarea {
    font-size: 18px;
  }
}
