:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #111827;
  --muted: #6b7280;
  --line: #d8dee8;
  --accent: #2f6fed;
  --accent-dark: #1f55c7;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

button,
select {
  font: inherit;
}

.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  overflow: hidden;
  background: #111827;
}

.welcome-overlay.is-hidden {
  display: none;
}

.welcome-background {
  position: absolute;
  inset: 0;
  background-image: var(--welcome-image);
  background-position: center;
  background-size: cover;
  transition: opacity 380ms ease;
}

.welcome-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.28);
}

.welcome-card {
  position: relative;
  z-index: 1;
  width: min(100%, 410px);
  margin-top: 44px;
  padding: 58px 28px 28px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 64px 68px 58px 62px / 58px 64px 52px 56px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.26),
    inset 0 -10px 24px rgba(207, 222, 245, 0.36);
  text-align: center;
  backdrop-filter: blur(16px);
}

.welcome-card::before,
.welcome-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 -10px 22px rgba(207, 222, 245, 0.3);
}

.welcome-card::before {
  width: 150px;
  height: 150px;
  top: -66px;
  left: 54px;
  border-radius: 50%;
}

.welcome-card::after {
  width: 190px;
  height: 190px;
  top: -86px;
  right: 48px;
  border-radius: 50%;
}

.welcome-card h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #111827;
  font-size: 24px;
  line-height: 1.25;
}

.welcome-card p {
  position: relative;
  z-index: 1;
  margin: 14px 0 22px;
  color: #4b5563;
  font-size: 15px;
  line-height: 1.7;
}

.welcome-close {
  position: absolute;
  top: -34px;
  right: 30px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #374151;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}

.welcome-start {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
}

.welcome-start:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.announcement-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 20px 0;
  background: var(--bg);
}

.announcement-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #f3c96b;
  background: #fff7df;
  color: #5f3b05;
  box-shadow: 0 10px 26px rgba(120, 72, 0, 0.12);
  font-size: 14px;
  line-height: 1.45;
}

.announcement-inner strong {
  flex: 0 0 auto;
  font-size: 14px;
}

.announcement-inner span {
  min-width: 0;
}

.announcement-inner a {
  flex: 0 0 auto;
  color: #1f55c7;
  font-weight: 700;
  text-decoration: none;
}

.announcement-inner a:hover {
  text-decoration: underline;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  padding: 20px;
}

.preview-panel {
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

#previewCanvas {
  width: min(100%, calc(100vh - 80px));
  max-width: 920px;
  aspect-ratio: 1 / 1;
  height: auto;
  display: block;
  border: 1px solid #e5e7eb;
  background:
    linear-gradient(45deg, #eeeeee 25%, transparent 25%),
    linear-gradient(-45deg, #eeeeee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eeeeee 75%),
    linear-gradient(-45deg, transparent 75%, #eeeeee 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.control-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-header h1 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.2;
}

.panel-header p {
  margin: 0;
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.panel-header p.is-error {
  color: var(--danger);
}

.controls {
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 16px 0;
}

.control-group {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.control-group label {
  font-weight: 700;
  font-size: 14px;
}

.control-group select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #bfc7d4;
  background: #ffffff;
  color: var(--text);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.actions button {
  min-height: 42px;
  border: 1px solid var(--accent);
  background: #ffffff;
  color: var(--accent);
  cursor: pointer;
}

.actions button:hover {
  border-color: var(--accent-dark);
  color: var(--accent-dark);
}

.actions button:last-child {
  background: var(--accent);
  color: #ffffff;
}

.actions button:last-child:hover {
  background: var(--accent-dark);
  color: #ffffff;
}

@media (max-width: 900px) {
  .welcome-overlay {
    padding: 18px;
  }

  .welcome-card {
    width: min(100%, 340px);
    margin-top: 40px;
    padding: 52px 22px 22px;
    border-radius: 52px 56px 46px 50px / 48px 54px 42px 46px;
  }

  .welcome-card::before {
    width: 122px;
    height: 122px;
    top: -54px;
    left: 34px;
  }

  .welcome-card::after {
    width: 150px;
    height: 150px;
    top: -68px;
    right: 32px;
  }

  .welcome-card h2 {
    font-size: 21px;
  }

  .announcement-bar {
    padding: 8px 12px 0;
  }

  .announcement-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .app {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .control-panel {
    min-height: auto;
  }

  #previewCanvas {
    width: min(100%, calc(100vh - 260px));
    min-width: 260px;
  }
}
