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

:root {
  --color-bg: #faf8f5;
  --color-surface: #ffffff;
  --color-border: #e0d8ce;
  --color-text: #2c2416;
  --color-text-muted: #7a6e62;
  --color-accent: #6b3f1e;
  --color-accent-hover: #4e2d14;
  --color-error: #c0392b;
  --color-error-bg: #fdf3f2;
  --font-main: system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  flex: 1;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-name {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-accent);
}

.lang-nav {
  display: flex;
  gap: 0.75rem;
}

.lang-nav a {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

.lang-nav a:hover {
  border-color: var(--color-border);
  color: var(--color-text);
}

/* Main */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tagline {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Upload area */
.upload-area {
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  transition: border-color 0.15s;
}

.upload-area.drag-over {
  border-color: var(--color-accent);
  background: #fdf7f2;
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.upload-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.upload-label-text {
  font-weight: 600;
  font-size: 0.95rem;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.upload-status {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.upload-buttons {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.file-list {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.photo-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0;
}

.photo-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.photo-thumb-remove:hover {
  background: rgba(0,0,0,0.8);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  width: 100%;
  padding: 0.85rem;
  font-size: 1rem;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--color-accent);
  border: 1.5px solid var(--color-accent);
  font-size: 0.875rem;
  padding: 0.5rem 1.25rem;
}

.btn-secondary:hover {
  background: #fdf7f2;
}

/* Error */
.error-msg {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--color-error);
}

/* Disclaimer */
.disclaimer {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Age confirmation checkbox */
.age-confirm-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.age-confirm-checkbox {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  accent-color: var(--color-accent);
  cursor: pointer;
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* Footer link */
.footer-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.78rem;
}

.footer-link:hover {
  color: var(--color-text);
  text-decoration: underline;
}

/* Privacy page */
.privacy-back-link {
  font-size: 0.875rem;
  color: var(--color-accent);
  text-decoration: none;
}

.privacy-back-link:hover {
  text-decoration: underline;
}

.privacy-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.privacy-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.privacy-section p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* Result page */
.result-state {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.result-state[hidden] {
  display: none;
}

.result-status-text {
  font-size: 1rem;
  color: var(--color-text-muted);
}

.result-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  align-self: flex-start;
}

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

.result-heading {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.result-text {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 1rem;
  line-height: 1.7;
}

.result-text p {
  margin: 0;
}

.result-new-btn {
  margin-top: 0.5rem;
}

.result-error-text {
  font-size: 1rem;
  color: var(--color-text-muted);
}

.result-error-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Utility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Responsive */
@media (max-width: 480px) {
  .tagline { font-size: 1.4rem; }
  .upload-area { padding: 1.5rem 1rem; }
}
