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

:root {
  --page-max-width: 1160px;
  --page-horizontal-padding: 16px;
  --gallery-min-column: 260px;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: #06090d;
  background-image:
    linear-gradient(rgba(6, 9, 13, 0.62), rgba(6, 9, 13, 0.82)),
    url('/123.png');
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  color: #e8edf5;
  min-height: 100vh;
}

@supports (-webkit-touch-callout: none) {
  body {
    background-image:
      linear-gradient(rgba(6, 9, 13, 0.62), rgba(6, 9, 13, 0.82)),
      url('/123-mobile.jpg');
    background-attachment: scroll;
  }
}

button,
input {
  font: inherit;
}

button {
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s, opacity 0.2s;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  transform: none;
}

input:focus,
button:focus {
  outline: none;
}

.hidden {
  display: none !important;
}

.container {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 24px var(--page-horizontal-padding) 48px;
}

.site-shell {
  position: relative;
}

.page-header {
  position: relative;
  margin-bottom: 24px;
  min-height: 52px;
  padding: 0 128px;
}

h1 {
  text-align: center;
  margin-bottom: 0;
  font-size: 38px;
  color: #f6f8fb;
  letter-spacing: 0.04em;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.site-title-link {
  color: inherit;
  text-decoration: none;
}

.site-title-link:hover {
  color: #ffffff;
}

.header-nav {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
}

.header-nav-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.header-nav-home {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.page-entry-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(15, 21, 31, 0.82);
  color: #f6f8fb;
  text-decoration: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}

.page-entry-link:hover {
  background: rgba(28, 37, 52, 0.92);
  border-color: rgba(255, 255, 255, 0.22);
}

.page-entry-link-battle {
  min-height: 56px;
  padding: 14px 28px;
  border-color: rgba(255, 123, 123, 0.4);
  background: linear-gradient(135deg, rgba(198, 44, 44, 0.96), rgba(150, 18, 18, 0.96));
  box-shadow: 0 16px 32px rgba(103, 16, 16, 0.34);
}

.page-entry-link-battle:hover {
  background: linear-gradient(135deg, rgba(216, 58, 58, 0.98), rgba(166, 22, 22, 0.98));
  border-color: rgba(255, 148, 148, 0.48);
}

.page-entry-link-works {
  background: rgba(15, 21, 31, 0.86);
}

.page-entry-link.current {
  cursor: default;
  background: rgba(28, 37, 52, 0.92);
  border-color: rgba(255, 255, 255, 0.24);
}

.page-entry-link-battle.current {
  background: linear-gradient(135deg, rgba(198, 44, 44, 0.98), rgba(150, 18, 18, 0.98));
  border-color: rgba(255, 148, 148, 0.48);
}

.header-history-btn {
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(15, 21, 31, 0.86);
  color: #f6f8fb;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.header-history-btn:hover {
  background: rgba(28, 37, 52, 0.92);
  border-color: rgba(255, 255, 255, 0.22);
}

body[data-page="home"] .page-header {
  min-height: 128px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

body[data-page="home"] h1 {
  font-size: clamp(56px, 7vw, 78px);
  line-height: 1.05;
  letter-spacing: 0.05em;
  text-shadow: 0 14px 38px rgba(0, 0, 0, 0.46);
}

.user-menu {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 20;
}

.user-menu-button {
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(15, 21, 31, 0.82);
  color: #f6f8fb;
  cursor: pointer;
  min-width: 96px;
}

.user-menu-button:hover {
  background: rgba(28, 37, 52, 0.92);
  border-color: rgba(255, 255, 255, 0.22);
}

.user-menu-button[aria-expanded="true"] {
  background: rgba(28, 37, 52, 0.92);
  border-color: rgba(255, 255, 255, 0.24);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(11, 16, 24, 0.94);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.current-nickname {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #f6f8fb;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.user-menu-item:hover {
  background: rgba(28, 37, 52, 0.92);
}

.user-menu-item.danger {
  color: #ffb3b3;
}

.user-menu-item.danger:hover {
  background: rgba(118, 34, 42, 0.9);
  color: #ffd7d7;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 10, 0.44);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.auth-card {
  width: min(100%, 420px);
  padding: 32px 28px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(11, 16, 24, 0.86);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.auth-brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #88a6ff;
  margin-bottom: 14px;
}

.auth-title {
  font-size: 30px;
  color: #f6f8fb;
  margin-bottom: 10px;
}

.auth-subtitle {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(232, 237, 245, 0.74);
  margin-bottom: 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #f6f8fb;
}

.auth-form input::placeholder {
  color: rgba(232, 237, 245, 0.48);
}

.auth-form input:focus {
  border-color: rgba(122, 162, 255, 0.76);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.14);
}

.auth-form button {
  margin-top: 4px;
  padding: 13px 16px;
  border: none;
  border-radius: 12px;
  background: #4a6cf7;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.auth-form button:hover {
  background: #3a5ce5;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.auth-link-btn {
  padding: 0;
  border: none;
  background: transparent;
  color: #a7b6dd;
  cursor: pointer;
}

.auth-link-btn:hover {
  color: #d5deff;
}

.auth-message {
  min-height: 22px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #8ad59f;
}

.auth-message.error {
  color: #ff9e9e;
}

.upload-section,
.card,
.history-item {
  background: rgba(14, 20, 29, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.upload-section {
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.image-upload-form {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.image-upload-form input[type="text"] {
  flex: 1;
  min-width: 160px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #f6f8fb;
}

.image-upload-form input[type="text"]::placeholder {
  color: rgba(232, 237, 245, 0.46);
}

.image-upload-form input[type="text"]:focus {
  border-color: rgba(122, 162, 255, 0.76);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.14);
}

.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 128px;
  padding: 11px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #f6f8fb;
  cursor: pointer;
}

.file-label:hover {
  background: rgba(255, 255, 255, 0.12);
}

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

.image-upload-form button,
.vote-btn,
.edit-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: #4a6cf7;
  color: #fff;
  cursor: pointer;
}

.image-upload-form button:hover,
.vote-btn:hover,
.edit-btn:hover {
  background: #3a5ce5;
}

.admin-upload-section {
  margin-bottom: 0;
}

.admin-upload-tip {
  margin-top: 14px;
  color: rgba(232, 237, 245, 0.68);
  line-height: 1.6;
}

.status-bar {
  text-align: center;
  padding: 11px 14px;
  margin-bottom: 16px;
  border-radius: 12px;
  font-size: 14px;
  background: rgba(28, 74, 43, 0.76);
  border: 1px solid rgba(108, 201, 135, 0.26);
  color: #d6ffe1;
}

.status-bar.error {
  background: rgba(113, 29, 29, 0.78);
  border-color: rgba(255, 123, 123, 0.28);
  color: #ffd9d9;
}

.phase-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 0 24px;
}

.phase-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 138px;
  min-width: 260px;
  padding: 18px 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  background: rgba(14, 20, 29, 0.82);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.phase-pill-label {
  font-size: 16px;
  color: rgba(232, 237, 245, 0.68);
  letter-spacing: 0.06em;
}

.phase-pill-time {
  font-size: 60px;
  font-weight: 800;
  line-height: 1;
  color: #f6f8fb;
  letter-spacing: 0.04em;
}

.admin-gate,
.admin-panel {
  background: rgba(14, 20, 29, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.admin-gate {
  max-width: 680px;
  margin: 24px auto 0;
  padding: 28px 24px;
  text-align: center;
  line-height: 1.7;
  color: rgba(232, 237, 245, 0.82);
}

.admin-gate a {
  color: #a9beff;
}

.admin-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-panel {
  padding: 20px;
}

.phase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.phase-card {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

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

.phase-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.phase-card-title {
  font-size: 20px;
  color: #f6f8fb;
  margin: 0 0 6px;
}

.phase-card-status {
  font-size: 14px;
  color: rgba(232, 237, 245, 0.66);
  margin: 0;
}

.phase-card-time {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #f6f8fb;
}

.phase-start-btn,
.phase-extend-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
}

.phase-start-btn {
  background: #4a6cf7;
}

.phase-start-btn:hover {
  background: #3a5ce5;
}

.phase-extend-btn {
  background: rgba(255, 255, 255, 0.1);
}

.phase-extend-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.phase-reset-btn {
  padding: 10px 18px;
  border: 1px solid rgba(255, 173, 173, 0.24);
  border-radius: 12px;
  background: rgba(113, 29, 29, 0.78);
  color: #ffd9d9;
  cursor: pointer;
}

.phase-reset-btn:hover {
  background: rgba(147, 35, 35, 0.88);
}

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

.section-title {
  font-size: 22px;
  color: #f6f8fb;
  margin: 0;
}

.upload-notice,
.empty-state {
  text-align: center;
  color: rgba(232, 237, 245, 0.72);
  padding: 16px 8px;
  line-height: 1.6;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--gallery-min-column), 1fr));
  gap: 20px;
}

.card {
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-2px);
}

.card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  cursor: pointer;
  display: block;
}

body[data-page="home"] .card img {
  height: auto;
  aspect-ratio: 3 / 4;
}

.card-body {
  padding: 14px;
}

.card-body h3 {
  font-size: 16px;
  line-height: 1.4;
  margin-bottom: 12px;
  color: #f6f8fb;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  margin-bottom: 10px;
  font-size: 13px;
  color: rgba(232, 237, 245, 0.64);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.vote-count {
  font-size: 14px;
  color: rgba(232, 237, 245, 0.72);
}

.admin-home-actions {
  width: 100%;
  justify-content: flex-end;
}

.delete-home-btn {
  padding: 10px 16px;
  border: 1px solid rgba(255, 138, 128, 0.28);
  border-radius: 10px;
  background: rgba(113, 29, 29, 0.78);
  color: #ffd9d9;
  cursor: pointer;
}

.delete-home-btn:hover {
  background: rgba(147, 35, 35, 0.88);
}

.vote-btn.voted {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(232, 237, 245, 0.7);
}

.vote-btn.my-vote {
  background: #2e7d32;
  color: #fff;
}

.archive-btn {
  padding: 12px 32px;
  background: #d74f41;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
}

.archive-btn:hover {
  background: #be3f33;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 32px 0 16px;
  flex-wrap: wrap;
}

.history-title {
  font-size: 22px;
  color: #f6f8fb;
  margin: 0;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
}

.clear-history-btn {
  padding: 10px 18px;
  border: 1px solid rgba(255, 138, 128, 0.28);
  border-radius: 10px;
  background: rgba(113, 29, 29, 0.78);
  color: #ffd9d9;
  cursor: pointer;
}

.clear-history-btn:hover {
  background: rgba(147, 35, 35, 0.88);
}

.delete-round-btn {
  padding: 8px 14px;
  border: 1px solid rgba(255, 138, 128, 0.28);
  border-radius: 10px;
  background: rgba(113, 29, 29, 0.72);
  color: #ffd9d9;
  cursor: pointer;
  flex-shrink: 0;
}

.delete-round-btn:hover {
  background: rgba(147, 35, 35, 0.84);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 10px;
  cursor: pointer;
}

.history-item:hover {
  background: rgba(19, 27, 39, 0.92);
}

.history-name {
  font-size: 15px;
  font-weight: 600;
  color: #f6f8fb;
}

.round-meta {
  margin-left: auto;
  font-size: 13px;
  color: rgba(232, 237, 245, 0.6);
}

.round-arrow {
  margin-left: 8px;
  font-size: 12px;
  color: rgba(232, 237, 245, 0.5);
}

.history-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 900;
  overflow-y: auto;
  background: rgba(7, 10, 15, 0.96);
}

.history-modal.active {
  display: block;
}

.modal-header {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 24px var(--page-horizontal-padding) 0;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.modal-header h2 {
  font-size: 22px;
  color: #f6f8fb;
}

.modal-date {
  font-size: 13px;
  color: rgba(246, 248, 251, 0.68);
}

.modal-back {
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #f6f8fb;
  cursor: pointer;
}

.modal-back:hover {
  background: rgba(255, 255, 255, 0.14);
}

#modal-gallery {
  max-width: var(--page-max-width);
  margin: 20px auto;
  padding: 0 var(--page-horizontal-padding) 32px;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1300;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  object-fit: contain;
}

@media (min-width: 1600px) {
  :root {
    --page-max-width: 1480px;
    --page-horizontal-padding: 24px;
    --gallery-min-column: 300px;
  }

  body[data-page="home"] .page-header {
    margin-bottom: 40px;
  }

  body[data-page="home"] h1 {
    font-size: clamp(64px, 4.8vw, 88px);
  }

  .gallery {
    gap: 24px;
  }

  .card img {
    height: 260px;
  }

  .phase-pill {
    min-width: 320px;
    min-height: 152px;
    padding: 20px 28px;
  }

  .phase-pill-time {
    font-size: 72px;
  }

  .admin-content {
    gap: 28px;
  }

  .admin-panel {
    padding: 24px;
  }
}

@media (min-width: 2200px) {
  :root {
    --page-max-width: 1760px;
    --page-horizontal-padding: 36px;
    --gallery-min-column: 340px;
  }

  body[data-page="home"] h1 {
    font-size: clamp(72px, 4.4vw, 96px);
  }

  .gallery {
    gap: 28px;
  }

  .card img {
    height: 300px;
  }

  .phase-pill {
    min-width: 360px;
    min-height: 172px;
  }

  .phase-pill-time {
    font-size: 88px;
  }

  .history-item,
  .upload-section,
  .card,
  .admin-panel {
    border-radius: 20px;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 32px;
  }

  body[data-page="home"] .page-header {
    min-height: 132px;
    margin-bottom: 28px;
  }

  body[data-page="home"] h1 {
    font-size: clamp(42px, 12vw, 56px);
    line-height: 1.08;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .card img {
    height: 160px;
  }

  .card-body {
    padding: 10px;
  }

  .card-body h3 {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .card-meta,
  .vote-count {
    font-size: 12px;
  }

  .image-upload-form {
    flex-direction: column;
    align-items: stretch;
  }

  .image-upload-form input[type="text"],
  .file-label,
  .image-upload-form button {
    width: 100%;
    text-align: center;
  }

  .card-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .card-actions {
    justify-content: stretch;
  }

  .vote-btn,
  .edit-btn {
    width: 100%;
  }

  .page-header {
    min-height: 96px;
    padding-top: 52px;
    padding-inline: 0;
  }

  .header-nav {
    top: 0;
    left: 0;
  }

  .user-menu {
    top: 0;
    right: 0;
  }

  .header-nav-home,
  .header-nav-row {
    gap: 10px;
  }

  .header-history-btn {
    padding-inline: 14px;
  }

  .user-menu-button {
    min-width: 88px;
  }

  .user-menu-dropdown {
    width: 160px;
  }

  .phase-bar {
    align-items: stretch;
  }

  .phase-pill {
    width: 100%;
    min-width: 0;
    min-height: 128px;
    border-radius: 18px;
  }

  .phase-pill-time {
    font-size: 48px;
  }

  .phase-grid {
    grid-template-columns: 1fr;
  }

  .phase-card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .phase-card-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .phase-start-btn,
  .phase-extend-btn {
    width: 100%;
  }

  .phase-reset-btn {
    width: 100%;
  }

  .admin-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-panel-header .archive-btn {
    width: 100%;
  }

  .history-header {
    flex-direction: column;
    align-items: stretch;
  }

  .history-title {
    text-align: center;
  }

  .clear-history-btn {
    width: 100%;
  }

  .history-item {
    flex-wrap: wrap;
  }

  .round-meta {
    margin-left: 0;
    width: 100%;
  }
}
