:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191b20;
  --panel-soft: #22252c;
  --text: #f5f0e8;
  --muted: #aeb5c2;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #f2b84b;
  --accent-strong: #3fbf8f;
  --danger: #dc6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
label,
select,
input[type="range"] {
  cursor: pointer;
}

input[type="file"] {
  display: none;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: block;
  min-height: 100vh;
  background: #000;
}

.stage {
  display: flex;
  min-width: 0;
  min-height: 100vh;
  padding: 0;
}

.viewer {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #000;
}

.viewer img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  place-self: center;
  opacity: 0;
  transition: opacity 420ms ease;
}

.viewer img.is-visible {
  display: block;
  opacity: 1;
}

.viewer.cover img {
  object-fit: contain;
}

.empty-state {
  display: grid;
  place-items: center;
  max-width: 520px;
  padding: 28px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  font-size: 44px;
  line-height: 1;
}

.empty-state h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.08;
  letter-spacing: 0;
}

.empty-state p {
  margin: 16px 0 26px;
  color: var(--muted);
  line-height: 1.7;
}

.control-panel {
  display: none;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 22px;
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.brand-row,
.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.icon-button,
.control-button,
.primary-action,
.secondary-action,
.danger-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 20px;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.control-button {
  min-height: 44px;
  background: var(--panel-soft);
  color: var(--text);
}

.control-button.strong,
.primary-action {
  background: var(--accent-strong);
  color: #07110e;
}

.primary-action,
.secondary-action,
.danger-button {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 0 16px;
}

.secondary-action {
  background: var(--accent);
  color: #211707;
}

.danger-button {
  background: rgba(220, 107, 107, 0.16);
  color: #ffb9b9;
}

.field {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.field span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.field b {
  color: var(--text);
}

select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-strong);
}

.status {
  min-height: 40px;
  color: var(--muted);
  font-size: 14px;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--panel-soft);
}

.thumb.is-active {
  border-color: var(--accent);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .stage {
    min-height: 58vh;
    padding: 10px;
  }

  .viewer {
    min-height: 56vh;
  }

  .control-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .thumbs {
    grid-template-columns: repeat(5, 1fr);
    max-height: 180px;
  }
}

.admin-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.admin-header h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.08;
  letter-spacing: 0;
}

.secondary-link {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 800;
}

.admin-login,
.admin-tools {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.text-input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
}

.upload-box {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 150px;
  padding: 24px;
  border: 1px dashed rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  background: #050608;
  color: var(--text);
  text-align: center;
}

.upload-box span {
  color: var(--accent);
  font-size: 24px;
  font-weight: 900;
}

.upload-box small,
.admin-empty {
  color: var(--muted);
}

.admin-status {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.photo-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.photo-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center center;
}

.photo-item div {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.photo-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danger-small {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: rgba(220, 107, 107, 0.16);
  color: #ffb9b9;
  font-weight: 800;
}

@media (max-width: 680px) {
  .admin-header {
    align-items: stretch;
    flex-direction: column;
  }
}
