:root {
  --bg: #f3f6f4;
  --bg-soft: #edf4f1;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-muted: #f7fbf9;
  --sidebar: linear-gradient(180deg, #165b56 0%, #1d6e69 100%);
  --sidebar-strong: #0f4b47;
  --sidebar-text: rgba(244, 253, 250, 0.94);
  --ink: #17332f;
  --ink-soft: #5f7e78;
  --line: rgba(23, 51, 47, 0.08);
  --line-strong: rgba(23, 51, 47, 0.14);
  --accent: #22b8b2;
  --accent-strong: #17968f;
  --accent-soft: rgba(34, 184, 178, 0.12);
  --accent-warm: #f3c85b;
  --special: linear-gradient(135deg, #22b8b2 0%, #198f89 100%);
  --audience: linear-gradient(135deg, #4bd6b8 0%, #22b8b2 100%);
  --success: #0f8a63;
  --danger: #b42318;
  --shadow-xl: 0 28px 90px rgba(19, 48, 44, 0.12);
  --shadow-lg: 0 18px 42px rgba(19, 48, 44, 0.08);
  --shadow-sm: 0 8px 20px rgba(19, 48, 44, 0.06);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --sidebar-width: 278px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(34, 184, 178, 0.18), transparent 26%),
    radial-gradient(circle at right top, rgba(243, 200, 91, 0.2), transparent 24%),
    linear-gradient(180deg, #f5f8f5 0%, #edf3ef 100%);
  min-height: 100vh;
}

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

button,
input,
select {
  font: inherit;
}

.app-layout {
  min-height: 100vh;
  overflow-x: hidden;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  padding: 24px 16px 20px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  box-shadow: 16px 0 50px rgba(12, 49, 46, 0.12);
  display: flex;
  flex-direction: column;
  gap: 22px;
  z-index: 20;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f8fffd;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-title {
  display: block;
  font-size: 1.25rem;
  line-height: 1.1;
}

.brand-subtitle {
  display: block;
  margin-top: 6px;
  color: rgba(244, 253, 250, 0.72);
  font-size: 0.82rem;
}

.side-nav {
  display: grid;
  gap: 10px;
}

.side-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 0 18px;
  border-radius: 18px;
  color: rgba(244, 253, 250, 0.88);
  font-size: 1.05rem;
  font-weight: 700;
  background: transparent;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.side-link:hover {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.08);
}

.side-link.active {
  background: linear-gradient(135deg, #2cbab4 0%, #2ca6a0 100%);
  color: #ffffff;
  box-shadow: 0 18px 30px rgba(9, 61, 57, 0.18);
}

.side-link.active::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 10px;
  bottom: 10px;
  width: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
}

.sidebar-note {
  margin-top: auto;
  padding: 18px 18px 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 800;
}

.sidebar-note span {
  display: block;
  margin-top: 8px;
  color: rgba(244, 253, 250, 0.78);
  font-size: 0.9rem;
  line-height: 1.7;
  font-weight: 500;
}

.app-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 82px;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(23, 51, 47, 0.06);
  box-shadow: 0 10px 30px rgba(28, 55, 51, 0.05);
}

.topbar-path {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--accent-strong);
  font-weight: 700;
  flex-wrap: wrap;
}

.topbar-path span + span::before {
  content: "·";
  margin-right: 14px;
  color: rgba(23, 51, 47, 0.26);
}

.topbar-badge {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(34, 184, 178, 0.1);
  color: var(--accent-strong);
  border: 1px solid rgba(34, 184, 178, 0.18);
  font-weight: 700;
  white-space: nowrap;
}

.topbar-link:hover {
  background: rgba(34, 184, 178, 0.16);
}

.mobile-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-strong);
  font-weight: 700;
}

.mobile-back-link::before {
  content: "\2190";
}

.landing-shell,
.admin-shell,
.judge-shell {
  padding: 28px 32px 40px;
}

.landing-shell,
.admin-shell {
  max-width: 1280px;
}

.judge-shell {
  max-width: 1560px;
}

.hero-card,
.form-card,
.history-card,
.summary-card,
.project-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 42px;
  border-radius: 34px;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: auto -120px -120px auto;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(34, 184, 178, 0.16), transparent 66%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 800;
}

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

.hero-card h1,
.judge-header h1,
.admin-topbar h1 {
  font-size: clamp(2.4rem, 4vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.hero-copy,
.header-copy {
  max-width: 860px;
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 1.04rem;
  line-height: 1.9;
}

.hero-highlight-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  margin: 26px 0 0;
  max-width: 820px;
}

.hero-highlight {
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(247, 251, 249, 0.9);
  border: 1px solid rgba(23, 51, 47, 0.06);
}

.hero-highlight span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
}

.hero-highlight strong {
  display: block;
  margin-top: 8px;
  font-size: 1.02rem;
  line-height: 1.6;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.entry-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 10px;
  min-height: 210px;
  padding: 28px;
  border-radius: 28px;
  color: #ffffff;
  box-shadow: 0 18px 40px rgba(16, 55, 52, 0.16);
}

.entry-card::before {
  content: "";
  position: absolute;
  inset: auto -40px -50px auto;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.special-entry {
  background: var(--special);
}

.audience-entry {
  background: var(--audience);
}

.ranking-entry {
  background: linear-gradient(135deg, #3b82a6 0%, #2563a0 100%);
}

.entry-grid--three {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.entry-tag {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.entry-card strong {
  position: relative;
  z-index: 1;
  font-size: 1.9rem;
  line-height: 1.15;
}

.entry-card span:last-child {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.8;
}

.landing-actions {
  margin-top: 22px;
}

.ghost-link,
.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-weight: 700;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.ghost-link:hover,
.back-link:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 184, 178, 0.26);
  box-shadow: var(--shadow-sm);
}

.judge-header,
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.judge-header {
  padding: 4px 4px 0;
}

.admin-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.admin-name-field {
  display: grid;
  gap: 8px;
  width: min(240px, 100%);
}

.admin-name-field span {
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 800;
}

.admin-name-field input {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(23, 51, 47, 0.12);
  padding: 0 14px;
  background: var(--surface-strong);
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.admin-name-field input:focus {
  border-color: rgba(34, 184, 178, 0.44);
  box-shadow: 0 0 0 4px rgba(34, 184, 178, 0.12);
}

.form-card,
.history-card {
  padding: 28px;
  border-radius: 28px;
}

.history-card {
  margin-top: 20px;
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.history-head h2 {
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.history-meta {
  color: var(--ink-soft);
  font-size: 1.5rem;
  font-weight: 800;
}

.status-banner {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 700;
}

.status-banner.info {
  background: rgba(34, 184, 178, 0.12);
  color: var(--accent-strong);
}

.status-banner.success {
  background: rgba(15, 138, 99, 0.12);
  color: var(--success);
}

.hidden {
  display: none;
}

.identity-grid,
.score-grid,
.summary-grid {
  display: grid;
  gap: 18px;
}

.identity-grid {
  grid-template-columns: minmax(280px, 420px);
}

.score-grid {
  grid-template-columns: repeat(3, minmax(250px, 1fr));
  margin-top: 24px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span,
.score-label {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
}

.field input,
.field select,
.secondary-button,
#submitButton {
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(23, 51, 47, 0.12);
  padding: 0 16px;
  background: var(--surface-strong);
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.field input:focus,
.field select:focus {
  border-color: rgba(34, 184, 178, 0.44);
  box-shadow: 0 0 0 4px rgba(34, 184, 178, 0.12);
}

.score-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 22px;
  border-radius: 20px;
  background: var(--surface-muted);
  border: 1px solid rgba(23, 51, 47, 0.06);
}

.score-field input,
.score-field select {
  min-height: 48px;
  margin-top: auto;
}

.score-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235f7e78' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
}

.score-hint {
  color: var(--ink-soft);
  font-size: 0.96rem;
  line-height: 1.7;
}

.score-hint-max {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 2px;
}

.score-hint-lines {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.score-hint-line {
  display: block;
}

.form-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

#submitButton {
  min-width: 168px;
  border: none;
  background: linear-gradient(135deg, #1f918b 0%, #14716c 100%);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 16px 26px rgba(20, 113, 108, 0.2);
  cursor: pointer;
}

#submitButton:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

#submitButton.is-loading {
  opacity: 0.75;
  cursor: wait;
  animation: submitPulse 1.2s ease-in-out infinite;
}

@keyframes submitPulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 0.55; }
}

.secondary-button {
  min-width: 140px;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-weight: 700;
}

.danger-button {
  min-height: 52px;
  min-width: 168px;
  padding: 0 18px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #cf4d3f 0%, #a83226 100%);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 16px 26px rgba(168, 50, 38, 0.22);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

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

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.admin-status {
  margin: 0;
  max-width: 320px;
  text-align: right;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.6;
  font-weight: 700;
}

.admin-status.success {
  color: var(--success);
}

.admin-status.error {
  color: var(--danger);
}

.history-table-wrap {
  overflow: hidden;
  border: 1px solid rgba(34, 184, 178, 0.16);
  border-radius: 22px;
  background: #ffffff;
}

.history-table-scroll {
  overflow-x: visible;
}

.history-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  font-size: 0.84rem;
}

.history-col-project {
  width: 280px;
}

.history-col-department {
  width: 78px;
}

.history-col-score {
  width: 72px;
}

.history-col-total {
  width: 72px;
}

.history-col-updated {
  width: 92px;
}

.history-col-action {
  width: 104px;
}

.history-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px 10px;
  text-align: left;
  background: #f7fbf9;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  white-space: normal;
  line-height: 1.25;
}

.history-table tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(23, 51, 47, 0.06);
  background: #ffffff;
  vertical-align: middle;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-table tbody tr:last-child td {
  border-bottom: none;
}

.active-history-row td {
  background: rgba(34, 184, 178, 0.06);
}

.history-project-cell strong {
  display: block;
  font-size: 1rem;
  line-height: 1.35;
}

.history-project-title {
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
  word-break: break-all;
}

.history-department-cell {
  font-weight: 700;
}

.history-th-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink);
}

.history-th-meta {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 0.66rem;
}

.history-score-cell,
.history-total-cell {
  text-align: center;
  font-weight: 800;
}

.history-total-cell {
  font-size: 1.05rem;
  color: var(--accent-strong);
}

.editing-history-row td {
  background: rgba(34, 184, 178, 0.08);
}

.history-action-cell {
  white-space: normal !important;
}

.history-action-stack {
  display: grid;
  gap: 6px;
}

.history-edit-button,
.history-confirm-button {
  width: 100%;
  min-height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(23, 51, 47, 0.12);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.history-confirm-button {
  background: linear-gradient(135deg, #1f918b 0%, #14716c 100%);
  color: #ffffff;
  border: none;
}

.history-edit-button:disabled,
.history-confirm-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.history-inline-input {
  width: 56px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 12px;
  border: 1px solid rgba(34, 184, 178, 0.24);
  text-align: center;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.98);
}

.history-inline-input:focus {
  outline: none;
  border-color: rgba(34, 184, 178, 0.52);
  box-shadow: 0 0 0 4px rgba(34, 184, 178, 0.12);
}

.compact-empty {
  padding: 28px 22px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  margin-bottom: 20px;
}

.summary-card {
  padding: 22px;
  border-radius: 24px;
}

.summary-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
}

.summary-card--time strong {
  font-size: clamp(0.82rem, 2vw, 1.1rem);
  white-space: nowrap;
}

/* ── Podium Section ── */
.podium-section {
  margin-bottom: 28px;
  overflow: hidden;
}

.podium-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(6px, 2vw, 12px);
  padding: 20px clamp(2px, 1vw, 8px) 0;
}

.podium-slot {
  flex: 1;
  min-width: 0;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(10px, 3vw, 20px) clamp(6px, 2vw, 14px) 0;
  border-radius: clamp(14px, 3vw, 24px) clamp(14px, 3vw, 24px) 0 0;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-bottom: none;
  box-shadow: var(--shadow-lg);
  position: relative;
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.podium-slot--gold {
  background: linear-gradient(180deg, rgba(255, 243, 200, 0.97) 0%, rgba(255, 252, 240, 0.97) 100%);
  border-color: rgba(216, 166, 49, 0.25);
  padding-top: clamp(14px, 3.5vw, 24px);
}

.podium-slot--silver {
  background: linear-gradient(180deg, rgba(235, 240, 248, 0.97) 0%, rgba(248, 250, 253, 0.97) 100%);
  border-color: rgba(140, 155, 171, 0.2);
}

.podium-slot--bronze {
  background: linear-gradient(180deg, rgba(250, 237, 226, 0.97) 0%, rgba(253, 248, 244, 0.97) 100%);
  border-color: rgba(180, 122, 82, 0.2);
}

.podium-crown {
  font-size: clamp(1.3rem, 4vw, 2rem);
  line-height: 1;
  margin-bottom: clamp(2px, 1vw, 6px);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12));
}

.podium-slot--gold .podium-crown {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
}

.podium-rank-badge {
  width: clamp(28px, 7vw, 44px);
  height: clamp(28px, 7vw, 44px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: clamp(0.85rem, 2.5vw, 1.3rem);
  font-weight: 900;
  color: #fff;
  margin-bottom: clamp(4px, 1.5vw, 10px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.podium-slot--gold .podium-rank-badge {
  width: clamp(34px, 8vw, 52px);
  height: clamp(34px, 8vw, 52px);
  font-size: clamp(1rem, 3vw, 1.5rem);
}

.podium-rank-badge--gold {
  background: linear-gradient(135deg, #d8a631, #f3c85b);
}

.podium-rank-badge--silver {
  background: linear-gradient(135deg, #8c9bab, #bcc8d4);
}

.podium-rank-badge--bronze {
  background: linear-gradient(135deg, #b47a52, #d79b72);
}

.podium-name {
  margin: 0;
  font-size: clamp(0.72rem, 2.2vw, 0.95rem);
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.podium-slot--gold .podium-name {
  font-size: clamp(0.82rem, 2.6vw, 1.1rem);
}

.podium-score {
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-weight: 900;
  line-height: 1;
  margin-top: clamp(4px, 1vw, 8px);
  color: var(--accent-strong);
}

.podium-slot--gold .podium-score {
  font-size: clamp(1.6rem, 5.5vw, 2.6rem);
  background: linear-gradient(135deg, #d8a631, #c4922a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.podium-score-label {
  display: block;
  font-size: clamp(0.58rem, 1.5vw, 0.72rem);
  font-weight: 700;
  color: var(--ink-soft);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.podium-details {
  display: flex;
  gap: clamp(3px, 1vw, 8px);
  margin-top: clamp(6px, 2vw, 12px);
  width: 100%;
}

.podium-detail-item {
  flex: 1;
  padding: clamp(4px, 1vw, 8px) clamp(3px, 0.8vw, 6px);
  border-radius: clamp(6px, 1.5vw, 12px);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(23, 51, 47, 0.05);
  text-align: center;
  min-width: 0;
}

.podium-detail-item small {
  display: block;
  font-size: clamp(0.52rem, 1.5vw, 0.68rem);
  color: var(--ink-soft);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-detail-item strong {
  display: block;
  font-size: clamp(0.75rem, 2.2vw, 1.05rem);
  margin-top: 2px;
  color: var(--ink);
}

.podium-bar {
  width: 100%;
  margin-top: clamp(8px, 2vw, 14px);
  align-self: stretch;
  margin-left: 0;
  margin-right: 0;
}

.podium-bar--gold {
  height: clamp(44px, 12vw, 80px);
  background: linear-gradient(180deg, #f3c85b 0%, #d8a631 100%);
}

.podium-bar--silver {
  height: clamp(30px, 8.5vw, 56px);
  background: linear-gradient(180deg, #bcc8d4 0%, #8c9bab 100%);
}

.podium-bar--bronze {
  height: clamp(22px, 6vw, 40px);
  background: linear-gradient(180deg, #d79b72 0%, #b47a52 100%);
}

/* ── Rank List (4th place and beyond) ── */
.ranking-board {
  display: grid;
  gap: 10px;
}

.rank-list-header {
  padding: 10px 4px 4px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.rank-list-item {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 14px);
  padding: clamp(10px, 2vw, 14px) clamp(10px, 2.5vw, 16px);
  border-radius: clamp(14px, 3vw, 18px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.rank-list-pos {
  width: clamp(32px, 7vw, 40px);
  height: clamp(32px, 7vw, 40px);
  border-radius: clamp(8px, 2vw, 12px);
  display: grid;
  place-items: center;
  font-size: clamp(0.85rem, 2.2vw, 1.1rem);
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  background: linear-gradient(135deg, #15534f, #20968f);
  box-shadow: 0 4px 12px rgba(22, 83, 79, 0.16);
}

.rank-list-pos--gold {
  background: linear-gradient(135deg, #d8a631, #f3c85b);
}

.rank-list-pos--silver {
  background: linear-gradient(135deg, #8c9bab, #bcc8d4);
}

.rank-list-pos--bronze {
  background: linear-gradient(135deg, #b47a52, #d79b72);
}

.rank-list-info {
  flex: 1;
  min-width: 0;
}

.rank-list-name {
  margin: 0;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 4px;
  font-size: clamp(0.66rem, 1.8vw, 0.76rem);
  color: var(--ink-soft);
  font-weight: 600;
}

.rank-list-meta strong {
  color: var(--ink);
  font-weight: 800;
}

.rank-list-score {
  text-align: center;
  flex-shrink: 0;
  min-width: clamp(48px, 10vw, 60px);
}

.rank-list-score strong {
  display: block;
  font-size: clamp(1.1rem, 3.5vw, 1.5rem);
  line-height: 1;
  color: var(--accent-strong);
}

.rank-list-score small {
  display: block;
  font-size: clamp(0.58rem, 1.5vw, 0.68rem);
  color: var(--ink-soft);
  font-weight: 700;
  margin-top: 2px;
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 42px 26px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(23, 51, 47, 0.12);
}

@media (max-width: 1260px) {
  .score-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .entry-grid,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 960px) {
  .app-sidebar {
    display: none;
  }

  .app-content {
    margin-left: 0;
  }

  .app-topbar {
    position: sticky;
    top: 0;
    height: auto;
    padding: 12px 16px;
    flex-direction: row;
    align-items: center;
  }

  .topbar-path {
    font-size: 0.85rem;
  }

  .topbar-badge {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.78rem;
  }

  .landing-shell,
  .admin-shell,
  .judge-shell {
    padding: 16px 14px 30px;
  }

  .hero-card {
    padding: 28px 20px;
    border-radius: 22px;
  }

  .hero-card h1 {
    font-size: 1.6rem !important;
    letter-spacing: -0.02em;
  }

  .hero-copy {
    font-size: 0.9rem;
    margin-top: 10px;
  }

  .hero-highlight-row {
    display: none;
  }

  .entry-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 20px;
  }

  .entry-card {
    min-height: 130px;
    padding: 22px;
    border-radius: 22px;
  }

  .entry-card strong {
    font-size: 1.5rem;
  }

  .landing-actions {
    margin-top: 16px;
    text-align: center;
  }

  .landing-actions .ghost-link {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 1rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(34,184,178,0.1), rgba(34,184,178,0.05));
    border-color: rgba(34,184,178,0.3);
    color: var(--accent-strong);
  }

  .form-card,
  .history-card {
    padding: 18px 14px;
    border-radius: 20px;
  }

  .judge-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0;
  }

  .judge-header h1 {
    font-size: 1.5rem !important;
  }

  .admin-topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-topbar h1 {
    font-size: 1.5rem !important;
  }

  .admin-actions {
    display: none;
  }

  .history-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .score-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .score-field {
    padding: 14px;
    border-radius: 16px;
  }

  .score-hint {
    font-size: 0.88rem;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

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

  .podium-details {
    flex-direction: column;
    gap: 3px;
  }

  .eyebrow {
    font-size: 0.7rem;
    margin-bottom: 8px;
  }

  .header-copy {
    font-size: 0.85rem;
  }
}

@media (max-width: 900px) {
  .history-table-wrap {
    border: none;
    background: transparent;
    overflow: visible;
  }

  .history-table-scroll {
    overflow: visible;
  }

  .history-table {
    min-width: 0;
    table-layout: auto;
  }

  .history-table colgroup,
  .history-table thead {
    display: none;
  }

  .history-table,
  .history-table tbody,
  .history-table tr,
  .history-table td {
    display: block;
    width: 100%;
  }

  .history-table tbody {
    display: grid;
    gap: 12px;
  }

  .history-table tbody tr {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(34, 184, 178, 0.14);
    box-shadow: var(--shadow-sm);
  }

  .history-table tbody td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 12px 14px;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
  }

  .history-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 98px;
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 700;
  }

  .history-project-cell,
  .history-department-cell,
  .history-total-cell {
    text-align: right;
  }

  .history-project-title {
    white-space: normal;
    text-align: right;
  }

  .history-load-button {
    width: 100%;
  }

  .history-action-stack {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .hero-card h1 {
    font-size: 1.4rem !important;
  }

  .history-meta {
    font-size: 1rem;
  }

  .history-head h2 {
    font-size: 1.4rem;
  }

  .field input,
  .field select,
  .secondary-button,
  .danger-button,
  #submitButton {
    width: 100%;
  }

  .form-actions {
    flex-direction: column;
  }

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

  .summary-card {
    padding: 14px;
    border-radius: 18px;
  }

  .summary-card strong {
    font-size: 1.3rem;
  }

  .podium-detail-item small {
    white-space: normal;
  }
}

/* Gear Button */
.gear-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.18);
  font-size: 16px;
  cursor: pointer;
  z-index: 50;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.gear-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.3);
}

/* Success Modal */
.success-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.success-modal-overlay.visible {
  opacity: 1;
}
.success-modal {
  background: #fff;
  border-radius: 18px;
  padding: 48px 40px 36px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  max-width: 380px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.25s ease;
}
.success-modal-overlay.visible .success-modal {
  transform: scale(1);
}
.success-modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-size: 32px;
  line-height: 64px;
}
.success-modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 8px;
}
.success-modal-subtitle {
  font-size: 0.95rem;
  color: #64748b;
  margin: 0 0 28px;
}
.success-modal-button {
  display: inline-block;
  padding: 14px 40px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #1f918b 0%, #14716c 100%);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(20, 113, 108, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
}
.success-modal-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(20, 113, 108, 0.3);
}
