:root {
  --primary: #335fff;
  --primary-hover: #2a4fd6;
  --primary-weak: #eef2ff;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1a1b1e;
  --text-2: #5c5f66;
  --text-3: #8a8d93;
  --line: #e4e6ea;
  --danger: #e5484d;
  --radius: 12px;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/20px Geist, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 24px; line-height: 32px; font-weight: 600; }
h2 { font-size: 18px; line-height: 26px; font-weight: 600; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1200px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--primary); }
.top nav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.top nav a { color: var(--text-2); }
.who { color: var(--text-3); font-size: 12px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline { display: inline; margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--text-2); cursor: pointer; }
@media (max-width: 640px) { .who { display: none; } .top nav { gap: 12px; } }

main { max-width: 1200px; margin: 0 auto; padding: 32px 16px 64px; }
.head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.desc { color: var(--text-2); margin: 0; }
.muted { color: var(--text-3); }
.small { font-size: 12px; line-height: 18px; }

/* Buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; background: var(--bg); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); }
input[type=text], input[type=url], input[type=search], input[type=email], textarea, select {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font: inherit; color: var(--text);
}
textarea { height: auto; min-height: 88px; padding: 8px 12px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 240px; }
.filters select { flex: 0 1 200px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 24px; padding: 0; list-style: none; }
.chip { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--text-2); font-size: 12px; }
.chip:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.chip[aria-current] { background: var(--primary); border-color: var(--primary); color: #fff; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.tag { display: inline-flex; height: 22px; align-items: center; padding: 0 8px; border-radius: 11px; background: var(--primary-weak); color: var(--primary); font-size: 12px; }

/* Gallery */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
@media (max-width: 400px) { .grid { grid-template-columns: 1fr; } }
.card { position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(51, 95, 255, .08); }
.thumbs { display: flex; gap: 8px; height: 200px; padding: 12px; background: #eceef2; }
.thumbs .pc { flex: 1 1 auto; min-width: 0; }
.thumbs .phone { flex: 0 0 92px; }
.thumbs img, .thumbs .none { width: 100%; height: 100%; object-fit: cover; object-position: top left; border-radius: 6px; background: var(--card); }
.thumbs .none { display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 12px; }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 16px; }
.card-title { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--text); }
.card-title::after { content: ''; position: absolute; inset: 0; } /* whole card clicks through to the title link */
.card-title:hover { text-decoration: none; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--text-3); font-size: 12px; line-height: 18px; }
.meta .slack { position: relative; z-index: 1; } /* above the stretched title link */
.empty { padding: 64px 16px; text-align: center; color: var(--text-3); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Detail */
.crumb { display: inline-block; margin-bottom: 16px; color: var(--text-2); }
.detail-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: none; font: inherit; color: var(--text-2); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
/* The viewport keeps its real device width and is scaled around its top center by app.js, so a
   1280px page shrinks into the column without being clipped on either side. */
.stage { position: relative; overflow: hidden; }
.viewport { position: absolute; top: 0; left: 50%; transform-origin: top center; }
.viewport iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.stage[data-mode=phone] .viewport { top: 8px; }
.stage[data-mode=phone] .viewport iframe { border-radius: 20px; box-shadow: 0 0 0 8px #1a1b1e; }

.prose { line-height: 24px; overflow-wrap: anywhere; }
.prose h1 { font-size: 22px; line-height: 30px; margin: 24px 0 12px; }
.prose h2 { font-size: 18px; line-height: 26px; margin: 24px 0 8px; }
.prose h3 { font-size: 16px; line-height: 24px; margin: 20px 0 8px; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose table, .prose pre, .prose blockquote { margin: 0 0 12px; }
.prose img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--bg); }
.prose code { font: 13px/20px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); padding: 1px 4px; border-radius: 4px; }
.prose pre { background: var(--bg); padding: 12px; border-radius: 8px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { padding: 0 12px; color: var(--text-2); border: 1px solid var(--line); border-radius: 8px; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.shots a { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 12px; overflow-wrap: anywhere; }
.shots img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--line); }

/* Forms and tables */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 500; }
.field .hint { color: var(--text-3); font-size: 12px; line-height: 18px; }
.notice { padding: 12px 16px; border-radius: 8px; background: var(--primary-weak); color: var(--text); margin-bottom: 16px; }
.notice.error { background: #fdecec; color: #a3191e; }
.secret { display: block; margin-top: 8px; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; font: 13px/20px ui-monospace, Menlo, monospace; overflow-wrap: anywhere; user-select: all; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.list th { color: var(--text-3); font-weight: 500; font-size: 12px; }

/* Login */
.login { max-width: 400px; margin: 10vh auto 0; text-align: center; display: flex; flex-direction: column; gap: 16px; }
.login .btn { height: 44px; }
.login form { display: flex; flex-direction: column; gap: 8px; text-align: left; }
