:root {
  --bg: #f3f8ff;
  --panel: #ffffff;
  --panel-soft: #f7fbff;
  --line: #d9e6f7;
  --line-strong: #8bb8e8;
  --text: #13233f;
  --muted: #62748d;
  --blue: #0b6ef3;
  --cyan: #0aa8ff;
  --green: #07b57a;
  --shadow: 0 18px 48px rgba(24, 65, 126, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(89, 188, 255, 0.24), transparent 32%),
    linear-gradient(180deg, #eef7ff 0%, #f8fbff 28%, #f3f7fc 100%);
}

body {
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

code {
  padding: 0.15rem 0.35rem;
  border-radius: 0.35rem;
  background: #edf4ff;
  font-family: "Consolas", "Courier New", monospace;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  background: linear-gradient(90deg, #4cc5ff 0%, #0a66ee 100%);
  color: #fff;
}

.header-inner {
  display: flex;
  align-items: center;
  min-height: 70px;
}

.brand {
  color: inherit;
  text-decoration: none;
  font-size: 1.45rem;
  font-weight: 700;
}

.hero {
  padding: 2.2rem 0 6rem;
  color: #fff;
  background: linear-gradient(90deg, #4cc5ff 0%, #0a66ee 100%);
}

.hero-inner {
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.7rem);
}

.hero p {
  width: min(820px, 100%);
  margin: 1rem auto 0;
  line-height: 1.9;
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.96);
}

.tool-card {
  margin-top: -3.4rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  gap: 1rem;
}

.editor-panel,
.control-panel {
  min-width: 0;
}

.dropzone,
.panel-block {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}

.dropzone {
  min-height: 100%;
  padding: 1.1rem;
  outline: none;
}

.dropzone.is-dragging {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(11, 110, 243, 0.1);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 640px;
  padding: 2rem;
  text-align: center;
  border: 2px dashed var(--line-strong);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(237, 247, 255, 0.9), rgba(250, 253, 255, 0.95)),
    linear-gradient(45deg, #edf5ff 25%, transparent 25%),
    linear-gradient(-45deg, #edf5ff 25%, transparent 25%);
  background-size: auto, 24px 24px, 24px 24px;
  background-position: 0 0, 0 0, 12px 12px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  background: linear-gradient(145deg, #7fd6ff, #1c7ffc);
  box-shadow: 0 16px 30px rgba(16, 110, 236, 0.28);
  color: #fff;
  font-size: 2.6rem;
  font-weight: 700;
}

.empty-state h2 {
  margin: 1.2rem 0 0.65rem;
  font-size: 1.7rem;
}

.empty-state p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.empty-actions {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.empty-actions span,
.workspace-head p,
.panel-title-row span,
.preview-sizes span,
.tips-block li {
  color: var(--muted);
}

.primary-button,
.ghost-button,
.download-button,
.size-chip {
  border: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.primary-button,
.ghost-button,
.download-button {
  border-radius: 999px;
  font-weight: 700;
}

.primary-button:hover,
.ghost-button:hover,
.download-button:hover,
.size-chip:hover {
  transform: translateY(-1px);
}

.primary-button {
  padding: 0.95rem 1.35rem;
  color: #fff;
  background: linear-gradient(135deg, #0aa8ff, #0a65ef);
  box-shadow: 0 12px 24px rgba(10, 101, 239, 0.23);
}

.ghost-button {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

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

.workspace.hidden,
.hidden {
  display: none;
}

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

.workspace-head strong {
  display: block;
  font-size: 1.05rem;
}

.workspace-head p {
  margin: 0.45rem 0 0;
  line-height: 1.7;
}

.canvas-shell {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    linear-gradient(45deg, #f3f7fd 25%, transparent 25%),
    linear-gradient(-45deg, #f3f7fd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f3f7fd 75%),
    linear-gradient(-45deg, transparent 75%, #f3f7fd 75%);
  background-size: 28px 28px;
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
}

.canvas-shell canvas {
  display: block;
  width: 100%;
  height: clamp(380px, 55vw, 640px);
  touch-action: none;
}

.canvas-hint {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(19, 35, 63, 0.8);
  color: #fff;
  font-size: 0.86rem;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.canvas-shell.is-active .canvas-hint {
  opacity: 1;
  transform: translateY(0);
}

.control-panel {
  display: grid;
  gap: 1rem;
}

.panel-block {
  padding: 1.1rem;
}

.panel-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.panel-block h2 {
  margin: 0;
  font-size: 1.06rem;
}

.size-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.size-chip {
  min-width: 88px;
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  background: #eaf3ff;
  color: #22518c;
  font-weight: 700;
}

.size-chip.is-active {
  color: #fff;
  background: linear-gradient(135deg, #08afff, #0b6ef3);
  box-shadow: 0 12px 24px rgba(11, 110, 243, 0.22);
}

.preview-stage {
  display: grid;
  gap: 1rem;
  margin-top: 0.9rem;
}

.preview-card {
  display: grid;
  place-items: center;
  padding: 1.25rem;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(45deg, #eff5fb 25%, transparent 25%),
    linear-gradient(-45deg, #eff5fb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eff5fb 75%),
    linear-gradient(-45deg, transparent 75%, #eff5fb 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.preview-card canvas {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
}

.preview-sizes {
  display: flex;
  gap: 0.8rem;
}

.preview-sizes > div {
  flex: 1;
  text-align: center;
}

.preview-sizes span {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.tiny-preview {
  margin: 0 auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(45deg, #eff5fb 25%, transparent 25%),
    linear-gradient(-45deg, #eff5fb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eff5fb 75%),
    linear-gradient(-45deg, transparent 75%, #eff5fb 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

#tiny16 {
  width: 44px;
  height: 44px;
}

#tiny32 {
  width: 54px;
  height: 54px;
}

#tiny48 {
  width: 64px;
  height: 64px;
}

.download-actions {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.download-button {
  padding: 0.95rem 1rem;
  color: #fff;
}

.download-button.is-blue {
  background: linear-gradient(135deg, #147af7, #0b5de8);
}

.download-button.is-cyan {
  background: linear-gradient(135deg, #16b8ff, #0a92ff);
}

.download-button.is-green {
  background: linear-gradient(135deg, #20cb7d, #0fa867);
}

.tips-block ol {
  padding-left: 1.2rem;
  margin: 0.9rem 0 0;
}

.tips-block li {
  line-height: 1.8;
}

.faq-section {
  margin: 4rem 0;
}

.faq-section h2 {
  margin: 0 0 2rem;
  text-align: center;
  font-size: clamp(1.8rem, 3vw, 2.25rem);
}

.faq-list {
  display: grid;
  gap: 1rem;
}

.faq-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 12px 26px rgba(23, 52, 93, 0.08);
}

.faq-question {
  position: relative;
  width: 100%;
  padding: 1.3rem 1.3rem;
  border: none;
  text-align: left;
  background: #f8fbff;
  color: var(--text);
  font-weight: 700;
}

.faq-question::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 1.3rem;
  transform: translateY(-50%);
  font-size: 1.4rem;
  color: var(--muted);
}

.faq-item.expanded .faq-question::after {
  content: "-";
}

.faq-answer {
  display: none;
  padding: 0 1.3rem 1.2rem;
}

.faq-item.expanded .faq-answer {
  display: block;
}

.faq-answer p {
  margin: 0;
  color: var(--muted);
  line-height: 1.9;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: rgba(19, 35, 63, 0.94);
  color: #fff;
  font-size: 0.92rem;
  box-shadow: 0 16px 30px rgba(16, 21, 39, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

  .empty-state {
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(100% - 18px, 100%);
  }

  .site-header .header-inner {
    min-height: 56px;
  }

  .hero {
    padding: 1.6rem 0 5rem;
  }

  .hero p {
    font-size: 0.95rem;
    line-height: 1.7;
  }

  .tool-card {
    padding: 0.5rem;
    border-radius: 24px;
  }

  .dropzone,
  .panel-block {
    border-radius: 18px;
  }

  .workspace-head {
    flex-direction: column;
  }

  .preview-sizes {
    gap: 0.5rem;
  }

  .faq-question {
    padding-right: 3rem;
  }
}
