/* drew here — clean & practical */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Inter:wght@400;500;600&family=Noto+Sans+JP:wght@400;500&family=Noto+Sans+SC:wght@400;500&family=Noto+Serif+SC:wght@400;500;600&display=swap');

:root {
  --bg: #0c0c0c;
  --surface: #161616;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --text: #f5f5f5;
  --text2: #a3a3a3;
  --text3: #737373;
  --primary: #f5f5f5;
  --primary-fg: #0c0c0c;
  --danger: #ef4444;
  --radius: 10px;
  --topbar-h: 56px;
  --tools-w: 240px;
  --font-serif: 'Cormorant Garamond', 'Noto Serif SC', serif;
  --font-sans: 'Inter', 'Noto Sans SC', 'Noto Sans JP', system-ui, sans-serif;
}

html[lang="ja"] {
  --font-serif: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', sans-serif;
  --font-sans: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', sans-serif;
}

html[lang="ja"] .hero-text-inner h1,
html[lang="ja"] .hero-text-inner p,
html[lang="ja"] .block-title,
html[lang="ja"] .page-head h1,
html[lang="ja"] .logo {
  letter-spacing: 0.04em;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ── Top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(12, 12, 12, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1100px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.logo span {
  font-weight: 400;
  color: var(--text2);
}

.topbar-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  font-size: 14px;
  color: var(--text2);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface2);
}

.nav-link.active {
  color: var(--text);
  background: var(--surface2);
  font-weight: 500;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.lang-sep {
  color: var(--text3);
  font-size: 12px;
  padding: 0 2px;
}

.lang-btn {
  font-size: 13px;
  padding: 6px 8px;
  border: none;
  background: none;
  color: var(--text3);
  cursor: pointer;
  border-radius: 6px;
}

.lang-btn:hover { color: var(--text2); }
.lang-btn.active { color: var(--text); font-weight: 500; }

/* ── Layout ── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.footer {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--text3);
  border-top: 1px solid var(--border);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn:hover { background: var(--surface2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}

.btn-primary:hover { background: #e5e5e5; }

.btn-lg {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
}

/* ── Home hero: text box aligns with painting frame (same grid row) ── */
.hero {
  padding: 24px 0 32px;
}

.hero-sync {
  display: grid;
  grid-template-columns: 1fr 252px;
  grid-template-rows: auto 1fr auto;
  gap: 8px 28px;
  align-items: stretch;
}

.hero-text-box {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 0 8px 0 0;
  background: transparent;
  border: none;
  min-height: 252px;
}

.hero-text-inner h1 {
  font-family: var(--font-serif);
  font-size: clamp(28px, 3.6vw, 40px);
  font-weight: 500;
  line-height: 1.28;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.hero-text-inner h1 span:last-child {
  font-weight: 400;
  color: var(--text2);
}

.hero-text-inner p {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 400;
  color: var(--text2);
  line-height: 1.75;
  max-width: 28em;
  letter-spacing: 0.01em;
}

.hero-cta {
  align-self: stretch;
  width: 100%;
  max-width: 320px;
  margin: 4px 0 0;
  padding: 18px 32px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: 8px;
  border: none;
  background: #eab308;
  color: #1a1a1a;
  box-shadow: 0 4px 20px rgba(234, 179, 8, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.hero-cta:hover {
  background: #facc15;
  color: #1a1a1a;
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(234, 179, 8, 0.45);
}

.hero-art-badge {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}

.hero-art-badge span {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #1a1a1a;
  background: #eab308;
  padding: 4px 10px;
  border-radius: 4px;
}

.hero-art-frame {
  grid-column: 2;
  grid-row: 2;
  min-height: 252px;
  display: flex;
  flex-direction: column;
}

.hero-art-plaque {
  grid-column: 2;
  grid-row: 3;
}

.hero-art-plaque:empty {
  display: none;
}

.museum-frame-link,
.museum-plaque-link {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
}

.museum-frame {
  position: relative;
  padding-top: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 252px;
}

.museum-wire {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 14px;
  background: #525252;
}

.museum-wire::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #525252;
}

.museum-canvas {
  flex: 1;
  background: #f5f5f4;
  padding: 8px;
  border: 3px solid #3f3f46;
  box-shadow:
    inset 0 0 0 1px #71717a,
    4px 8px 24px rgba(0, 0, 0, 0.45);
  min-height: 0;
}

.museum-canvas img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
}

.museum-plaque-link {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}

.museum-stat {
  font-size: 12px;
  color: var(--text3);
}

.museum-frame-link:hover .museum-canvas {
  box-shadow:
    inset 0 0 0 1px #71717a,
    6px 12px 32px rgba(0, 0, 0, 0.55);
}

.spotlight-empty {
  flex: 1;
  min-height: 252px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text3);
  font-size: 14px;
  padding: 16px;
  text-align: center;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.block-note {
  font-size: 12px;
  color: var(--text3);
}

.gallery-browse {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.rank-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 7px;
  border-radius: 5px;
  z-index: 1;
}

.block {
  margin-bottom: 48px;
}

.block-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 0;
}

.page-head h1 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.page-head p,
.page-lead {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text2);
}

.gallery-card .art-meta .name,
.art-meta .name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.museum-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 2px;
}

.art-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}

.leaderboard-item.rank-1 .art-thumb {
  border-color: #525252;
}

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

.art-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0,0,0,0.65);
  padding: 2px 8px;
  border-radius: 6px;
}

.scroll-wrap {
  overflow: hidden;
  margin: 0 -20px;
  padding: 0 20px;
}

.scroll-track {
  display: flex;
  gap: 14px;
  animation: marquee 70s linear infinite;
  width: max-content;
}

.scroll-track:hover { animation-play-state: paused; }

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.scroll-item {
  flex-shrink: 0;
  width: 140px;
  text-decoration: none;
  color: inherit;
}

.scroll-item .art-thumb { width: 140px; }

.scroll-item .name {
  font-size: 12px;
  color: var(--text2);
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Gallery ── */
.page-head {
  padding: 32px 0 24px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}

.gallery-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.gallery-card .art-thumb { aspect-ratio: 1; }

.views-tag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(0,0,0,0.7);
  padding: 3px 8px;
  border-radius: 6px;
  color: #fff;
}

.gallery-card .art-meta { margin-top: 10px; }

.art-meta {
  margin-top: 8px;
}

.art-meta .stat {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

.gallery-browse .gallery-card .desc,
.gallery-grid .gallery-card .desc {
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Draw page ── */
body[data-page="draw"] {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

body[data-page="draw"] .draw-page {
  flex: 1;
  min-height: 0;
}

body[data-page="draw"] .tpf {
  flex-shrink: 0;
}

.draw-page {
  display: flex;
  min-height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px));
}

.draw-tools {
  width: var(--tools-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  overflow-y: auto;
}

.draw-tools-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tool-block {
  margin-bottom: 24px;
}

.tool-block > label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 10px;
}

.brush-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.brush-btn {
  font-size: 13px;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text2);
  cursor: pointer;
}

.brush-btn:hover { border-color: #404040; color: var(--text); }
.brush-btn.active {
  border-color: #737373;
  background: var(--surface2);
  color: var(--text);
  font-weight: 500;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.color-swatch {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.color-swatch.active { border-color: #fff; }

.color-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.color-custom input[type="color"] {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  background: none;
}

.color-custom span { font-size: 13px; color: var(--text3); }

.size-slider {
  width: 100%;
  accent-color: #fff;
}

.draw-main {
  flex: 1;
  min-width: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  overflow-y: auto;
}

.draw-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.draw-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.draw-toolbar-mobile {
  display: none;
}

.draw-bottom-bar {
  display: none;
}

.canvas-box {
  width: 100%;
  max-width: min(600px, 100%);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

#drawCanvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  touch-action: none;
}

.draw-actions {
  display: none;
}

.draw-submit-primary {
  width: 100%;
  min-height: 56px;
  padding: 16px 24px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: none;
  border-radius: var(--radius);
  background: #eab308;
  color: #1a1a1a;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(234, 179, 8, 0.3);
  transition: background 0.15s, transform 0.15s;
}

.draw-submit-primary:hover:not(:disabled) {
  background: #facc15;
  transform: translateY(-1px);
}

.draw-submit-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.draw-bottom-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.draw-bottom-row {
  display: flex;
  gap: 8px;
}

.bottom-btn {
  flex: 1;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.bottom-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bottom-btn-secondary {
  background: var(--surface);
  color: var(--text);
}

.bottom-btn-secondary:hover:not(:disabled) {
  background: var(--surface2);
}

.bottom-btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.45);
}

.bottom-btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
}

.bottom-btn-primary {
  background: #eab308;
  color: #1a1a1a;
  border: none;
  font-weight: 600;
}

.bottom-btn-primary:hover:not(:disabled) {
  background: #facc15;
}

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

.action-btn-sm {
  flex: 1;
  min-height: 44px;
  font-size: 14px;
}

/* Desktop: bottom bar in column */
@media (min-width: 769px) {
  .draw-scroll {
    flex: 1;
    overflow-y: auto;
  }

  .draw-column .draw-main {
    flex: 1;
    overflow-y: visible;
  }

  .draw-bottom-bar {
    display: block;
    width: 100%;
    max-width: min(600px, 100%);
    margin: 0 auto;
    padding: 0 24px 24px;
  }

  .draw-form {
    margin-bottom: 0;
  }
}

.action-btn {
  flex: 1;
  min-height: 48px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}

.action-btn:hover { background: var(--surface2); }

.action-btn-danger {
  color: #fca5a5;
  border-color: #7f1d1d;
}

.action-btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.draw-form {
  width: 100%;
  max-width: min(600px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.field {
  margin-bottom: 16px;
  position: relative;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text2);
}

.field input,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: #525252;
}

.field textarea { resize: vertical; min-height: 64px; }

.field-count {
  position: absolute;
  right: 0;
  top: 0;
  font-size: 12px;
  color: var(--text3);
}

.form-hint {
  font-size: 13px;
  color: var(--danger);
  margin-top: 10px;
  text-align: center;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text2);
  cursor: pointer;
  font-size: 18px;
  z-index: 1;
}

.modal-image-wrap {
  padding: 12px;
  background: #fff;
  border-radius: 12px 12px 0 0;
}

.modal-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
}

.modal-body { padding: 20px; }

.modal-body h3 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 8px;
}

.modal-body p {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text2);
  margin-bottom: 12px;
}

.modal-clicks { font-size: 13px; color: var(--text3); }

.loading, .empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text3);
}

.empty-state p { margin-bottom: 16px; color: var(--text2); }

/* ── Admin ── */
.admin-page {
  min-height: 100vh;
  background: var(--bg);
}

.admin-login-card {
  max-width: 360px;
  margin: 0 auto;
  padding: 80px 20px;
}

.admin-login-card h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 6px;
}

.admin-login-card p {
  color: var(--text2);
  margin-bottom: 24px;
}

.admin-login-card label {
  display: block;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 6px;
}

.admin-login-card input {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  margin-bottom: 16px;
}

.admin-error {
  color: #fca5a5;
  font-size: 13px;
  margin-top: 12px;
}

.admin-dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-header h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
}

.admin-subtitle {
  color: var(--text3);
  font-size: 14px;
  margin-top: 4px;
}

.admin-header-actions {
  display: flex;
  gap: 8px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.admin-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.admin-stat-label {
  display: block;
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 8px;
}

.admin-stat-value {
  font-size: 24px;
  font-weight: 600;
}

.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.admin-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-panel-head h2 {
  font-size: 16px;
  font-weight: 600;
}

.admin-progress {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.admin-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #eab308, #facc15);
  border-radius: 999px;
  transition: width 0.3s;
}

.admin-note {
  font-size: 12px;
  color: var(--text3);
  margin-top: 8px;
}

.admin-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
}

.admin-chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.admin-chart-fill {
  width: 100%;
  max-width: 40px;
  background: #eab308;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
}

.admin-chart-bar span {
  font-size: 11px;
  color: var(--text3);
}

.admin-chart-bar em {
  font-style: normal;
  font-size: 11px;
  color: var(--text2);
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  font-size: 12px;
  color: var(--text3);
  font-weight: 500;
}

.admin-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg);
}

.admin-desc {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text2);
}

.admin-delete {
  color: #fca5a5;
  border-color: #7f1d1d;
  padding: 6px 12px;
  font-size: 13px;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 768px) {
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-header {
    flex-direction: column;
  }

  .admin-table th:nth-child(3),
  .admin-table td:nth-child(3) {
    display: none;
  }
}

/* ── Mobile ── */
@media (max-width: 768px) {
  :root {
    --topbar-h: 52px;
    --mobile-dock-h: 0px;
  }

  .topbar-inner { padding: 0 12px; gap: 8px; }
  .logo { font-size: 18px; }
  .nav-link { padding: 8px 8px; font-size: 12px; }
  .lang-btn { padding: 6px 6px; font-size: 12px; }

  .main { padding: 0 12px 40px; }

  .hero { padding: 16px 0 24px; }

  .hero-sync {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 12px;
  }

  .hero-text-box {
    grid-column: 1;
    grid-row: 1;
    min-height: auto;
    gap: 16px;
    padding: 0;
  }

  .hero-art-badge { grid-column: 1; grid-row: 2; }
  .hero-art-frame { grid-column: 1; grid-row: 3; min-height: 240px; }
  .hero-art-plaque { grid-column: 1; grid-row: 4; }

  .hero-cta {
    max-width: none;
    width: 100%;
    justify-content: center;
    padding: 18px 24px;
    font-size: 18px;
  }

  .museum-frame { min-height: 240px; }

  .gallery-browse {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .block { margin-bottom: 36px; }
  .block-title { font-size: 20px; }
  .page-head { padding: 20px 0 16px; }
  .page-head h1 { font-size: 26px; }

  /* ── Draw page: compact toolbar + fixed bottom actions ── */
  body[data-page="draw"] {
    --topbar-h: 44px;
    overscroll-behavior: none;
    overflow: hidden;
    height: 100dvh;
  }

  body[data-page="draw"] .topbar-inner {
    padding: 0 8px;
    gap: 6px;
  }

  body[data-page="draw"] .logo {
    font-size: 17px;
  }

  body[data-page="draw"] .nav-link {
    padding: 6px 6px;
    font-size: 11px;
  }

  body[data-page="draw"] .lang-btn {
    padding: 5px 5px;
    font-size: 11px;
  }

  body[data-page="draw"] .draw-tools-desktop {
    display: none;
  }

  body[data-page="draw"] .draw-page {
    flex-direction: column;
    overflow: hidden;
  }

  body[data-page="draw"] .draw-column {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  body[data-page="draw"] .draw-toolbar-mobile {
    display: block;
    flex-shrink: 0;
    position: relative;
    margin: 4px 8px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 8px;
    z-index: 10;
  }

  body[data-page="draw"] .draw-scroll {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body[data-page="draw"] .draw-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 4px 8px 6px;
    gap: 6px;
    align-items: stretch;
  }

  body[data-page="draw"] .toolbar-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
  }

  body[data-page="draw"] .toolbar-field {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  body[data-page="draw"] .toolbar-field.toolbar-size {
    flex: 1.2;
  }

  body[data-page="draw"] .toolbar-label {
    font-size: 11px;
    color: var(--text3);
    letter-spacing: 0.03em;
  }

  body[data-page="draw"] .toolbar-select {
    width: 100%;
    padding: 6px 6px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
  }

  body[data-page="draw"] .color-picker-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  body[data-page="draw"] .color-picker-btn.open {
    border-color: #737373;
    background: var(--surface2);
  }

  body[data-page="draw"] .color-picker-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: #000;
  }

  body[data-page="draw"] .color-popover {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 50;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  }

  body[data-page="draw"] .color-popover[hidden] {
    display: none;
  }

  body[data-page="draw"] .color-palette-popover {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    margin-bottom: 10px;
  }

  body[data-page="draw"] .color-palette-popover .color-swatch {
    aspect-ratio: 1;
    width: 100%;
    min-width: 0;
    border-radius: 6px;
  }

  body[data-page="draw"] .canvas-box {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
  }

  body[data-page="draw"] #drawCanvas {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    display: block;
    margin: 0 auto;
  }

  body[data-page="draw"] .draw-form {
    max-width: 100%;
    flex-shrink: 0;
    margin-bottom: 0;
  }

  body[data-page="draw"] .draw-form-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    padding: 6px 8px;
  }

  body[data-page="draw"] .draw-form-compact .field {
    margin-bottom: 0;
  }

  body[data-page="draw"] .draw-form-compact .field label {
    font-size: 11px;
    margin-bottom: 2px;
  }

  body[data-page="draw"] .draw-form-compact .field input {
    padding: 5px 8px;
    font-size: 16px;
  }

  body[data-page="draw"] .draw-form-compact .field-count {
    font-size: 10px;
  }

  body[data-page="draw"] .field input,
  body[data-page="draw"] .field textarea {
    font-size: 14px;
  }

  body[data-page="draw"] .draw-bottom-bar {
    display: block;
    flex-shrink: 0;
    width: 100%;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(22, 22, 22, 0.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  }

  body[data-page="draw"] .draw-bottom-row .bottom-btn {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 13px;
  }

  body[data-page="draw"] .form-hint {
    text-align: center;
    margin-top: 4px;
    margin-bottom: 0;
    font-size: 11px;
    line-height: 1.2;
  }

  body[data-page="draw"] .form-hint:empty {
    display: none;
  }
}
