:root {
  --bg: #f7fbff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --text: #1a2433;
  --muted: #6b7a90;
  --line: rgba(26, 36, 51, 0.08);
  --accent: #5b8def;
  --accent-soft: rgba(91, 141, 239, 0.12);
  --shadow: 0 10px 30px rgba(91, 141, 239, 0.08);
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(180deg, #eef6ff 0%, #f7fbff 45%, #ffffff 100%);
}

.cloud {
  position: absolute;
  background: #fff;
  border-radius: 999px;
  filter: drop-shadow(0 8px 18px rgba(91, 141, 239, 0.08));
  opacity: 0.85;
  animation: drift 38s ease-in-out infinite;
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: inherit;
}

.c1 {
  width: 120px;
  height: 42px;
  top: 8%;
  left: -10%;
  animation-duration: 42s;
}
.c1::before {
  width: 54px;
  height: 54px;
  top: -24px;
  left: 18px;
}
.c1::after {
  width: 70px;
  height: 70px;
  top: -34px;
  left: 52px;
}

.c2 {
  width: 160px;
  height: 52px;
  top: 18%;
  right: -12%;
  animation-duration: 48s;
  animation-delay: -8s;
}
.c2::before {
  width: 64px;
  height: 64px;
  top: -30px;
  left: 24px;
}
.c2::after {
  width: 82px;
  height: 82px;
  top: -38px;
  left: 68px;
}

.c3 {
  width: 100px;
  height: 36px;
  bottom: 22%;
  left: 8%;
  animation-duration: 52s;
  animation-delay: -14s;
}
.c3::before {
  width: 44px;
  height: 44px;
  top: -20px;
  left: 14px;
}
.c3::after {
  width: 58px;
  height: 58px;
  top: -28px;
  left: 40px;
}

.c4 {
  width: 140px;
  height: 46px;
  bottom: 12%;
  right: 6%;
  animation-duration: 44s;
  animation-delay: -20s;
}
.c4::before {
  width: 58px;
  height: 58px;
  top: -26px;
  left: 20px;
}
.c4::after {
  width: 72px;
  height: 72px;
  top: -34px;
  left: 56px;
}

@keyframes drift {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(18px);
  }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 16px 16px calc(24px + var(--safe-bottom));
}

.screen {
  animation: fadeIn 0.28s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.82rem;
  color: var(--muted);
}

.ghost-btn,
.primary-btn,
.text-btn {
  border: none;
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.ghost-btn:active,
.primary-btn:active,
.text-btn:active {
  transform: scale(0.98);
}

.ghost-btn {
  background: var(--surface);
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.primary-btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6d9bff, #5b8def);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 12px 24px rgba(91, 141, 239, 0.25);
}

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

.card {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.hero-copy {
  margin: 0 0 16px;
  line-height: 1.55;
  color: var(--text);
  font-size: 0.95rem;
}

.hero-copy strong {
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.field label {
  font-size: 0.82rem;
  color: var(--muted);
}

.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  outline: none;
}

.field input:focus {
  border-color: rgba(91, 141, 239, 0.45);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.hint,
.error,
.status {
  font-size: 0.84rem;
  line-height: 1.45;
  margin: 10px 0 0;
}

.hint {
  color: var(--muted);
}

.error {
  color: #c44d4d;
}

.status {
  color: var(--accent);
}

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.search-bar input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  border-radius: 999px;
  padding: 12px 16px;
  font: inherit;
}

.folder-grid {
  display: grid;
  gap: 12px;
}

.section-title {
  margin: 18px 0 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

.section-title:first-child {
  margin-top: 0;
}

.folder-section {
  display: grid;
  gap: 12px;
}

.folder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.folder-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.folder-badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

.folder-preview {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entries {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entry-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.entry-time {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.entry-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 0.94rem;
}

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

.media-grid img,
.media-grid video {
  width: 100%;
  border-radius: 14px;
  background: #eef3fa;
}

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

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 12px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
}

.search-hit {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.search-hit small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.folder-card {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.folder-card:active {
  transform: scale(0.99);
}

.folder-card-inner {
  display: block;
  padding: 16px 44px 16px 16px;
  cursor: pointer;
}

.entry-card,
.folder-header-cloud {
  position: relative;
  padding-right: 44px;
}

.corner-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  gap: 4px;
  pointer-events: none;
}

.corner-actions .micro-btn {
  pointer-events: auto;
}

.micro-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  margin: 0;
  border: 0;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #8a9bb3;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.micro-btn .micro-svg {
  width: 13px;
  height: 13px;
  display: block;
  flex-shrink: 0;
}

.micro-btn:hover,
.micro-btn:focus-visible {
  color: var(--accent);
  background: #fff;
}

.micro-btn-danger:hover,
.micro-btn-danger:focus-visible {
  color: #c44d4d;
}

.folder-header-cloud {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 44px 14px 16px;
  margin-bottom: 14px;
}

.folder-header-cloud .brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.folder-header-cloud .brand-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(26, 36, 51, 0.92);
  color: #fff;
  font-size: 0.84rem;
  z-index: 60;
  animation: fadeIn 0.2s ease;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(26, 36, 51, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface-solid);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(26, 36, 51, 0.18);
  padding: 16px;
}

.modal-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
}

.modal-card textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  resize: vertical;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .primary-btn,
.modal-actions .ghost-btn {
  flex: 1;
  width: auto;
}
