:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #666;
  --primary: #06c755;
  --primary-dark: #05a847;
  --border: #e2e8f0;
  --danger: #d93025;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.header {
  margin-bottom: 1rem;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.header-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.user-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  font-size: 0.85rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary-dark);
  font-size: 0.85rem;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}

.header h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.5rem;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-page .header {
  text-align: center;
}

.auth-page .header-row {
  display: block;
}

.auth-card {
  max-width: 420px;
  margin: 0 auto;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.auth-tab {
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.auth-form .field {
  margin-bottom: 0.85rem;
}

.auth-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-form input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
}

.auth-footnote {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.9rem;
}

.auth-footnote a {
  color: var(--primary-dark);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.file-label {
  display: block;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
}

.file-label:active {
  background: #f8fafc;
}

.file-label input {
  display: none;
}

.file-label-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.file-label-hint {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.file-count {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.btn {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary:not(:disabled):active,
.btn.primary:active {
  background: var(--primary-dark);
}

.status {
  min-height: 1.25rem;
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.status.error {
  color: var(--danger);
}

.status.ok {
  color: var(--primary-dark);
}

.preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.preview figure {
  margin: 0;
}

.preview img {
  width: 100%;
  border-radius: 8px;
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  border: 1px solid var(--border);
}

.preview figcaption {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-all;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.install-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 20;
}

.install-banner p {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.install-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
