:root {
  --purple: #663399;
  --purple-dark: #4b2479;
  --purple-soft: #f3eef9;
  --text: #1d1d24;
  --muted: #6b6b78;
  --border: #e4e1ea;
  --bg: #f7f6fa;
  --card: #ffffff;
  --danger: #c0392b;
  --success: #1e8e5a;
  --warn-bg: #fff6e0;
  --warn: #8a5a00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--purple); }

header {
  background: var(--purple);
  color: #fff;
}

.header-inner, main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 64px;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 20px;
}

.brand span { font-weight: 400; letter-spacing: 0; opacity: 0.85; margin-left: 8px; font-size: 15px; }

nav { display: flex; gap: 8px; align-items: center; }
nav form { margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--purple);
  color: #fff;
}
.btn:hover { background: var(--purple-dark); }
.btn.light { background: #fff; color: var(--purple); }
.btn.light:hover { background: var(--purple-soft); }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.5); }
.btn.ghost:hover { background: rgba(255,255,255,0.12); }
.btn.outline { background: #fff; color: var(--text); border-color: var(--border); }
.btn.outline:hover { background: var(--bg); }
.btn.danger { background: #fff; color: var(--danger); border-color: #f0c9c4; padding: 6px 10px; font-size: 13px; }
.btn.danger:hover { background: #fdf0ee; }

main { padding-top: 28px; padding-bottom: 60px; }

h1 { font-size: 26px; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 0 0 22px; }

.flash {
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 14px;
  border: 1px solid var(--border);
  background: #fff;
}
.flash.success { border-color: #bfe5d1; background: #eefaf3; color: var(--success); }
.flash.error { border-color: #f0c9c4; background: #fdf0ee; color: var(--danger); }
.flash.info { background: var(--purple-soft); border-color: #dccdee; color: var(--purple-dark); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search {
  flex: 1;
  min-width: 220px;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.search:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(102,51,153,0.15); }

.count { color: var(--muted); font-size: 14px; white-space: nowrap; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card .img {
  aspect-ratio: 450 / 138;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.card .img img { max-width: 100%; max-height: 100%; }

.card .meta {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card .name { font-size: 14px; font-weight: 600; word-break: break-word; }
.card form { margin: 0; }

.empty { color: var(--muted); padding: 40px 0; text-align: center; display: none; }

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 560px;
}
.panel.wide { max-width: none; }

label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 6px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

input[type=text], input[type=password], input[type=file] {
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.field { margin-bottom: 18px; }

.notice {
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 14px;
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid #f1dfb0;
}
.notice.info { background: var(--purple-soft); color: var(--purple-dark); border-color: #dccdee; }

.compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.compare h3, .posts h3 { font-size: 14px; color: var(--muted); margin: 0 0 8px; font-weight: 600; }

.checker {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  display: flex;
  justify-content: center;
}
.checker img { max-width: 100%; }

.posts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.posts img { width: 100%; border-radius: 8px; border: 1px solid var(--border); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions form { margin: 0; }

@media (max-width: 600px) {
  .brand span { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
