:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-alt: #f0f1f6;
  --text: #2c2e3a;
  --text-muted: #8a8d99;
  --accent: #4f6df5;
  --accent-active: #3a55d9;
  --border: #e2e4ec;
  --shadow: 0 4px 24px rgba(30, 34, 60, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand__icon {
  font-size: 1.3rem;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

.upload-section {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.upload-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-card.drag-over {
  border-color: var(--accent);
  background: var(--surface-alt);
}

.upload-card__icon {
  font-size: 2.5rem;
}

.upload-card__title {
  font-size: 1.25rem;
  margin: 0;
}

.upload-card__note {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 4px 0 0;
}

.upload-button {
  display: inline-block;
  padding: 12px 24px;
  min-height: 44px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  text-align: center;
}

.upload-button:hover {
  background: var(--accent-active);
}

.empty-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.thumbnails {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.thumbnail {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  background: var(--surface);
}

.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumbnail.active {
  border-color: var(--accent);
}

.crop-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.crop-area {
  width: 100%;
  max-height: 60vh;
  background: var(--surface-alt);
  border-radius: 10px;
  overflow: hidden;
  touch-action: none;
}

.crop-area img {
  display: block;
  max-width: 100%;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-btn,
.toggle-btn,
.download-button {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
}

.preset-btn:hover,
.toggle-btn:hover,
.download-button:hover {
  border-color: var(--accent);
}

.preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.download-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.download-button:hover {
  background: var(--accent-active);
}

.custom-ratio-input {
  display: flex;
  gap: 8px;
}

.custom-ratio-input input {
  flex: 1;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

.custom-ratio-input input.invalid {
  border-color: #e05c5c;
}

@media (max-width: 480px) {
  .app {
    padding: 16px 12px;
  }

  .upload-card {
    padding: 32px 16px;
  }

  .crop-area {
    max-height: 50vh;
  }
}
