:root {
  --bg: #e7edf1;
  --ink: #16202a;
  --muted: #647386;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(22, 32, 42, 0.13);
  --brand: #00b8d4;
  --hot: #f59e0b;
  --deep: #07111b;
  --shadow: 0 18px 48px rgba(8, 19, 31, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Bahnschrift", "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 0%, rgba(0, 184, 212, 0.18), transparent 28rem),
    radial-gradient(circle at 92% 12%, rgba(245, 158, 11, 0.15), transparent 24rem),
    linear-gradient(135deg, #f8fafc, var(--bg));
}

.cabinet-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: end;
  padding: 34px max(18px, calc((100vw - 1200px) / 2)) 38px;
  color: #f8fafc;
  background:
    linear-gradient(120deg, rgba(7, 17, 27, 0.98), rgba(6, 70, 94, 0.96)),
    radial-gradient(circle at 80% 10%, rgba(0, 184, 212, 0.55), transparent 18rem);
  box-shadow: var(--shadow);
}

.back-link {
  display: inline-flex;
  margin-bottom: 14px;
  color: rgba(248, 250, 252, 0.76);
  text-decoration: none;
}

.back-link:hover { color: #fff; }

h1, h2, h3, p { margin: 0; }

h1 {
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: -0.08em;
}

.cabinet-hero p {
  max-width: 700px;
  margin-top: 16px;
  color: rgba(248, 250, 252, 0.72);
  line-height: 1.55;
}

.hero-card {
  min-width: 170px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}

.hero-card strong {
  display: block;
  font-size: 2.4rem;
  line-height: 1;
}

.hero-card span { color: rgba(248, 250, 252, 0.7); }

.cabinet-layout {
  width: min(1100px, calc(100% - 28px));
  margin: 28px auto 54px;
}

.auth-card,
.builds-card,
.build-card {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.auth-card {
  max-width: 520px;
  padding: 18px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(7, 17, 27, 0.07);
}

.tab {
  border: 0;
  border-radius: 999px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.tab.active {
  color: #06111a;
  background: linear-gradient(135deg, var(--brand), #ecfeff 58%, var(--hot));
}

.auth-form { display: none; }
.auth-form.active { display: grid; gap: 12px; }
.auth-form h2 { letter-spacing: -0.04em; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

input:focus {
  outline: 2px solid rgba(0, 184, 212, 0.24);
  border-color: var(--brand);
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 11px 15px;
  border: 0;
  border-radius: 999px;
  color: #06111a;
  background: linear-gradient(135deg, var(--brand), #ecfeff 58%, var(--hot));
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(0, 184, 212, 0.18);
}

.button.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: none;
}

.form-message {
  min-height: 22px;
  margin-top: 12px;
  color: #14532d;
  font-weight: 800;
}

.form-message.error { color: #b91c1c; }

.builds-card {
  padding: 18px;
}

.section-head,
.build-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.section-head h2,
.build-card h3 { letter-spacing: -0.04em; }
.section-head p,
.build-card p { color: var(--muted); }

.empty-state {
  display: grid;
  gap: 10px;
  place-items: start;
  padding: 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(0, 184, 212, 0.1), rgba(245, 158, 11, 0.08));
}

.empty-state strong { font-size: 1.2rem; }
.empty-state span { color: var(--muted); }

.build-list {
  display: grid;
  gap: 14px;
}

.build-card {
  padding: 16px;
}

.build-card-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 245px;
  gap: 16px;
  align-items: start;
}

.build-frame-preview {
  display: grid;
  place-items: center;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.42) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.42) 1px, transparent 1px),
    radial-gradient(circle at center, #ffffff, #eaf1f6);
  background-size: 22px 22px, 22px 22px, auto;
  overflow: hidden;
}

.build-frame-preview img {
  width: 92%;
  height: 176px;
  object-fit: contain;
  filter: drop-shadow(0 12px 16px rgba(8, 19, 31, 0.16));
}

.build-card-head span {
  padding: 7px 10px;
  border-radius: 999px;
  color: #ecfeff;
  background: var(--deep);
  font-weight: 900;
}

.build-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.build-stats span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 800;
  font-size: 0.86rem;
}

.build-card ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.build-card li {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
}

.open-build {
  width: max-content;
  margin-top: 14px;
}

.detail-layout {
  display: grid;
  gap: 18px;
}

.detail-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.detail-items li {
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
}

.detail-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  resize: vertical;
}

textarea:focus {
  outline: 2px solid rgba(0, 184, 212, 0.24);
  border-color: var(--brand);
}

.file-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.file-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
}

.file-row strong,
.file-row span {
  display: block;
}

.file-row span,
.muted {
  color: var(--muted);
}

.availability-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.availability-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
}

.availability-row div {
  display: grid;
  gap: 4px;
}

.availability-row span {
  color: var(--muted);
  font-weight: 800;
}

.availability-row a {
  color: #075985;
  font-weight: 900;
}

.notice {
  padding: 12px 14px;
  border-radius: 16px;
  font-weight: 800;
}

.notice.ok {
  color: #14532d;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
}

.notice.error {
  color: #7f1d1d;
  background: #fee2e2;
  border: 1px solid #fecaca;
}

[hidden] { display: none !important; }

@media (max-width: 780px) {
  .cabinet-hero,
  .section-head,
  .build-card-head,
  .build-card-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .build-frame-preview img {
    height: 150px;
  }

  .file-row {
    align-items: stretch;
    flex-direction: column;
  }
}
