* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
  background: #1e2126;
  color: #e8e6e0;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid #3a3d44;
}
.title-block { display: flex; align-items: baseline; gap: 16px; }
header h1 { font-size: 20px; margin: 0; letter-spacing: 0.02em; display: flex; align-items: center; gap: 10px; }
.member-count {
  font-size: 28px;
  font-weight: 700;
  color: #c9a24b;
  letter-spacing: 0.02em;
}
.member-count #memberCount { font-size: 34px; }
.member-count-note { font-size: 11px; font-weight: 500; color: #9a9da4; margin-left: 3px; white-space: nowrap; }
.edit-badge {
  font-size: 11px;
  font-weight: 600;
  color: #1e2126;
  background: #c9a24b;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0;
}
.header-actions { display: flex; align-items: center; gap: 16px; }
.list-link {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #c9a24b;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #4a4e56;
  border-radius: 6px;
  padding: 9px 14px;
}
.list-link:hover { border-color: #c9a24b; background: rgba(201, 162, 75, 0.08); }
.list-link-icon { font-size: 15px; line-height: 1; }
.login-btn {
  background: transparent;
  border: 1px solid #4a4e56;
  color: #b7b4ab;
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
}
.login-btn:hover { border-color: #c9a24b; color: #c9a24b; }
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 13, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.login-overlay[hidden] { display: none; }
.login-box {
  background: #262a31;
  border: 1px solid #3a3d44;
  border-radius: 10px;
  padding: 24px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-box h2 { margin: 0 0 4px; font-size: 16px; }
.login-box input {
  background: #1e2126;
  border: 1px solid #3a3d44;
  color: #e8e6e0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
}
.login-error { color: #d98080; font-size: 12px; }
.login-actions { display: flex; justify-content: flex-end; gap: 8px; }
.login-actions button {
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #4a4e56;
  background: transparent;
  color: #e8e6e0;
}
.login-actions button[type="submit"] {
  background: #c9a24b;
  border-color: #c9a24b;
  color: #1e2126;
  font-weight: 600;
}
.card.readonly .name-input,
.card.readonly .yomi-input,
.card.readonly .logout-input,
.card.readonly .logout-unit,
.card.readonly .rank-input,
.card.readonly .note-input {
  opacity: 0.85;
}
.card.readonly .name-input,
.card.readonly .yomi-input,
.card.readonly .logout-input,
.card.readonly .logout-unit,
.card.readonly .rank-input {
  pointer-events: none;
}
.card.readonly .note-input {
  cursor: default;
  resize: none;
}
.card.readonly .delete-btn,
.card.readonly .drag-handle,
.card.readonly .photo-adjust-btn,
.card.readonly .photo-zoom-wrap,
.card.readonly .row {
  display: none;
}
.card.readonly .photo-drop {
  pointer-events: none;
  cursor: default;
}
.card.readonly .photo-placeholder {
  display: none;
}
.add-btn {
  background: #c9a24b;
  color: #1e2126;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
}
.add-btn:hover { background: #ddb862; }

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

.card {
  position: relative;
  background: #262a31;
  border: 1px solid #3a3d44;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card.dragging { opacity: 0.4; }
.drag-handle {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(30, 33, 38, 0.7);
  color: #c9a24b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.drag-handle:active { cursor: grabbing; }
body.reordering { cursor: grabbing; user-select: none; }
body.reordering .card:not(.dragging) { transition: transform 0.1s ease; }

.photo-drop {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #33373f;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.photo-drop.dragover { outline: 2px dashed #c9a24b; outline-offset: -6px; }
.photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.photo-placeholder {
  color: #8a8d94;
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
  padding: 8px;
}
.photo-adjust-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  z-index: 3;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(30, 33, 38, 0.75);
  border: 1px solid #4a4e56;
  color: #c9a24b;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-adjust-btn:hover { border-color: #c9a24b; }
.photo-adjust-btn.active { background: #c9a24b; color: #1e2126; }
.photo-drop.adjusting { cursor: move; }
.photo-drop.adjusting .photo-img { cursor: move; }
.photo-zoom-wrap {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  z-index: 3;
  background: rgba(30, 33, 38, 0.75);
  border-radius: 6px;
  padding: 4px 8px;
}
.photo-zoom { width: 100%; accent-color: #c9a24b; }

.fields {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
input, textarea, select {
  background: #1e2126;
  border: 1px solid #3a3d44;
  color: #e8e6e0;
  border-radius: 5px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #c9a24b;
}
.name-input { font-size: 15px; font-weight: 600; }
.yomi-input {
  font-family: 'Yomogi', 'Klee One', sans-serif;
  font-size: 15px;
  color: #c9a24b;
  background: transparent;
  border: none;
  border-bottom: 1px dashed #4a4e56;
  border-radius: 0;
  padding: 2px 4px 4px;
  margin-top: -4px;
}
.yomi-input::placeholder { font-family: inherit; color: #6a6d74; }
.yomi-input:focus { border-bottom-color: #c9a24b; }
.row { display: flex; align-items: center; gap: 6px; }
.row label { font-size: 12px; color: #9a9da4; white-space: nowrap; }
.logout-input { width: 60px; }
.logout-unit { flex: 1; }
.note-input {
  resize: vertical;
  min-height: 44px;
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #c9a24b #1e2126;
}
.note-input::-webkit-scrollbar { width: 6px; }
.note-input::-webkit-scrollbar-track { background: #1e2126; border-radius: 3px; }
.note-input::-webkit-scrollbar-thumb { background: #c9a24b; border-radius: 3px; }
.delete-btn {
  background: transparent;
  border: 1px solid #6b3a3a;
  color: #d98080;
  border-radius: 5px;
  padding: 6px;
  cursor: pointer;
  font-size: 12px;
  margin-top: 4px;
}
.delete-btn:hover { background: #3a2626; }
.trial-section {
  margin: 40px 28px 20px;
  padding-top: 28px;
  border-top: 1px solid #3a3d44;
}
.trial-section h2 {
  font-size: 16px;
  font-weight: 600;
  color: #c9a24b;
  margin: 0 0 20px 0;
  letter-spacing: 0.02em;
}
