* {
  box-sizing: border-box;
}

:root {
  --page-bg: #f7f7f7;
  --surface: #ffffff;
  --surface-soft: #f1f2f4;
  --text: #1f2328;
  --muted: #7d838c;
  --line: rgba(31, 35, 40, 0.09);
  --primary: #101418;
  --primary-soft: #eceff2;
  --accent: #c69a35;
  --radius: 8px;
  --shadow: 0 10px 28px rgba(18, 22, 28, 0.08);
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: #e9eaec;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.file-input {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.app-shell {
  width: min(100vw, 430px);
  height: 100vh;
  height: 100svh;
  min-height: 0;
  max-height: 100vh;
  max-height: 100svh;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  background: var(--page-bg);
  box-shadow: 0 0 36px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.page {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@supports (height: 100dvh) {
  .app-shell {
    height: 100dvh;
    max-height: 100dvh;
  }
}

.mobile-navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  flex: 0 0 auto;
  padding: 0 16px 8px;
  background: rgba(247, 247, 247, 0.94);
  backdrop-filter: blur(16px);
}

.mobile-navbar-home {
  background: #fff;
  backdrop-filter: none;
}

.mobile-navbar-inner {
  border-bottom: 1px solid var(--line);
}

.mini-nav-row {
  position: relative;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-nav-left {
  width: 82px;
  flex: 0 0 82px;
  display: flex;
  align-items: center;
}

.mini-back-button {
  width: 36px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #1d1d1f;
  background: transparent;
}

.mini-back-button span {
  width: 10px;
  height: 10px;
  display: block;
  margin-left: 4px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.mini-nav-title {
  position: absolute;
  left: 50%;
  max-width: 150px;
  margin: 0;
  overflow: hidden;
  color: #1d1d1f;
  font-size: 16px;
  font-weight: 650;
  line-height: 1;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
}

.mini-nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 82px;
  flex: 0 0 82px;
  margin-left: auto;
}

.home-page {
  position: relative;
  height: 100%;
  min-height: 0;
  padding: 0 0 28px;
  overflow: hidden;
  color: #1c1d1f;
  background: #fff;
}

.create-page,
.album-page {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.create-page {
  background: #fff;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mini-status {
  height: 48px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 0 8px;
  font-size: 15px;
  font-weight: 760;
  line-height: 1;
}

.status-right {
  display: flex;
  align-items: center;
  gap: 7px;
}

.signal-bars {
  height: 13px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.signal-bars i {
  width: 3px;
  display: block;
  border-radius: 999px;
  background: #111;
}

.signal-bars i:nth-child(1) {
  height: 5px;
}

.signal-bars i:nth-child(2) {
  height: 8px;
}

.signal-bars i:nth-child(3) {
  height: 11px;
}

.signal-bars i:nth-child(4) {
  height: 13px;
}

.battery {
  position: relative;
  min-width: 25px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: #fff;
  background: #b9bcc1;
  font-size: 10px;
  font-weight: 760;
}

.battery::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 5px;
  width: 2px;
  height: 6px;
  border-radius: 0 3px 3px 0;
  background: #c7c9cd;
}

.mini-capsule {
  position: relative;
  width: 82px;
  height: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
}

.mini-capsule::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 50%;
  width: 1px;
  background: rgba(0, 0, 0, 0.08);
}

.capsule-dots {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.capsule-dots i {
  width: 5px;
  height: 5px;
  display: block;
  border-radius: 50%;
  background: #1d1d1f;
}

.capsule-ring {
  width: 16px;
  height: 16px;
  justify-self: center;
  border: 3px solid #1d1d1f;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #fff;
}

.home-brand {
  display: grid;
  justify-items: center;
  padding-right: 28px;
  padding-left: 28px;
  padding-top: clamp(44px, 8vh, 88px);
  text-align: center;
}

.home-logo {
  width: min(64vw, 252px);
  height: auto;
  display: block;
}

.home-actions {
  display: grid;
  justify-items: center;
  gap: 13px;
  margin-top: auto;
  padding-right: 28px;
  padding-left: 28px;
  padding-bottom: 4px;
}

.home-action-copy {
  margin: 0 0 3px;
  color: #bebfc2;
  font-size: 17px;
}

.entry-button {
  width: min(100%, 236px);
  min-height: 62px;
  padding: 0 28px;
  border-radius: 999px;
  text-align: center;
  color: #fff;
  background: #191919;
  box-shadow: none;
  font-size: 24px;
  font-weight: 520;
  letter-spacing: 0;
}

.album-link {
  width: min(100%, 236px);
  min-height: 62px;
  padding: 0 28px;
  border-radius: 999px;
  color: #4f545a;
  background: #f2f3f4;
  font-size: 24px;
  font-weight: 520;
}

.preview-area {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 28px 14px 12px;
}

.preview-toolbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
}

.preview-save-button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(16, 20, 24, 0.12);
  font-size: 14px;
  font-weight: 650;
}

.canvas-wrap {
  width: min(100%, 382px);
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.canvas-replace-button {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: initial;
  -webkit-tap-highlight-color: transparent;
}

.canvas-replace-button:active {
  transform: scale(0.996);
}

.canvas-replace-button:focus-visible {
  outline: 2px solid rgba(16, 20, 24, 0.32);
  outline-offset: 2px;
}

#previewCanvas {
  width: auto;
  max-width: 100%;
  max-height: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  pointer-events: none;
}

.inline-padding-control {
  width: min(100%, 382px);
  flex: 0 0 auto;
  margin: -2px auto 0;
}

.inline-padding-control input[type="range"] {
  width: 100%;
  display: block;
  accent-color: var(--primary);
}

.bottom-panel {
  flex: 0 0 auto;
  min-height: 196px;
  padding: 14px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.category-strip {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  padding-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-strip::-webkit-scrollbar,
.frame-strip::-webkit-scrollbar {
  display: none;
}

.category-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: #4f5660;
  background: var(--surface-soft);
}

.category-button.active {
  color: #fff;
  background: var(--primary);
}

.frame-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
}

.frame-item {
  flex: 0 0 96px;
  min-height: 122px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-soft);
}

.frame-item.active {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 8px 18px rgba(16, 20, 24, 0.12);
}

.thumb-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 11px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, var(--frame-color), var(--accent), var(--frame-color)),
    var(--frame-color);
}

.thumb-preview.has-texture {
  padding: 0;
  background: #f4f5f6;
}

.thumb-material {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.thumb-photo {
  width: 100%;
  height: 100%;
  display: block;
  border: 8px solid #fff;
  background:
    linear-gradient(135deg, #e6ebf1 0%, #f9fafb 52%, #d8dee6 100%);
}

.frame-name {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px;
}

.document-head {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
}

.document-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.document-search {
  display: block;
  margin-top: 12px;
}

.document-search input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  outline: none;
  color: var(--text);
  background: var(--surface-soft);
}

.album-section {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-top: 14px;
}

.document-list {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.document-card {
  width: 100%;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: var(--radius);
  text-align: left;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
}

.document-card-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.document-card-main strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-card-main small {
  display: -webkit-box;
  max-height: 2.9em;
  overflow: hidden;
  color: #69717b;
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.document-card-main em {
  display: block;
  overflow: hidden;
  color: #9aa0a8;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-badge {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #191919;
  font-size: 12px;
  font-weight: 750;
}

.file-badge-pdf {
  background: #d83b35;
}

.file-badge-docx {
  background: #2563c9;
}

.file-badge-xlsx {
  background: #218348;
}

.file-badge-ppt {
  background: #d65a2f;
}

.empty-state {
  margin: 0;
  padding: 28px 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

@media (max-width: 360px) {
  .preview-area,
  .bottom-panel,
  .album-content {
    padding-left: 10px;
    padding-right: 10px;
  }

  .frame-item {
    flex-basis: 88px;
  }
}
