* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  background: #0a0a0a;
  color: #e8e8e8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    Arial, sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.empty {
  text-align: center;
  pointer-events: none;
}

.empty-title {
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.88);
  margin: 0 0 1.8rem;
  line-height: 1.3;
}

.empty-steps {
  margin: 0 auto;
  padding: 0;
  list-style: none;
  text-align: left;
  font-size: 0.85rem;
  opacity: 0.6;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 380px;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.empty-steps li {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
}

.empty-steps b {
  flex: 0 0 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  font-variant-numeric: tabular-nums;
}

.empty-steps kbd {
  background: rgba(0, 0, 0, 0.35);
  padding: 0.08rem 0.34rem;
  border-radius: 0.22rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  margin: 0 0.08rem;
  color: rgba(255, 255, 255, 0.85);
}

#canvas {
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 8rem);
  display: block;
  cursor: crosshair;
}

.toolbar {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(46, 48, 56, 0.96);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  padding: 0.4rem 0.55rem;
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 50;
}

.t-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.t-group + .t-group {
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  padding-left: 0.6rem;
  margin-left: 0.25rem;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, border-color 0.12s ease;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset;
}

.swatch:hover {
  transform: scale(1.12);
}

.swatch.active {
  border-color: rgba(255, 255, 255, 0.95);
  transform: scale(1.1);
}

.stroke-btn {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e8e8e8;
  width: 30px;
  height: 26px;
  border-radius: 0.35rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.stroke-btn svg {
  width: 18px;
  height: 12px;
  display: block;
}

.stroke-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
}

.stroke-btn.active {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.45);
}

.size-input {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f0f0f0;
  width: 56px;
  height: 26px;
  border-radius: 0.35rem;
  padding: 0 0.3rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  outline: none;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.size-input::-webkit-inner-spin-button,
.size-input::-webkit-outer-spin-button {
  opacity: 0.55;
}

.size-input:focus {
  border-color: rgba(120, 180, 255, 0.7);
  background: rgba(0, 0, 0, 0.4);
}

.size-suffix {
  font-size: 0.7rem;
  opacity: 0.55;
  letter-spacing: 0.02em;
}

.fill-swatch {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform 0.12s ease, border-color 0.12s ease;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fill-swatch:hover {
  transform: scale(1.12);
}

.fill-swatch.active {
  border-color: rgba(255, 255, 255, 0.95);
  transform: scale(1.1);
}

.fill-swatch[data-fill="none"] {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px dashed rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.fill-swatch[data-fill="none"].active {
  border-color: rgba(255, 255, 255, 0.95);
  border-style: solid;
}

.fill-swatch[data-fill="none"] svg {
  width: 14px;
  height: 14px;
  display: block;
}

.help-bar {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(40, 42, 50, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 0.55rem 1rem;
  border-radius: 0.6rem;
  font-size: 0.78rem;
  display: flex;
  gap: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  white-space: nowrap;
  pointer-events: none;
}

.help-bar span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.help-bar kbd {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.text-input {
  position: fixed;
  background: transparent;
  color: #ff3b30;
  border: 1px dashed rgba(255, 59, 48, 0.6);
  outline: none;
  padding: 1px 3px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  z-index: 100;
  min-width: 4ch;
  caret-color: #ff3b30;
}

.toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: rgba(20, 20, 20, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 0.55rem 1.1rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 1000;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: rgba(80, 20, 20, 0.92);
  border-color: rgba(255, 60, 60, 0.2);
}

.credit {
  position: fixed;
  bottom: 2.7rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem 0.3rem 0.3rem;
  background: rgba(46, 48, 56, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  text-decoration: none;
  color: #e8e8e8;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  z-index: 60;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  opacity: 0.72;
  transition: opacity 0.15s ease, transform 0.15s ease,
    border-color 0.15s ease;
}

.credit:hover {
  opacity: 1;
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.24);
}

.credit img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.privacy-note {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.02em;
  line-height: 1.4;
  text-align: right;
  white-space: nowrap;
  z-index: 40;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.share-buttons {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  gap: 0.45rem;
  z-index: 50;
}

.share-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(46, 48, 56, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, color 0.12s ease,
    border-color 0.12s ease, background 0.12s ease;
}

.share-btn:hover {
  background: rgba(64, 68, 78, 0.95);
  color: rgba(255, 255, 255, 1);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.share-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}

.save-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: rgba(46, 48, 56, 0.95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 0.5rem 0.9rem;
  border-radius: 0.5rem;
  font-size: 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #f0f0f0;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.04em;
  z-index: 60;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.save-btn:hover {
  background: rgba(64, 68, 78, 1);
  border-color: rgba(255, 255, 255, 0.24);
}

body.dragging::after {
  content: "drop image";
  position: fixed;
  inset: 0;
  background: rgba(120, 180, 255, 0.08);
  border: 2px dashed rgba(120, 180, 255, 0.6);
  pointer-events: none;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(220, 230, 255, 0.85);
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  font-weight: 300;
}
