:root {
  --bg: #edf2f7;
  --bg-accent: #e7eef9;
  --text: #0f172a;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --primary-soft: rgba(15, 118, 110, 0.1);
  --muted: #5b6472;
  --muted-strong: #334155;
  --border: rgba(148, 163, 184, 0.24);
  --danger: #b22e3a;
  --shadow: 0 28px 70px rgba(15, 23, 42, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable Text", "Segoe UI", "Noto Sans KR", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.9), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(125, 211, 252, 0.42), transparent 24%),
    radial-gradient(circle at 78% 88%, rgba(15, 118, 110, 0.18), transparent 26%),
    linear-gradient(135deg, var(--bg), var(--bg-accent));
  display: grid;
  place-items: center;
  padding: 28px;
}

.card {
  width: min(960px, 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.84));
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px;
  backdrop-filter: blur(18px);
  animation: rise 450ms ease-out;
}

/* Header / hero */
.shell-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 24px;
  position: relative;
  padding-right: 190px;
}

.brand-block {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: white;
  background: linear-gradient(135deg, var(--primary), #0b3d4a);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.28);
  flex: 0 0 auto;
}

.brand-copy {
  min-width: 0;
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary-strong);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.page-logo {
  display: block;
  width: min(520px, 92%);
  max-height: 160px;
  object-fit: contain;
  margin: 4px auto 0;
}

p {
  margin: 0;
  color: var(--muted);
}

.intro {
  margin-top: 14px;
  max-width: 62ch;
  margin-inline: auto;
  font-size: 1.03rem;
  line-height: 1.65;
  color: var(--muted-strong);
  text-align: center;
}

.processing-indicator {
  display: none;
}

.processing-indicator.hidden {
  display: none;
}

.processing-overlay {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  background: rgba(8, 15, 23, 0.28);
  backdrop-filter: blur(2px);
  border-radius: 18px;
  pointer-events: none;
  animation: fadeIn 300ms ease-out;
}

.processing-overlay.hidden {
  display: none;
}

.processing-progress-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  width: 100%;
  pointer-events: none;
}

.processing-progress-bar {
  width: min(360px, calc(100% - 48px));
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
  overflow: hidden;
  border: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.28);
}

.processing-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #0ea5a3);
  border-radius: 999px;
  width: 0%;
  transition: width 200ms ease-out;
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.65);
}

.processing-progress-percent {
  color: rgba(255, 255, 255, 0.95);
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  min-width: 80px;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.progress-bar-wrapper {
  display: none;
}

@keyframes progress {
  0% {
    width: 10%;
  }
  50% {
    width: 70%;
  }
  100% {
    width: 10%;
  }
}

.processing-text {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-strong);
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.header-brand-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.header-logo {
  display: block;
  width: 170px;
  max-height: 48px;
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
}

.header-logo-clean2up {
  width: 170px;
  max-height: 48px;
}

.tool-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
}

.tool-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
  font-weight: 600;
}

.tool-link-icon {
  width: 24px;
  height: 24px;
  display: block;
  flex: 0 0 auto;
}

.tool-link > span {
  display: block;
  line-height: 1;
}

.tool-link:has(.tool-link-icon) {
  gap: 5px;
}

.tool-link.is-active {
  display: none;
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}

.auth-section {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.google-login {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 180ms ease;
  text-decoration: none;
}

.google-login:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.google-login svg {
  display: block;
}

.user-profile {
  position: relative;
  display: inline-block;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 180ms ease;
}

.user-avatar:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.2);
}

.profile-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 160px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.user-profile:hover .profile-menu {
  display: flex;
}

.profile-name {
  font-size: 0.875rem;
  color: var(--muted-strong);
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 180ms ease;
}

.logout-btn:hover {
  opacity: 0.9;
}

.market-row {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  background: rgba(15, 118, 110, 0.06);
}

.market-row strong {
  font-size: 0.96rem;
  color: var(--primary-strong);
}

.market-row span {
  font-size: 0.9rem;
  color: var(--muted-strong);
}

.market-switch {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 18px;
}

.hero-chips span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  background: rgba(15, 118, 110, 0.06);
  color: var(--muted-strong);
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.workspace-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2.1vw, 1.5rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.panel-note {
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}
 
.flow {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.flow-step {
  font-size: 0.84rem;
  text-align: center;
  padding: 11px 10px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #475569;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.9));
  transition: transform 140ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.flow-step.is-done {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.22);
  color: var(--primary-strong);
}

.flow-step.is-current {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  border-color: transparent;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.22);
}

form {
  display: grid;
  gap: 14px;
  margin: 0;
}

.option-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 0.95rem;
}

.option-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted-strong);
  font-size: 0.95rem;
  margin-top: -2px;
}

.slider-row output {
  font-weight: 700;
  color: var(--primary-strong);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

select {
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted-strong);
  font-size: 0.95rem;
}

.upload-canvas {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  width: min(100%, 300px);
  justify-self: center;
  min-height: 190px;
  border-radius: 18px;
  border: 1px dashed rgba(15, 118, 110, 0.44);
  color: #0f172a;
  background-image:
    linear-gradient(45deg, rgba(148, 163, 184, 0.14) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.14) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.14) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.14) 75%),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.82), rgba(241, 245, 249, 0.92));
  background-size: 24px 24px, 24px 24px, 24px 24px, 24px 24px, auto;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0, 0 0;
  overflow: hidden;
  cursor: pointer;
}

.upload-canvas.hidden {
  display: none;
}

.canvas-clickable {
  cursor: pointer;
  transition: opacity 150ms ease;
}

.canvas-clickable:hover {
  opacity: 0.85;
}

.upload-canvas-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.upload-canvas-sub {
  font-size: 0.9rem;
  color: #475569;
}

.upload-canvas input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

input[type="file"] {
  border: 1px dashed rgba(100, 116, 139, 0.32);
  border-radius: 18px;
  padding: 18px;
  background: rgba(248, 250, 252, 0.9);
  color: var(--muted-strong);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, box-shadow 150ms ease;
  box-shadow: 0 14px 32px rgba(15, 118, 110, 0.22);
}

button:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  position: absolute;
  top: 0;
  right: 0;
}

.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  color: var(--primary-strong);
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.16);
  color: var(--muted-strong);
}

.user-badge img {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
}

.notice {
  border-radius: 14px;
  padding: 14px 16px;
  background: #edf8fa;
  color: #17545a;
  border: 1px solid #bfdede;
}

.progress-container {
  display: none;
  gap: 10px;
  margin-top: 12px;
}

.progress-container[aria-hidden="false"] {
  display: grid;
}

.progress-label {
  font-size: 0.95rem;
  color: var(--muted);
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e6f1e6;
  overflow: hidden;
  border: 1px solid #cfe4cd;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  transition: width 3s ease;
}

.error {
  color: var(--danger);
  font-weight: 700;
}

.result {
  margin-top: 18px;
  margin-bottom: 0;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 248, 252, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.2);
  display: grid;
  gap: 8px;
}

.result.is-focused {
  animation: pulseFrame 500ms ease;
}

.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  width: fit-content;
  padding: 11px 16px;
  border-radius: 14px;
  background: rgba(15, 118, 110, 0.08);
  text-decoration: none;
  font-weight: 700;
  color: var(--primary-strong);
}

.hint {
  margin: 0;
  color: #3f5569;
  font-size: 0.9rem;
}

.preview-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.preview-card {
  background: var(--surface-strong);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 12px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.preview-card h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--muted-strong);
}

.preview-link {
  display: block;
  border-radius: 8px;
}

.upscale-form {
  margin: 2px 0 2px;
}

.crop-stage-wrap {
  display: grid;
  gap: 10px;
}

.crop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.crop-toolbar label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted-strong);
}

.crop-preset-select {
  min-width: 210px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  color: var(--muted-strong);
  font-size: 0.92rem;
}

.secondary-btn {
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary-strong);
  background: rgba(15, 118, 110, 0.08);
  box-shadow: none;
}

.crop-stage-overlay {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
}

.crop-stage-overlay:hover .canvas-action-group {
  opacity: 1;
}

.crop-stage {
  position: relative;
  width: min(100%, 640px);
  height: min(72vh, 520px);
  border-radius: 12px;
  overflow: hidden;
  background-image:
    linear-gradient(45deg, #ececec 25%, transparent 25%),
    linear-gradient(-45deg, #ececec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececec 75%),
    linear-gradient(-45deg, transparent 75%, #ececec 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.crop-image-layer {
  position: absolute;
  inset: 0;
  transform-origin: top left;
  will-change: transform;
}

.crop-image-layer img {
  position: absolute;
  display: block;
  object-fit: contain;
  user-select: none;
  touch-action: none;
  pointer-events: none;
}

.crop-frame {
  position: absolute;
  left: 0;
  top: 0;
  width: 180px;
  height: 240px;
  border: 2px dashed rgba(255, 255, 255, 0.96);
  border-radius: 0;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.58);
  background: rgba(255, 255, 255, 0.04);
}

.crop-handle {
  position: absolute;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.crop-handle.edge {
  z-index: 5;
}

.crop-handle.edge.top {
  top: -10px;
  left: 0;
  right: 0;
  height: 20px;
  cursor: ns-resize;
}

.crop-handle.edge.bottom {
  bottom: -10px;
  left: 0;
  right: 0;
  height: 20px;
  cursor: ns-resize;
}

.crop-handle.edge.left {
  left: -10px;
  top: 0;
  bottom: 0;
  width: 20px;
  cursor: ew-resize;
}

.crop-handle.edge.right {
  right: -10px;
  top: 0;
  bottom: 0;
  width: 20px;
  cursor: ew-resize;
}

.crop-input-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.crop-input-grid label {
  display: grid;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted-strong);
}

.crop-input-grid input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.9rem;
}

body.page-drop-active::before {
  content: "이미지를 놓으면 바로 업로드됩니다";
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.52);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.action-stack {
  display: grid;
  gap: 10px;
}

.upscale-form button {
  width: 100%;
}

.animation-ready {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  background: rgba(15, 118, 110, 0.06);
  border-radius: 14px;
  padding: 12px;
}

.animation-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.animation-links a {
  text-decoration: none;
  color: #1d4b36;
  font-weight: 700;
  font-size: 0.9rem;
}

.preview-card img {
  width: 100%;
  height: 250px;
  object-fit: contain;
  background-image:
    linear-gradient(45deg, #ececec 25%, transparent 25%),
    linear-gradient(-45deg, #ececec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececec 75%),
    linear-gradient(-45deg, transparent 75%, #ececec 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border-radius: 8px;
  cursor: zoom-in;
}

.canvas-image-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.canvas-image-wrapper img {
  width: 100%;
  height: 250px;
  object-fit: contain;
  background-image:
    linear-gradient(45deg, #ececec 25%, transparent 25%),
    linear-gradient(-45deg, #ececec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececec 75%),
    linear-gradient(-45deg, transparent 75%, #ececec 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border-radius: 8px;
  display: block;
}

.canvas-action-group {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 1;
  transition: opacity 180ms ease;
  z-index: 10;
}

.canvas-action-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  color: transparent;
  font-size: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  text-decoration: none;
  cursor: pointer;
  outline: none;
}

.canvas-action-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.canvas-action-btn.is-download {
  background-image: url('/static/download-tray-icon.svg');
}

.canvas-action-btn.is-compress {
  background-image: url('/static/compress-icon.svg');
}

.canvas-action-btn.is-clipboard {
  background-image: url('/static/clipboard-icon.svg');
}

.canvas-action-btn.is-busy {
  border-color: rgba(255, 255, 255, 0.75);
}

.canvas-action-btn.is-success {
  border-color: rgba(34, 197, 94, 0.95);
}

.canvas-action-btn.is-error {
  border-color: rgba(248, 113, 113, 0.95);
}

.canvas-image-wrapper:hover .canvas-action-group {
  opacity: 1;
}

.footer {
  margin-top: 18px;
  padding-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.app-footer {
  margin-top: 16px;
  padding: 12px 24px 24px;
  border-top: 0;
  background: transparent;
  position: relative;
}

.app-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 70px;
  right: 70px;
  height: 1px;
  background: var(--border);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto 32px;
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-section h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--primary-strong);
  font-weight: 700;
}

.footer-section h4 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted-strong);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-section p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.footer-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-section li a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 180ms ease;
}

.footer-section li a:hover {
  color: var(--primary-strong);
}

.footer-bottom {
  border-top: 0;
  padding-top: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 25, 34, 0.78);
  backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transform: scale(1.02);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 50;
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.lightbox-image {
  max-width: min(1200px, 94vw);
  max-height: 82vh;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.lightbox-caption {
  margin: 12px 0 0;
  color: #e9eef8;
  font-size: 0.95rem;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: auto;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.lightbox-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.lightbox-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  text-decoration: none;
  font-weight: 700;
}

.lightbox-download:hover {
  opacity: 0.92;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseFrame {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 106, 79, 0.3);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(47, 106, 79, 0);
  }
}

/* Dashboard Styles */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.stat-card {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(15, 118, 110, 0.04));
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  transition: all 180ms ease;
}

.stat-card:hover {
  border-color: rgba(15, 118, 110, 0.32);
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.12);
  transform: translateY(-4px);
}

.stat-card.global {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.08), rgba(66, 133, 244, 0.04));
  border-color: rgba(66, 133, 244, 0.16);
}

.stat-card.global:hover {
  border-color: rgba(66, 133, 244, 0.32);
  box-shadow: 0 8px 24px rgba(66, 133, 244, 0.12);
}

.stat-card.stat-danger {
  background: linear-gradient(135deg, rgba(178, 46, 58, 0.08), rgba(178, 46, 58, 0.04));
  border-color: rgba(178, 46, 58, 0.22);
}

.stat-card.stat-danger .stat-value {
  color: var(--danger);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-strong);
  margin-bottom: 8px;
  line-height: 1;
}

.stat-label {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}

.chart-container {
  position: relative;
  height: 320px;
  margin: 20px 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.top-users-table {
  overflow-x: auto;
  margin-top: 20px;
}

.top-users-table table {
  width: 100%;
  border-collapse: collapse;
}

.top-users-table thead {
  background: rgba(15, 118, 110, 0.08);
  border-bottom: 1px solid var(--border);
}

.top-users-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--muted-strong);
  font-size: 0.9rem;
}

.top-users-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted-strong);
}

.top-users-table tr:hover {
  background: rgba(15, 118, 110, 0.04);
}

.top-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
}

.result h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.5rem;
  color: var(--primary-strong);
  border-bottom: 2px solid rgba(15, 118, 110, 0.2);
  padding-bottom: 12px;
}

.kpi-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.kpi-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 600;
}

.kpi-form input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: rgba(255, 255, 255, 0.95);
}

.kpi-form button {
  height: 42px;
}

@media (max-width: 640px) {
  .shell-header {
    flex-direction: column;
    padding-right: 0;
  }

  .header-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .header-brand-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .header-logo {
    width: min(160px, 52vw);
    max-height: 44px;
  }

  .tool-nav {
    flex: 1;
    width: auto;
    gap: 6px;
  }

  .tool-link {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .auth-section {
    flex-shrink: 0;
    gap: 8px;
  }

  .profile-menu {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }

  .auth-row {
    position: static;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 24px;
  }

  .app-footer {
    padding: 32px 16px;
    margin-top: 32px;
  }

  .app-footer::before {
    left: 36px;
    right: 36px;
  }

  .footer-section {
    gap: 8px;
  }

  .footer-section h3 {
    font-size: 1.1rem;
  }

  .footer-section h4 {
    font-size: 0.9rem;
  }

  .footer-section p {
    font-size: 0.85rem;
  }

  .footer-section li a {
    font-size: 0.85rem;
  }

  .footer-bottom {
    padding-top: 16px;
    font-size: 0.85rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 2rem;
  }

  .stat-label {
    font-size: 0.85rem;
  }

  .chart-container {
    height: 240px;
    padding: 12px;
  }

  .top-users-table {
    font-size: 0.9rem;
  }

  .top-users-table th,
  .top-users-table td {
    padding: 8px 12px;
  }

  .top-user-avatar {
    width: 28px;
    height: 28px;
    margin-right: 6px;
  }

  .result h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
  }

  .hero-chips,
  .panel-head,
  .panel-note {
    text-align: left;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .card {
    padding: 18px;
    border-radius: 22px;
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .flow {
    grid-template-columns: 1fr;
  }

  .preview-card img {
    height: 200px;
  }

  .crop-stage {
    width: 100%;
    height: min(60vh, 420px);
  }

  .crop-input-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
