:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #0a0a0a;
  color: #e5e5e5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", Meiryo, sans-serif;
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: #171717;
  border: 1px solid #262626;
  border-radius: 16px;
  padding: 32px;
}

.login-card h1 {
  text-align: center;
  margin: 0 0 24px;
  font-size: 20px;
}

.login-card label {
  display: block;
  font-size: 14px;
  color: #a3a3a3;
  margin-bottom: 8px;
}

.login-card input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #404040;
  background: #262626;
  color: #e5e5e5;
  margin-bottom: 16px;
  font-size: 16px;
}

.login-card button {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: #f5f5f5;
  color: #171717;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.error {
  color: #f87171;
  font-size: 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #262626;
}

.topbar-row {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px;
}

.logout-link {
  font-size: 14px;
  color: #a3a3a3;
  text-decoration: none;
}

.logout-link:hover {
  color: #e5e5e5;
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 12px;
}

.category-tab {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 14px;
  border: none;
  cursor: pointer;
  background: #262626;
  color: #d4d4d4;
}

.category-tab.active {
  background: #f5f5f5;
  color: #171717;
}

.gallery {
  position: relative;
  padding: 4px;
}

.gallery-empty {
  text-align: center;
  color: #737373;
  padding: 96px 16px;
}

.photo-tile {
  position: absolute;
  overflow: hidden;
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-touch-callout: none;
  user-select: none;
}

.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #2563eb;
  color: #fff;
  font-size: 28px;
  font-weight: 300;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.fab:hover {
  background: #3b82f6;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: #171717;
  border-radius: 16px;
  padding: 24px;
}

.modal-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.modal-card p {
  margin: 0 0 16px;
  color: #a3a3a3;
  font-size: 14px;
}

.modal-card select,
.modal-card input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #404040;
  background: #262626;
  color: #e5e5e5;
  margin-bottom: 12px;
  font-size: 15px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.btn-secondary,
.btn-primary,
.btn-danger {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  cursor: pointer;
}

.btn-secondary {
  background: transparent;
  border: 1px solid #404040;
  color: #d4d4d4;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: #3b82f6;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  font-weight: 600;
}

.btn-danger:hover {
  background: #ef4444;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.detail-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.97);
  display: flex;
  flex-direction: column;
}

.detail-view[hidden] {
  display: none;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
}

.icon-btn {
  background: none;
  border: none;
  color: #d4d4d4;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.icon-btn:hover {
  color: #fff;
}

.options-wrap {
  position: relative;
}

.options-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  width: 240px;
  background: #171717;
  border: 1px solid #404040;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.options-menu[hidden] {
  display: none;
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  background: none;
  color: #e5e5e5;
  font-size: 14px;
  cursor: pointer;
  border-top: 1px solid #262626;
}

.menu-item:first-child {
  border-top: none;
}

.menu-item:hover {
  background: #262626;
}

.menu-item.danger {
  color: #f87171;
}

.menu-sub {
  display: block;
  font-size: 12px;
  color: #737373;
  margin-top: 2px;
}

.category-submenu {
  max-height: 192px;
  overflow-y: auto;
  border-top: 1px solid #262626;
}

.category-submenu[hidden] {
  display: none;
}

.category-submenu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 24px;
  border: none;
  background: none;
  color: #d4d4d4;
  font-size: 14px;
  cursor: pointer;
}

.category-submenu button:hover {
  background: #262626;
}

.detail-image-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 16px 16px;
}

.detail-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
