:root {
  --ink: #1a2420;
  --muted: #5a6b63;
  --bg: #f7f5f0;
  --bg-2: #ffffff;
  --paper-3: #eef3ef;
  --line: #d5ddd8;
  --accent: #2f6b54;
  --accent-soft: #e8f2ec;
  --brand-soft: #d8e8df;
  --danger: #b42318;
  --ok: #1f6b4a;
  --shadow: 0 1px 2px rgba(26, 36, 32, 0.04), 0 8px 24px rgba(26, 36, 32, 0.06);
  --radius: 8px;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", sans-serif;
}

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

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  min-height: 100vh;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.privacy {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
  padding: 8px 12px;
  background: var(--brand-soft);
  color: var(--ok);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.panel {
  margin-top: 28px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

.step h2 {
  margin: 2px 0 4px;
  font-size: 1.1rem;
}

.step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 148px;
  padding: 28px 16px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  background-color: var(--paper-3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Crect width='100%25' height='100%25' fill='none' rx='8' ry='8' stroke='%23d5ddd8' stroke-width='2' stroke-dasharray='8 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  transition: background-color 0.15s;
}

.dropzone.is-drag {
  background-color: var(--accent-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Crect width='100%25' height='100%25' fill='none' rx='8' ry='8' stroke='%232f6b54' stroke-width='2' stroke-dasharray='8 6'/%3E%3C/svg%3E");
}

.dropzone strong {
  display: block;
  margin-bottom: 6px;
}

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

.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
  border: 0;
  background: transparent;
}

.file-input::file-selector-button {
  display: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: center;
  margin-top: 18px;
}

.quality {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  width: 100%;
}

.quality input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

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

button {
  font: inherit;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: white;
  font-weight: 700;
}

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

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.list {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
}

.item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--paper-3);
}

.item .meta {
  min-width: 0;
}

.item .name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item .sizes {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.item .save {
  color: var(--ok);
  font-weight: 700;
}

.item .err {
  color: var(--danger);
}

.item-actions {
  display: flex;
  gap: 6px;
}

.item-actions button {
  padding: 8px 10px;
  font-size: 0.85rem;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 12px;
}

.howto {
  margin-top: 36px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.8;
}

.howto h2 {
  color: var(--ink);
  font-size: 1.05rem;
}

footer {
  margin-top: 40px;
  color: var(--muted);
  font-size: 0.85rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    width: 100%;
  }

  .actions button {
    flex: 1;
  }

  .item {
    grid-template-columns: 48px 1fr;
  }

  .item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}
