:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #12202f;
  --muted: #64758b;
  --line: #d2dbe5;
  --line-soft: #e4ecf5;
  --accent: #7ea1d8;
  --accent-dark: #5f85bd;
  --accent-soft: #eaf3fd;
  --accent-line: #c6d6e8;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --shadow: 0 24px 64px rgba(18, 32, 47, 0.12);
  font-family: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: inherit;
  background:
    radial-gradient(1320px 680px at 50% 700px, rgba(154, 183, 221, 0.32) 0%, rgba(154, 183, 221, 0.08) 64%, rgba(154, 183, 221, 0) 86%),
    linear-gradient(180deg, #ffffff 0%, #ffffff 360px, #f2f7fe 540px, #e4edf9 100%);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
}

.icon-builder-page {
  display: flex;
  flex-direction: column;
}

.tool-header {
  flex: 0 0 auto;
  background: #ffffff;
  padding: 27px 0 24px;
  position: relative;
  z-index: 10;
}

.tool-header::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 100vw;
  height: 100%;
  transform: translateX(-50%);
  background: #ffffff;
  z-index: -1;
}

.tool-topbar {
  width: min(1200px, 94vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tool-brand-title-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 105px;
  height: auto;
  object-fit: contain;
}

.tool-title-divider {
  width: 1px;
  height: 32px;
  background: #6f869d;
  flex: 0 0 auto;
}

.tool-title-label {
  color: #2f4760;
  font-size: clamp(0.932rem, 1.701vw, 1.175rem);
  font-weight: 400;
}

.tool-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.soft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 37px;
  min-width: 108px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.2;
  text-decoration: none;
}

.soft-btn:hover {
  background: #edf4fb;
  border-color: var(--accent-line);
}

.app-shell {
  width: min(760px, 94vw);
  flex: 1 0 auto;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 650px);
  justify-content: center;
  gap: 28px;
  align-items: start;
  padding: 0 0 56px;
}

.app-shell.has-result {
  width: min(780px, calc(100vw - 32px));
  grid-template-columns: minmax(220px, 280px) minmax(280px, 320px);
  align-items: start;
}

.workspace,
.preview {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.workspace {
  padding: 30px;
}

.preview {
  padding: 28px;
}

.has-result .workspace {
  padding: 22px;
  min-height: 420px;
  display: grid;
  align-items: center;
}

.current-icon-summary {
  display: grid;
  gap: 16px;
  align-items: center;
  justify-items: center;
  text-align: center;
}

.current-icon-image {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 16px 38px rgba(19, 27, 42, .16);
}

.current-icon-copy {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.current-icon-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.summary-action {
  width: 100%;
}

.intro {
  max-width: 100%;
  margin-bottom: 22px;
  text-align: center;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(22px, 1.85vw, 26px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  font-size: 24px;
  letter-spacing: 0;
}

.intro p:last-child,
.qr-block p,
.phone-card span,
small {
  color: var(--muted);
  line-height: 1.45;
}

.builder {
  display: grid;
  gap: 22px;
}

label,
label > span,
.field-title,
legend {
  font-size: 14px;
  font-weight: 600;
}

input[type="text"],
input[type="url"],
input:not([type]),
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cdd5e0;
  border-radius: 8px;
  padding: 0 14px;
  font: inherit;
}

.select-shell {
  position: relative;
  display: block;
}

.select-shell::after {
  content: "⌄";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-54%);
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
}

.select-shell select {
  appearance: none;
  padding-right: 42px;
}

.icon-picker {
  border: 1px dashed #b9c4d3;
  border-radius: 8px;
  padding: 18px;
  display: grid;
  justify-items: center;
  cursor: pointer;
  background: #fbfdff;
}

.icon-picker.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.icon-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 0;
}

.selected-icon-preview {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  box-shadow: 0 10px 24px rgba(19, 27, 42, .16);
  object-fit: cover;
  flex: 0 0 auto;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.file-pill:hover {
  background: #f3f8fe;
}

button,
.download {
  min-height: 48px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.download:hover {
  background: #dceafb;
}

.phone-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.phone-card strong,
.phone-card span {
  display: block;
}

.phone-card strong {
  font-weight: 600;
}

.app-icon {
  width: 78px;
  height: 78px;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(19, 27, 42, .18);
}

.app-icon.large {
  width: 104px;
  height: 104px;
  border-radius: 24px;
}

.message,
.result {
  margin-top: 22px;
}

.message {
  padding: 14px;
  border-radius: 8px;
}

.error {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid #ffd1cc;
}

.result {
  display: grid;
  gap: 18px;
}

.advanced-download {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fbff;
}

.advanced-download summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.advanced-download p {
  margin: 12px 0;
  color: var(--muted);
  line-height: 1.45;
}

.advanced-download a {
  color: var(--accent);
  font-weight: 800;
}

.qr-block {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.qr-block img {
  width: 220px;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-block a {
  color: var(--accent);
  font-weight: 600;
}

.clean-install {
  padding: 14px;
  border: 1px solid #b8d3ff;
  border-radius: 8px;
  background: #eef5ff;
}

.clean-install strong {
  display: block;
  margin-bottom: 6px;
}

.clean-install p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.clean-install code {
  font-size: .92em;
  word-break: break-all;
}

.output-card {
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
}

.output-card h2 {
  margin-bottom: 0;
}

.output-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.cropper {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .55);
}

.cropper.open {
  display: grid;
}

.cropper-panel {
  width: min(100%, 620px);
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  display: grid;
  gap: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .28);
}

.cropper-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cropper-head button {
  min-height: 36px;
  background: #e9eef6;
  color: var(--ink);
}

#cropCanvas {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #9aa3af;
  touch-action: none;
  box-shadow: inset 0 0 0 1px var(--line), 0 18px 50px rgba(20, 30, 52, .14);
}

.cropper-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 138px;
  gap: 18px;
  align-items: start;
}

.crop-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

#roundedPreview {
  width: 138px;
  height: 138px;
  display: block;
  border-radius: 24%;
  background: #9aa3af;
  box-shadow: 0 18px 45px rgba(20, 30, 52, .2);
}

.range-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
}

.range-row input[type="range"] {
  width: 100%;
  appearance: none;
  height: 24px;
  margin: 0;
  background: transparent;
}

.range-row input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
}

.range-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border: 1px solid var(--accent-dark);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(18, 32, 47, .18);
}

.range-row input[type="range"]::-moz-range-track {
  height: 7px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
}

.range-row input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 1px solid var(--accent-dark);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(18, 32, 47, .18);
}

.color-row {
  grid-template-columns: 96px auto;
  justify-content: start;
}

.color-row input[type="color"] {
  width: 70px;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  cursor: pointer;
}

.color-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-row input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 999px;
}

.color-row input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 999px;
}

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

  #roundedPreview {
    width: 96px;
    height: 96px;
  }
}

@media (max-width: 900px) {
  .app-shell.has-result,
  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
    width: min(100% - 32px, 650px);
    padding-top: 0;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100vw - 20px, 650px);
    padding: 10px 0;
    gap: 10px;
  }

  .workspace,
  .preview {
    padding: 20px;
  }

  h1 {
    font-size: 28px;
  }
}
