:root {
  --page-bg: #f0f2f5;
  --panel-bg: #ffffff;
  --text: #1c1e21;
  --muted: #606770;
  --line: #dadde1;
  --accent: #1877f2;
  --note-bg: #f7f9fc;
  --skeleton: #e4e6eb;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  --grid-cols: 6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: sans-serif;
  line-height: 1.4;
  overflow-x: hidden;
}

.page {
  max-width: 1060px;
  margin: 18px auto 28px;
  padding: 0 16px;
}

h1 {
  margin: 0 0 8px;
  color: #1f4d7a;
}

h2 {
  margin: 0 0 10px;
  color: #1f4d7a;
}

h3 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}

.intro {
  margin: 0 0 10px;
  color: #333;
  max-width: 760px;
}

.howto {
  margin: 8px 0 14px;
  max-width: 760px;
}

.howto summary {
  cursor: pointer;
  color: #1f4d7a;
  font-weight: 600;
  width: fit-content;
}

.howto ol {
  margin: 8px 0 0 0;
  padding: 8px 12px 8px 28px;
  background: var(--note-bg);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.configure-section,
.test-section {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.configure-section {
  margin-bottom: 16px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.control.changed select,
.control.changed input[type="number"],
.control.changed input[type="text"] {
  border-color: #e6a23c;
  box-shadow: 0 0 0 1px rgba(230, 162, 60, 0.3);
}

.control.changed select:focus,
.control.changed select:focus-visible,
.control.changed input[type="number"]:focus,
.control.changed input[type="number"]:focus-visible,
.control.changed input[type="text"]:focus,
.control.changed input[type="text"]:focus-visible {
  border-color: #e6a23c;
  box-shadow: 0 0 0 2px rgba(230, 162, 60, 0.35);
  outline: none;
}

.control span {
  color: #334155;
  font-weight: 600;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
}

.control-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
}

.check.changed {
  color: #975a16;
}

.check.changed input[type="checkbox"] {
  outline: 1px solid rgba(230, 162, 60, 0.5);
  outline-offset: 2px;
}

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

button {
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #eef2ff;
  color: #111827;
  cursor: pointer;
  padding: 8px 12px;
  font-size: 14px;
}

button:hover {
  background: #e0e7ff;
}

button:active {
  transform: translateY(1px);
}

button.changed {
  border-color: #e6a23c;
  box-shadow: 0 0 0 1px rgba(230, 162, 60, 0.3);
}

button.changed:focus-visible {
  outline-color: #e6a23c;
}

#auto-load[aria-pressed="true"] {
  background: #dbeafe;
  border-color: #93c5fd;
}

.notes {
  margin-top: 10px;
  font-size: 12px;
  color: #667085;
}

.notes-title {
  font-weight: 600;
  margin-bottom: 3px;
}

.notes-list {
  margin: 0;
  padding: 0 0 0 18px;
}

.status-bar {
  margin-bottom: 10px;
  font-size: 13px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
}

.fb-shell {
  border: 1px solid #dadde1;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.fb-header-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 14px 8px;
}

.fb-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fb-action-link {
  color: var(--accent);
  background: transparent;
  border-color: transparent;
  font-weight: 600;
}

.fb-action-link:hover {
  background: #f1f5ff;
}

.fb-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f0f2f5;
  padding: 0;
  font-weight: 700;
}

.fb-tabs {
  display: flex;
  gap: 6px;
  padding: 0 14px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.tab {
  background: transparent;
  border-color: transparent;
  color: #65676b;
  font-weight: 600;
  border-radius: 6px;
}

.tab.active {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: 0;
}

.album-grid {
  --card-gap: 8px;
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  gap: var(--card-gap);
  padding: 12px;
  align-items: start;
}

.album-card,
.create-card,
.album-filler,
.skeleton-card {
  min-width: 0;
}

.album-card,
.create-card {
  position: relative;
}

.album-link,
.create-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.album-cover,
.create-cover,
.skeleton-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f2f5;
  border: 1px solid #e5e7eb;
}

.album-cover img,
.create-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.create-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ebedf0;
  font-size: 64px;
  font-weight: 300;
  color: #5c5f66;
}

.album-title,
.create-title {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.22;
  color: #1c1e21;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.album-count {
  margin-top: 2px;
  font-size: 14px;
  color: #65676b;
}

.album-menu {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 15px;
  border: none;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 18px;
  line-height: 0;
  padding: 0;
}

.album-menu:hover {
  background: rgba(0, 0, 0, 0.58);
}

.album-filler {
  aspect-ratio: 1 / 1;
}

.loading-layer {
  padding: 0 12px 14px;
}

.loading-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  gap: 8px;
}

.skeleton-cover,
.skeleton-line {
  background: var(--skeleton);
  border-radius: 8px;
}

.skeleton-line {
  height: 11px;
  margin-top: 8px;
}

.skeleton-line.short {
  width: 40%;
}

.skeleton-line.long {
  width: 62%;
}

.hidden {
  display: none;
}

.end-marker {
  margin: 4px 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #475569;
  background: #f8fafc;
}

.scroll-sentinel {
  height: 1px;
}

@media (max-width: 1100px) {
  .controls-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .controls-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .album-grid,
  .loading-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .album-title,
  .create-title {
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 0 10px;
    margin-top: 10px;
  }

  .fb-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .album-grid,
  .loading-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .album-title,
  .create-title {
    font-size: 15px;
  }

  .album-count {
    font-size: 13px;
  }
}
