:root {
  --ios-blue: #0a84ff;
  --ios-green: #30d158;
  --bg-dark: #000000;
  --card-dark: #1c1c1e;
  --card-dark-2: #2c2c2e;
  --text-main: #f2f2f7;
  --text-sec: #8e8e93;
  --border-soft: rgba(255, 255, 255, 0.08);

  --shadow-3d-purple: 0 8px 0 #4c1d95, 0 15px 20px rgba(0, 0, 0, 0.6);
  --shadow-3d-blue: 0 8px 0 #004080, 0 15px 20px rgba(0, 0, 0, 0.6);
  --shadow-3d-green: 0 8px 0 #14532d, 0 15px 20px rgba(0, 0, 0, 0.6);
  --shadow-active: 0 2px 0 rgba(0, 0, 0, 0.8), 0 5px 10px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 15px 45px rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

button,
select,
input {
  font: inherit;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-header {
  width: 100%;
  padding: 36px 20px 18px;
  text-align: center;
}

.brand {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: #ffffff;
}

.slogan {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-sec);
  letter-spacing: 1.5px;
}

.page-wrap {
  width: 92%;
  max-width: 760px;
  padding-bottom: 80px;
}

.hero-section {
  text-align: center;
  margin: 12px 0 24px;
}

.hero-title {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1.15;
}

.hero-subtitle {
  margin: 0;
  color: var(--text-sec);
  font-size: 1rem;
}

.editor-shell {
  margin-bottom: 36px;
}

.preview-area {
  width: 100%;
  aspect-ratio: 1.2 / 1;
  background: var(--card-dark);
  border-radius: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  overflow: hidden;
  box-shadow: inset 0 2px 15px rgba(0, 0, 0, 0.9);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  position: relative;
}

#outputImage {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.guide {
  text-align: center;
  color: var(--text-sec);
  padding: 20px;
}

.guide-icon {
  font-size: 64px;
  margin-bottom: 12px;
}

.guide-text {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 5;
}

.loading-text {
  font-size: 1rem;
  font-weight: 600;
}

.spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-top-color: #ffffff;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.settings-card {
  background: var(--card-dark);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.label {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.color-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.color-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: all 0.1s ease;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.color-circle:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.8);
}

.color-circle.active {
  border: 3px solid var(--ios-blue);
  transform: scale(1.1);
}

select {
  width: 100%;
  min-height: 60px;
  border-radius: 18px;
  border: 1px solid #3a3a3c;
  background: var(--card-dark-2);
  padding: 0 16px;
  font-size: 1.05rem;
  color: var(--ios-blue);
  font-weight: 700;
  appearance: none;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  background: #3a3a3c;
  border-radius: 5px;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.6);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 34px;
  height: 34px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 34px;
}

.btn,
.restore-style {
  width: 100%;
  min-height: 78px;
  border-radius: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: all 0.1s ease;
  font-size: 1.35rem;
  font-weight: 800;
}

.btn {
  border: none;
}

.btn-upload {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: white;
  box-shadow: var(--shadow-3d-purple);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-upload:active {
  transform: translateY(6px);
  box-shadow: var(--shadow-active);
}

.restore-style {
  background: #2c2c2e;
  color: var(--ios-green);
  border: 1px solid var(--ios-green);
  padding: 18px 30px;
  font-size: 1.2rem;
  font-weight: 800;
}

.restore-style.enabled {
  opacity: 1;
}

.restore-style:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.restore-style.active-blue {
  background: linear-gradient(135deg, #0a84ff, #007aff) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: var(--shadow-3d-blue) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.restore-style.enabled:active {
  transform: translateY(6px);
  box-shadow: var(--shadow-active) !important;
}

.btn-save {
  background: linear-gradient(135deg, #34c759, #28a745);
  color: white;
  box-shadow: var(--shadow-3d-green);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-save:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-save.ready:active {
  transform: translateY(6px);
  box-shadow: var(--shadow-active);
}

.seo-section {
  max-width: 900px;
  margin: 34px auto;
  color: #d0d0d4;
  line-height: 1.75;
  font-size: 1rem;
}

.seo-section h2 {
  color: #ffffff;
  font-size: 1.35rem;
  margin-bottom: 14px;
}

.seo-section h3 {
  color: #ffffff;
  font-size: 1.05rem;
  margin: 22px 0 8px;
}

.seo-section p,
.seo-section li {
  color: #d0d0d4;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(28, 28, 30, 0.96);
  color: #ffffff;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  z-index: 999;
  font-size: 0.98rem;
  max-width: calc(100vw - 40px);
  text-align: center;
}

.hidden {
  display: none !important;
}

.simple-page {
  width: 92%;
  max-width: 760px;
  padding: 40px 0 80px;
}

.simple-card {
  background: var(--card-dark);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.simple-card h1,
.simple-card h2 {
  margin-top: 0;
}

.simple-card p,
.simple-card li {
  color: #d0d0d4;
  line-height: 1.75;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 20px;
  border-radius: 16px;
  background: var(--ios-blue);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  margin-right: 12px;
  margin-top: 12px;
}

.link-btn.secondary {
  background: #2c2c2e;
  border: 1px solid #3a3a3c;
}

@media (max-width: 640px) {
  .brand {
    font-size: 1.9rem;
  }

  .btn,
  .restore-style {
    min-height: 72px;
    font-size: 1.15rem;
  }

  .settings-card,
  .simple-card {
    padding: 20px;
  }

  .color-row {
    gap: 14px;
  }
}