:root {
  color-scheme: light;
  --bg: #edf3fb;
  --card: #ffffff;
  --card-soft: rgba(255, 255, 255, 0.78);
  --text: #111827;
  --muted: #64748b;
  --border: rgba(148, 163, 184, 0.28);
  --primary: #315eea;
  --primary-dark: #2448bd;
  --accent: #06b6d4;
  --selected-bg: linear-gradient(145deg, #e0ecff, #b8cff0);
  --selected-text: #c0262d;
  --danger: #b91c1c;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 12px 34px rgba(15, 23, 42, 0.08);
  --radius-lg: 28px;
  --radius-md: 20px;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(229, 241, 255, 0.78)),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
  mask-image: linear-gradient(to bottom, #000 0%, transparent 82%);
}

.page-glow {
  position: fixed;
  z-index: -2;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.7;
  pointer-events: none;
}

.page-glow-primary {
  top: -180px;
  left: -140px;
  width: 420px;
  height: 420px;
  background: rgba(49, 94, 234, 0.22);
}

.page-glow-secondary {
  right: -160px;
  bottom: 12%;
  width: 360px;
  height: 360px;
  background: rgba(6, 182, 212, 0.18);
}

button,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 246, 255, 0.8)),
    var(--card);
  padding: clamp(28px, 5vw, 52px);
  box-shadow: var(--shadow);
}

.hero-copy::after {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 128px;
  height: 128px;
  border: 1px solid rgba(49, 94, 234, 0.14);
  border-radius: 34px;
  background:
    linear-gradient(90deg, rgba(49, 94, 234, 0.12) 1px, transparent 1px),
    linear-gradient(rgba(49, 94, 234, 0.12) 1px, transparent 1px);
  background-size: 16px 16px;
  content: "";
  transform: rotate(12deg);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 14px;
  font-size: clamp(38px, 5vw, 66px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.description,
.panel-heading p,
.message {
  color: var(--muted);
}

.description {
  max-width: 650px;
  margin-bottom: 26px;
  font-size: 17px;
  line-height: 1.8;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-pills span {
  border: 1px solid rgba(49, 94, 234, 0.18);
  border-radius: 999px;
  background: rgba(49, 94, 234, 0.07);
  padding: 8px 12px;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 800;
}

.panel-card,
.hero-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card-soft);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  padding: 28px;
  background:
    linear-gradient(155deg, rgba(17, 24, 39, 0.94), rgba(30, 58, 138, 0.88)),
    #111827;
  color: #fff;
}

.hero-card span,
.hero-card small {
  color: rgba(255, 255, 255, 0.72);
}

.hero-card strong {
  margin: 24px 0 8px;
  color: #fff;
  font-size: clamp(64px, 9vw, 92px);
  line-height: 1;
  letter-spacing: -0.08em;
}

.hero-card-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 24px;
  align-items: stretch;
}

.toolbar,
.result-panel,
.bitmap-panel {
  padding: 24px;
}

.section-title,
.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-title.compact {
  margin-bottom: 12px;
}

.kbd-hint {
  flex: 0 0 auto;
  border: 1px solid rgba(100, 116, 139, 0.2);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.78);
  padding: 7px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.input-group {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.92)),
    #fff;
  padding: 16px 18px;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 18px;
  line-height: 1.7;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

textarea:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 4px rgba(49, 94, 234, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

button {
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  padding: 11px 18px;
  color: var(--text);
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-2px);
  border-color: #b9c6d8;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

button.primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), #5b7cfa);
  color: #fff;
}

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

.message {
  min-height: 24px;
  margin: 14px 0 0;
  font-size: 14px;
  font-weight: 700;
}

.message.error {
  color: var(--danger);
}

.result-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  min-height: 56px;
  max-height: 150px;
  margin-bottom: 0;
  overflow: auto;
}

.chip {
  border-radius: 999px;
  background: linear-gradient(135deg, #eaf1ff, #dbeafe);
  padding: 7px 11px;
  color: #1e40af;
  font-size: 13px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(49, 94, 234, 0.08);
}

pre {
  overflow: auto;
  min-height: 132px;
  max-height: 220px;
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98)),
    #111827;
  padding: 18px;
  color: #a7f3d0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  line-height: 1.7;
  white-space: pre-wrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.bitmap-panel {
  margin-top: 24px;
}

.panel-heading p {
  max-width: 580px;
  margin-bottom: 0;
  line-height: 1.7;
}

.bitmap-grid {
  display: grid;
  grid-template-columns: repeat(16, minmax(46px, 1fr));
  gap: 9px;
  margin-top: 22px;
}

.bit-button {
  position: relative;
  min-height: 44px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.86);
  padding: 8px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: none;
}

.bit-button.secondary-field {
  background: rgba(241, 245, 249, 0.82);
  color: #475569;
}

.bit-button.field-boundary::after {
  position: absolute;
  right: -6px;
  width: 1px;
  height: 18px;
  background: rgba(100, 116, 139, 0.24);
  content: "";
}

.bit-button.selected {
  border-color: #8ea8c7;
  background: var(--selected-bg);
  color: var(--selected-text);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    0 10px 24px rgba(49, 94, 234, 0.18);
  transform: translateY(-1px);
}

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

  .hero-card {
    min-height: 220px;
  }
}

@media (max-width: 840px) {
  .panel-heading {
    display: block;
  }

  .bitmap-grid {
    grid-template-columns: repeat(8, minmax(36px, 1fr));
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .hero-copy,
  .hero-card,
  .toolbar,
  .result-panel,
  .bitmap-panel {
    border-radius: 22px;
    padding: 20px;
  }

  .section-title {
    display: block;
  }

  .kbd-hint {
    display: inline-block;
    margin-top: 10px;
  }

  .bitmap-grid {
    grid-template-columns: repeat(4, minmax(42px, 1fr));
  }
}
