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

:root {
  --primary:       #5c7a5c;
  --primary-dark:  #3d5c3d;
  --primary-light: #f0f5f0;
  --bg:            #fafaf8;
  --surface:       #ffffff;
  --text:          #2c2c2c;
  --text-sub:      #666666;
  --border:        #ddd;
  --success:       #4a8c4a;
  --error:         #c0392b;
  --radius:        12px;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans',
               'Noto Sans JP', 'Yu Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

/* ── Screens ─────────────────────────────── */
.screen {
  display: none;
  min-height: 100vh;
}
.screen.active {
  display: block;
}
#lang-screen.active,
#success-screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* ── Language Selection ───────────────────── */
.logo {
  text-align: center;
  margin-bottom: 44px;
}
.logo-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 0.03em;
}
.logo .subtitle {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 4px;
}

.lang-title {
  text-align: center;
  font-size: 15px;
  color: var(--text-sub);
  margin-bottom: 28px;
  line-height: 1.8;
}
.lang-title span {
  font-size: 14px;
}

.lang-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.lang-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text);
}
.lang-btn:hover,
.lang-btn:focus-visible {
  border-color: var(--primary);
  background: var(--primary-light);
  outline: none;
}
.lang-flag  { font-size: 40px; }
.lang-label { font-size: 17px; font-weight: 600; }

/* ── Form Header ─────────────────────────── */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.back-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-sub);
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1;
  flex-shrink: 0;
}
.back-btn:hover { background: #eee; }
header h1 {
  font-size: 20px;
  font-weight: 700;
}

/* ── Instructions Box ────────────────────── */
.instructions {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 28px;
}

/* ── Form Groups ─────────────────────────── */
.form-group {
  margin-bottom: 20px;
}
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.required {
  color: var(--error);
}
input[type="text"],
input[type="date"],
input[type="number"],
textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  font-family: inherit;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}
textarea {
  resize: vertical;
}
.hint {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 6px;
}

/* ── Upload Area ─────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s;
  background: var(--surface);
}
.upload-area:hover,
.upload-area:focus-visible {
  border-color: var(--primary);
  outline: none;
}
.upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  gap: 10px;
}
.upload-icon { font-size: 40px; }
.upload-placeholder p {
  font-size: 14px;
  color: var(--text-sub);
}

.preview-container {
  position: relative;
}
.preview-container img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  display: block;
}
.remove-photo {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.remove-photo:hover { background: rgba(0,0,0,0.85); }

/* ── Submit Button ───────────────────────── */
.submit-btn {
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s;
  font-family: inherit;
}
.submit-btn:hover:not(:disabled) { background: var(--primary-dark); }
.submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.loading-text {
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Success Screen ──────────────────────── */
.success-content {
  text-align: center;
  padding: 0 20px;
}
.success-icon {
  width: 76px;
  height: 76px;
  background: var(--success);
  color: #fff;
  border-radius: 50%;
  font-size: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.success-content h2 {
  font-size: 24px;
  margin-bottom: 10px;
}
.success-msg {
  color: var(--text-sub);
  font-size: 15px;
  margin-bottom: 24px;
}
.success-note {
  text-align: left;
  max-width: 400px;
  margin: 0 auto;
}

/* ── Error Toast ─────────────────────────── */
.error-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--error);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  max-width: 320px;
  width: calc(100% - 40px);
  text-align: center;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);   opacity: 1; }
}
