:root {
  --bg: #000;
  --bg-secondary: #1c1c1e;
  --text: #fff;
  --text-secondary: #86868b;
  --border: #38383a;
  --primary: #0a84ff;
  --success: #30d158;
  --error: #ff453a;
}

body.light {
  --bg: #f2f2f7;
  --bg-secondary: #fff;
  --text: #000;
  --text-secondary: #6c6c70;
  --border: #d1d1d6;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

.screen {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.3s;
}

.screen.active {
  display: block;
}

.tab {
  display: none;
  min-height: calc(100vh - 60px);
  padding-bottom: 60px;
  animation: slideIn 0.3s;
}

.tab.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.container {
  max-width: 400px;
  margin: 0 auto;
  padding: 60px 24px;
  text-align: center;
}

.lock {
  font-size: 72px;
  margin: 20px 0 16px 0;
}

h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 8px;
}

h2 {
  font-size: 28px;
  font-weight: 700;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 48px;
}

.input {
  width: 100%;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  margin: 8px 0;
  transition: border 0.2s;
}

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

.hint {
  color: var(--text-secondary);
  font-size: 12px;
  text-align: left;
  margin: 4px 0 12px 4px;
}

.rules {
  text-align: left;
  margin: 8px 0 12px 4px;
}

.rule {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 4px 0;
  transition: color 0.2s;
}

.rule.valid {
  color: var(--success);
}

.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  margin: 16px 0 8px 0;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-faceid {
  width: 100%;
  padding: 16px;
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  margin: 8px 0;
  cursor: pointer;
}

.switch {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 24px;
}

.switch a {
  color: var(--primary);
  cursor: pointer;
}

.status {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status.error {
  background: rgba(255, 59, 48, 0.15);
  color: #ff3b30;
}

.status.success {
  background: rgba(52, 199, 89, 0.15);
  color: #34c759;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

#header-username {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 2px;
}

.btn-logout {
  background: var(--bg-secondary);
  color: var(--primary);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}

.fab {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 32px;
  padding: 0;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.4);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
}

.photo-thumb {
  aspect-ratio: 1;
  background: var(--bg-secondary);
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  overflow: hidden;
}

.photo-thumb img {
  display: none;
}

.empty-state-home {
  grid-column: 1/-1;
  text-align: center;
  padding: 80px 40px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-state-home svg {
  color: var(--text-secondary);
  opacity: 0.5;
}

.empty-state-home h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.empty-state-home p {
  font-size: 15px;
  line-height: 1.4;
  max-width: 280px;
  margin: 0;
}

.viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.viewer.active {
  display: flex;
  animation: fadeIn 0.2s;
}

.viewer img {
  max-width: 95%;
  max-height: 95%;
  border-radius: 8px;
  animation: zoomIn 0.3s ease-out;
  object-fit: contain;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  z-index: 50;
}

.nav-item {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item .icon {
  font-size: 24px;
  margin-bottom: 2px;
}

.settings-list {
  padding: 0 24px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.setting-item .arrow {
  color: var(--text-secondary);
  font-size: 20px;
}

.version {
  color: var(--text-secondary);
}

.toggle {
  position: relative;
  width: 51px;
  height: 31px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border);
  border-radius: 31px;
  transition: 0.3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .slider {
  background: var(--success);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

input:disabled + .slider {
  opacity: 0.3;
}

.select {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 15px;
}

.dropdown {
  background: var(--bg-secondary);
  border-radius: 12px;
  margin: 8px 0 16px 0;
  overflow: hidden;
}

.dropdown a {
  display: block;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.dropdown a:last-child {
  border-bottom: none;
}

#move-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

#move-preview img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}

.about-dropdown {
  text-align: center;
  padding: 16px;
}

.about-content h3 {
  font-size: 18px;
  margin-bottom: 12px;
  color: var(--primary);
}

.about-content p {
  font-size: 14px;
  line-height: 1.6;
  margin: 8px 0;
  color: var(--text);
}

.about-content ul {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.about-content li {
  font-size: 14px;
  padding: 6px 0;
  color: var(--text-secondary);
}

.about-content strong {
  color: var(--text);
}

.move-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 60px 24px;
  text-align: center;
}

.move-icon {
  font-size: 72px;
  margin-bottom: 24px;
}

.move-container h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.move-desc {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 32px;
}

.move-btn {
  max-width: 280px;
  margin: 0 auto 24px auto;
}

.move-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
  padding: 12px;
  background: rgba(255, 69, 58, 0.1);
  border: 1px solid rgba(255, 69, 58, 0.3);
  border-radius: 10px;
  margin-bottom: 16px;
}

.move-warning svg {
  flex-shrink: 0;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 340px;
  text-align: center;
}

.modal-content h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.modal-content p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-secondary {
  flex: 1;
  padding: 14px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}