/* === Sotas Design Tokens === */
:root {
  --color-primary: #09B5BA;
  --color-primary-hover: #088A8E;
  --color-primary-subtle: #E4F7F7;
  --color-primary-tint: #F0FAFA;
  --color-bg: #FFFFFF;
  --color-bg-surface: #F2F2F2;
  --color-text: #333333;
  --color-text-sub: #777777;
  --color-text-hint: #AAAAAA;
  --color-text-disabled: #CCCCCC;
  --color-border: #E5E5E5;
  --color-on-fill: #FFFFFF;
  --color-negative: #D91D2D;
  --color-negative-subtle: #FBE7E6;
  --font-sans: 'BIZ UDPGothic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-card: 0px 0px 32px 0px rgba(0,0,0,0.02), 0px 4px 20px -8px rgba(0,0,0,0.06);
}

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

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* === Password Gate === */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
}

.gate-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 288px;
}

.gate-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gate-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
}

.gate-subtitle {
  font-size: 14px;
  color: var(--color-text-sub);
}

.gate-hint {
  font-size: 14px;
  color: var(--color-text-sub);
}

.input-wrap {
  position: relative;
  width: 100%;
}

.input-wrap input {
  width: 100%;
  padding: 8px 40px 8px 12px;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s;
  font-family: var(--font-sans);
}

.input-wrap input:focus {
  border-color: var(--color-primary);
}

.input-wrap input.error {
  border-color: var(--color-negative);
  background-color: var(--color-negative-subtle);
}

.toggle-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-hint);
  padding: 2px;
  display: flex;
  align-items: center;
}

.toggle-pw:hover { color: var(--color-text-sub); }

.error-msg {
  font-size: 12px;
  color: var(--color-negative);
  margin-top: -8px;
}

.gate-submit {
  width: 100%;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-on-fill);
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
  font-family: var(--font-sans);
}

.gate-submit:hover { background: var(--color-primary-hover); }

/* === Gallery === */
.gallery {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px;
}

.gallery-header {
  margin-bottom: 24px;
}

.gallery-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}

.gallery-header p {
  font-size: 14px;
  color: var(--color-text-sub);
  margin-top: 4px;
}

/* === Search + Count Controls === */
.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 480px;
}

.search-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-hint);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 32px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-tint);
}

.search-wrap input::placeholder {
  color: var(--color-text-hint);
}

.proto-count {
  font-size: 12px;
  color: var(--color-text-hint);
  white-space: nowrap;
}

/* === Table === */
.table-wrap {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.proto-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.proto-table thead {
  background: var(--color-bg-surface);
}

.proto-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-sub);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  user-select: none;
}

.proto-table th.sortable {
  cursor: pointer;
  transition: background 0.1s;
}

.proto-table th.sortable:hover {
  background: var(--color-border);
}

.proto-table th.sortable-active {
  color: var(--color-primary-hover);
}

.proto-table th .sort-arrow {
  margin-left: 4px;
  font-size: 11px;
}

.proto-table tbody tr.row {
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--color-border);
}

.proto-table tbody tr.row:last-child {
  border-bottom: none;
}

.proto-table tbody tr.row:hover {
  background: var(--color-primary-tint);
}

.proto-table tbody tr.row:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.proto-table td {
  padding: 12px;
  vertical-align: middle;
  color: var(--color-text);
  line-height: 1.4;
}

.col-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  min-width: 200px;
  max-width: 320px;
}

.row-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-lock {
  flex-shrink: 0;
  color: var(--color-text-hint);
}

.col-desc {
  color: var(--color-text-sub);
  min-width: 240px;
  max-width: 480px;
}

.col-tags {
  min-width: 140px;
}

.col-author {
  white-space: nowrap;
  color: var(--color-text-sub);
}

.col-date {
  white-space: nowrap;
  color: var(--color-text-hint);
  font-size: 12px;
}

.muted {
  color: var(--color-text-hint);
}

.empty-msg {
  padding: 40px 12px;
  text-align: center;
  color: var(--color-text-hint);
  font-size: 13px;
}

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

.card {
  display: block;
  padding: 20px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-card);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.4;
}

.card-lock {
  flex-shrink: 0;
  color: var(--color-text-hint);
  margin-top: 2px;
}

.card-desc {
  font-size: 13px;
  color: var(--color-text-sub);
  margin-top: 8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--color-text-hint);
}

.card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--color-primary-tint);
  color: var(--color-primary-hover);
}

/* === Hidden === */
.hidden { display: none !important; }
