:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  color: #17211f;
  background: #f3f7f6;
  font-synthesis: none;
  --brand: #0f766e;
  --brand-dark: #0b5f58;
  --border: #d6e2df;
  --muted: #64736f;
  --danger: #b42318;
  --success: #147a51;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 100% 0, #d9eeea 0, transparent 28rem),
    #f3f7f6;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(0.9rem, env(safe-area-inset-top)) 1rem 0.9rem;
  color: white;
  background: rgba(15, 118, 110, 0.96);
  box-shadow: 0 2px 12px rgba(16, 55, 51, 0.16);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 0.12rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  opacity: 0.8;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.18rem;
}

h2 {
  margin-bottom: 0.25rem;
  font-size: 1rem;
}

.network-badge {
  flex: 0 0 auto;
  padding: 0.35rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.13);
}

.network-badge.offline {
  background: #9f321f;
}

main {
  width: min(100%, 580px);
  margin: 0 auto;
  padding: 1rem 0.8rem calc(2rem + env(safe-area-inset-bottom));
}

.card {
  margin-bottom: 0.85rem;
  padding: 1rem;
  border: 1px solid rgba(208, 222, 219, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 26px rgba(30, 67, 61, 0.07);
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.step-heading > span {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-weight: 800;
  background: var(--brand);
}

.step-heading p,
.hint,
.file-picker span {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

label {
  display: block;
  margin: 0.9rem 0 0.38rem;
  font-size: 0.85rem;
  font-weight: 750;
}

.required-mark {
  display: inline-block;
  margin-left: 0.2rem;
  padding: 0.08rem 0.32rem;
  border-radius: 5px;
  color: #8f2118;
  font-size: 0.66rem;
  line-height: 1.4;
  vertical-align: 0.08rem;
  background: #fde8e5;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0.7rem 0.78rem;
  border: 1px solid #b8cbc7;
  border-radius: 11px;
  color: #17211f;
  background: white;
}

input:focus,
select:focus,
button:focus-visible,
.file-picker:focus-within {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  outline-offset: 2px;
  border-color: var(--brand);
}

input:disabled,
select:disabled {
  color: #82908d;
  background: #eef3f2;
}

.inline-control {
  display: flex;
  gap: 0.55rem;
}

.inline-control input {
  flex: 1 1 auto;
}

.divider {
  height: 1px;
  margin: 1.25rem -1rem;
  background: #e2eae8;
}

.suggestions {
  max-height: 250px;
  margin-top: 0.35rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: white;
  box-shadow: 0 10px 24px rgba(24, 55, 51, 0.12);
}

.suggestions button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.72rem 0.8rem;
  border: 0;
  border-bottom: 1px solid #e8efed;
  text-align: left;
  color: #17211f;
  background: white;
}

.suggestions button:last-child {
  border-bottom: 0;
}

.suggestions button:hover,
.suggestions button:focus-visible {
  background: #eaf6f3;
}

.file-picker {
  display: grid;
  min-height: 108px;
  margin-top: 0;
  place-content: center;
  gap: 0.25rem;
  border: 2px dashed #73a9a2;
  border-radius: 14px;
  text-align: center;
  color: var(--brand-dark);
  background: #f0faf7;
  cursor: pointer;
}

.file-picker.disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

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

.photo-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0 0.45rem;
  font-size: 0.84rem;
}

.photo-list {
  display: grid;
  gap: 0.55rem;
}

.photo-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.photo-item img {
  width: 58px;
  height: 58px;
  border-radius: 9px;
  object-fit: cover;
  background: #e8eeec;
}

.photo-info {
  display: grid;
  min-width: 0;
  gap: 0.12rem;
}

.photo-name {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-size,
.photo-state {
  color: var(--muted);
  font-size: 0.7rem;
}

.photo-state.success {
  color: var(--success);
  font-weight: 700;
}

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

.remove-photo {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: #6a7774;
  background: #edf2f1;
}

.notice {
  margin: 1rem 0;
  padding: 0.8rem;
  border-left: 4px solid #d19b32;
  border-radius: 8px;
  color: #59451d;
  background: #fff8e8;
}

.notice strong {
  font-size: 0.82rem;
}

.notice p {
  margin: 0.2rem 0 0;
  font-size: 0.76rem;
  line-height: 1.55;
}

.primary,
.secondary {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  font-weight: 800;
}

.primary {
  width: 100%;
  padding: 0.8rem 1rem;
  color: white;
  background: var(--brand);
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.2);
}

.primary:hover {
  background: var(--brand-dark);
}

.primary:disabled {
  cursor: not-allowed;
  box-shadow: none;
  color: #7c8986;
  background: #e1e7e5;
}

.secondary {
  padding: 0.6rem 1rem;
  color: var(--brand-dark);
  background: #dff2ee;
}

.text-button {
  min-height: 44px;
  padding: 0.4rem;
  border: 0;
  color: var(--brand-dark);
  font-weight: 700;
  background: transparent;
}

.text-button:disabled,
.remove-photo:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.form-status {
  min-height: 1.4em;
  margin: 0.65rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.form-status.error {
  color: var(--danger);
}

.complete-panel {
  text-align: center;
}

.complete-icon {
  display: grid;
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.7rem;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  font-weight: 900;
  background: var(--success);
}

.saved-files {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.76rem;
}

.compact-help h2 {
  font-size: 0.9rem;
}

.compact-help ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.65;
}

@media (min-width: 720px) {
  main {
    padding-top: 1.5rem;
  }

  .card {
    padding: 1.3rem;
  }

  .divider {
    margin-right: -1.3rem;
    margin-left: -1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
