:root {
  --bg: #080d1d;
  --panel: #111a31;
  --panel-2: #151f3a;
  --text: #f6f8ff;
  --muted: #9ca8c4;
  --line: rgba(255, 255, 255, 0.12);
  --lime: #ccff5c;
  --cyan: #54ebd2;
  --pink: #ff4fc8;
  --red: #ff6b78;
  --blue: #50a7ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  color-scheme: dark;
}

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

body {
  min-width: 320px;
  min-height: 100svh;
  background:
    radial-gradient(circle at 12% 8%, rgba(139, 92, 246, 0.2), transparent 28rem),
    radial-gradient(circle at 90% 75%, rgba(84, 235, 210, 0.12), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.55;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

button {
  border: 0;
  cursor: pointer;
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-brand > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--pink), #8b5cf6, var(--blue));
  box-shadow: 0 10px 25px rgba(139, 92, 246, 0.35);
  font-weight: 1000;
  transform: rotate(-5deg);
}

.admin-brand strong,
.admin-brand small {
  display: block;
  line-height: 1.15;
}

.admin-brand small {
  margin-top: 0.25rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
}

.login-shell {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 1.25rem;
}

.login-card {
  width: min(480px, 100%);
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(17, 26, 49, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.login-copy {
  margin: 3rem 0 2rem;
}

.login-copy > p,
.dashboard-intro > div > p,
.card-heading p,
.status-card > p,
.password-card > p {
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.login-copy h1 {
  margin: 0.35rem 0 0.6rem;
  font-size: clamp(2rem, 9vw, 3.2rem);
  letter-spacing: -0.055em;
  line-height: 1;
}

.login-copy > span {
  color: var(--muted);
}

.login-form,
#contentForm,
#passwordForm {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
}

label > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: 0;
  background: rgba(255, 255, 255, 0.045);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input,
select {
  min-height: 49px;
  padding: 0 0.85rem;
}

textarea {
  min-height: 130px;
  padding: 0.8rem;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--cyan);
  background: rgba(84, 235, 210, 0.05);
  box-shadow: 0 0 0 4px rgba(84, 235, 210, 0.09);
}

.login-form button,
.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-weight: 900;
  transition: transform 160ms ease, opacity 160ms ease;
}

.login-form button,
.primary-button {
  background: var(--lime);
  color: #10182c;
}

.login-form button:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
}

.login-form button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.back-link {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem max(1rem, calc((100vw - 1220px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 29, 0.82);
  backdrop-filter: blur(22px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.header-actions a,
.header-actions button {
  min-height: 40px;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.dashboard {
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) 0 6rem;
}

.dashboard-intro {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 500px);
  align-items: end;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.dashboard-intro h1 {
  margin-top: 0.25rem;
  font-size: clamp(2.5rem, 6vw, 5rem);
  letter-spacing: -0.06em;
  line-height: 0.95;
}

.dashboard-intro > p {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 1rem;
}

.editor-card,
.status-card,
.password-card,
.library-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(17, 26, 49, 0.82);
  box-shadow: var(--shadow);
}

.editor-card,
.library-card {
  padding: clamp(1.2rem, 3vw, 2rem);
}

.side-panel {
  display: grid;
  gap: 1rem;
}

.status-card,
.password-card {
  padding: 1.35rem;
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card-heading h2,
.status-card h2,
.password-card h2 {
  margin-top: 0.2rem;
  font-size: 1.4rem;
  letter-spacing: -0.035em;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.note-only[hidden],
.translation-panel[hidden] {
  display: none;
}

.translation-editor {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.018);
}

.translation-tabs {
  display: flex;
  gap: 0.3rem;
  padding: 0.55rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.translation-tabs button {
  min-height: 38px;
  padding: 0 0.85rem;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.translation-tabs button.is-active {
  background: var(--lime);
  color: #10182c;
}

.translation-panel {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.upload-zone {
  position: relative;
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 0.4rem;
  overflow: hidden;
  padding: 1.5rem;
  border: 1px dashed rgba(84, 235, 210, 0.45);
  border-radius: 18px;
  background: rgba(84, 235, 210, 0.035);
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  border-color: var(--lime);
  background: rgba(204, 255, 92, 0.06);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  background: var(--cyan);
  color: #0d172c;
  font-size: 1.8rem;
  font-weight: 400;
}

.upload-zone strong,
.upload-zone small {
  position: relative;
  z-index: 1;
}

.upload-zone small {
  max-width: 410px;
  color: var(--muted);
}

.upload-zone img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.28;
}

.primary-button {
  gap: 0.7rem;
}

.primary-button i {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(16, 24, 44, 0.28);
  border-top-color: #10182c;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.primary-button.is-loading i {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.text-button {
  background: transparent;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
}

.form-message {
  display: none;
  padding: 0.7rem 0.8rem;
  border-radius: 11px;
  font-size: 0.8rem;
}

.form-message:not(:empty) {
  display: block;
  border: 1px solid rgba(84, 235, 210, 0.3);
  background: rgba(84, 235, 210, 0.08);
  color: var(--cyan);
}

.form-message.is-error:not(:empty) {
  border-color: rgba(255, 107, 120, 0.35);
  background: rgba(255, 107, 120, 0.08);
  color: var(--red);
}

.status-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1.1rem 0;
}

.status-card dl div {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.status-card dt {
  color: var(--lime);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.2rem;
  font-weight: 900;
}

.status-card dd,
.status-note {
  color: var(--muted);
  font-size: 0.7rem;
}

.status-note.is-ready {
  color: var(--cyan);
}

.status-note.is-error {
  color: var(--red);
}

.password-card h2 {
  margin-bottom: 1rem;
}

#passwordForm {
  gap: 0.75rem;
}

#passwordForm input {
  min-height: 44px;
}

.secondary-button {
  min-height: 46px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.library-card {
  margin-top: 1rem;
}

.library-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.library-filters button {
  min-height: 36px;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.library-filters button.is-active {
  border-color: var(--lime);
  background: var(--lime);
  color: #10182c;
}

.content-library {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.library-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.library-item img {
  width: 100%;
  height: 100%;
  min-height: 130px;
  object-fit: cover;
}

.library-item-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 0.8rem;
}

.library-item-body small {
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.55rem;
  letter-spacing: 0.08em;
}

.library-item-body h3 {
  overflow: hidden;
  margin-top: 0.15rem;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.translation-summary {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.63rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-item-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: auto;
  padding-top: 0.6rem;
}

.library-item-actions button {
  display: grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  padding: 0 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.66rem;
}

.library-item-actions .edit-button {
  color: var(--cyan);
}

.library-item-actions .delete-button {
  margin-left: auto;
  color: var(--red);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 2.5rem;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .admin-header {
    min-height: 66px;
  }

  .admin-header .admin-brand small,
  .header-actions a {
    display: none;
  }

  .dashboard {
    width: min(100% - 20px, 560px);
    padding-top: 2rem;
  }

  .dashboard-intro {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .field-row,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .content-library {
    grid-template-columns: 1fr;
  }

  .library-card .card-heading {
    display: grid;
  }

  .library-item {
    grid-template-columns: 110px minmax(0, 1fr);
  }
}
