:root {
  color-scheme: light;
  --accent: #c94a8e;
  --accent-dark: #96356f;
  --blue: #4a9ee6;
  --ink: #2f2c42;
  --muted: #716a80;
  --line: #e9dfea;
  --soft: #fff7fb;
  --surface: rgba(255, 255, 255, 0.96);
  --success: #2e7654;
  --warning: #96651d;
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }

body {
  background: linear-gradient(145deg, #fff8fb 0%, #f8f4ff 52%, #edf8ff 100%);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-header, main, footer {
  margin-inline: auto;
  max-width: 760px;
  width: calc(100% - 28px);
}

.app-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 2px 14px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 4px;
}

.dev-badge {
  background: #35205c;
  border-radius: 999px;
  color: #fff;
  display: inline-block;
  letter-spacing: 0.08em;
  margin-left: 4px;
  padding: 3px 7px;
}

h1, h2 { margin: 0; }
h1 { font-size: clamp(26px, 6vw, 38px); }
h2 { font-size: 22px; }

.header-actions { align-items: flex-end; display: flex; flex-direction: column; gap: 8px; }
.status-pill, .count-badge {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
}
.status-pill.online { color: var(--success); }
.status-pill.offline { background: #fff7e7; color: var(--warning); }

main { display: grid; gap: 16px; padding-bottom: 30px; }

.notice, .memo-form, .queue-section {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(81, 54, 103, 0.12);
}

.notice {
  border-color: #ecd7e5;
  display: grid;
  font-size: 13px;
  gap: 4px;
  padding: 13px 16px;
}
.notice span { color: var(--muted); }

.memo-form { display: grid; gap: 16px; padding: clamp(18px, 5vw, 28px); }
.memo-form label { display: grid; font-weight: 700; gap: 7px; }
.memo-form small, .queue-note { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.6; }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

input, select, textarea {
  background: #fffafd;
  border: 1.5px solid #ead8e4;
  border-radius: 13px;
  color: var(--ink);
  min-height: 48px;
  padding: 11px 13px;
  width: 100%;
}
textarea { line-height: 1.65; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 74, 142, 0.12);
  outline: none;
}

.photo-preview {
  align-items: flex-start;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  gap: 12px;
  padding: 10px;
}
.photo-preview[hidden] { display: none; }
.photo-preview img { border-radius: 10px; height: 96px; object-fit: cover; width: 96px; }

.form-actions { display: grid; gap: 10px; grid-template-columns: 2fr 1fr; }
.primary-button, .secondary-button, .text-button {
  border-radius: 12px;
  font-weight: 800;
  min-height: 46px;
  padding: 10px 15px;
}
.primary-button { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.secondary-button { background: #fff; border: 1px solid var(--line); color: var(--accent-dark); }
.text-button { background: transparent; border: 1px solid var(--line); color: var(--accent-dark); min-height: 36px; padding: 6px 10px; }
.primary-button:disabled { cursor: wait; opacity: 0.65; }
.form-message { color: var(--success); font-size: 13px; font-weight: 700; margin: 0; min-height: 20px; }
.form-message.error { color: #a5485c; }

.queue-section { padding: clamp(18px, 5vw, 26px); }
.section-heading { align-items: center; display: flex; justify-content: space-between; }
.queue-note { margin: 9px 0 16px; }
.sync-panel { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; margin: 14px 0; padding: 14px; }
.sync-panel .queue-note { margin: 5px 0 0; }
.sync-actions { display: grid; gap: 9px; grid-template-columns: 1fr 1.35fr; margin-top: 12px; }
.sync-actions button:disabled { cursor: not-allowed; opacity: 0.55; }
.auth-secondary-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.auth-secondary-actions .text-button { font-size: 12px; min-height: 34px; }
.memo-list { display: grid; gap: 11px; }
.empty-state { background: var(--soft); border: 1px dashed #d9c7d7; border-radius: 14px; color: var(--muted); margin: 0; padding: 22px; text-align: center; }
.memo-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.memo-card-header { align-items: flex-start; display: flex; gap: 12px; justify-content: space-between; }
.memo-card h3 { font-size: 16px; margin: 0; }
.memo-card time, .memo-meta { color: var(--muted); font-size: 12px; }
.memo-body { line-height: 1.65; margin: 10px 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.memo-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.memo-tags span { background: #f6eff9; border-radius: 999px; color: var(--accent-dark); font-size: 12px; padding: 4px 8px; }
.memo-photo { border-radius: 10px; display: block; margin-top: 10px; max-height: 180px; max-width: 100%; object-fit: cover; }
.memo-card-actions { border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 10px; }
.memo-action-button { background: #fff; border: 1px solid var(--line); border-radius: 10px; color: var(--accent-dark); font-size: 12px; font-weight: 800; padding: 7px 11px; }
.memo-action-button.danger { color: #a5485c; }
.pending-label { background: #fff7e7; border-radius: 999px; color: var(--warning); flex: 0 0 auto; font-size: 11px; font-weight: 800; padding: 5px 8px; }
.pending-label.synced { background: #eef8f2; color: var(--success); }
.pending-label.syncing { background: #eef5ff; color: #356a9a; }
.pending-label.failed { background: #fff0f3; color: #a5485c; }
.pending-label.deferred { background: #f3f0f7; color: var(--muted); }

footer {
  color: var(--muted);
  display: flex;
  font-size: 11px;
  justify-content: space-between;
  padding: 0 2px max(20px, env(safe-area-inset-bottom));
}

@media (max-width: 520px) {
  .field-row, .form-actions, .sync-actions { grid-template-columns: 1fr; }
  .app-header { align-items: flex-start; }
}

@media (display-mode: standalone) {
  .dev-badge { background: #7a3d95; }
}
