/* Shared responsive layer. Size by the CSS viewport, including browser zoom. */
:root { --site-max: 1600px; --page-gutter: clamp(16px, 2.2vw, 36px); }
body { min-width: 0; }
body .site-header.site-header {
  grid-template-columns: minmax(160px, 1fr) auto minmax(240px, 1fr);
  padding-inline: max(var(--page-gutter), calc((100% - var(--site-max)) / 2 + var(--page-gutter)));
}
body .site-header .main-nav.main-nav { gap: clamp(24px, 3.5vw, 56px); font-size: clamp(16px, 1.3vw, 19px); }
body .site-header .header-actions.header-actions { gap: 10px; }
body .site-header .brand.brand { font-size: clamp(27px, 2.2vw, 32px); }

/* Stack slides in the same grid cell: the tallest visible-content slide sets
   the height, so wrapping text cannot be clipped and autoplay does not jump. */
.hero-carousel { width: 100%; max-width: var(--site-max); height: auto; margin-inline: auto; }
.hero-track { position: relative; display: grid; }
.hero-slide { position: relative; inset: auto; grid-area: 1 / 1; min-width: 0; }
.hero {
  height: auto; min-height: 420px; grid-template-columns: minmax(0, 52fr) minmax(0, 48fr);
  grid-template-rows: auto;
}
.hero-copy { min-width: 0; padding: 38px 24px 42px clamp(28px, 4vw, 64px); align-self: center; }
.hero-slide:first-child .contest-badge { min-width: 0; margin-left: 0; }
.contest-badge { max-width: 100%; font-size: clamp(14px, 1.35vw, 20px); line-height: 1.4; }
.contest-badge b { min-width: 0; overflow-wrap: anywhere; }
.hero h1 { width: auto; max-width: 100%; font-size: clamp(32px, 3.35vw, 52px); letter-spacing: -.055em; white-space: normal; transform: none; margin-top: 24px; overflow-wrap: anywhere; }
.hero-copy > p { line-height: 1.6; font-size: clamp(14px, 1.15vw, 18px); }
.hero-buttons { flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero-buttons .button { min-width: 0; max-width: 100%; min-height: 48px; height: auto; padding: 13px 24px; font-size: clamp(14px, 1.25vw, 18px); }
.hero-art { width: calc(100% + 60px); margin-left: -60px; min-height: 0; }
.hero-baishou .hero-copy { padding: 30px 24px 36px clamp(28px, 4vw, 64px); }
.hero-baishou h2 { font-size: clamp(40px, 4vw, 64px); }
.hero-baishou .baishou-slogan { font-size: clamp(23px, 2.4vw, 36px); }
.hero-baishou .baishou-art img { height: 125%; top: -6%; }

.home-modules { max-width: var(--site-max); margin-inline: auto; padding-inline: var(--page-gutter); }
.home-modules > .module { min-width: 0; height: auto; overflow: visible; }
.home-modules .module-heading { flex-wrap: wrap; gap: 10px; }
.home-modules .module-heading h2 { min-width: 0; overflow-wrap: anywhere; }
.home-entry-feature > div { min-width: 0; }
.home-entry-features { flex: 1; }
.home-entry-button { margin-top: auto; }
.module-works .work-grid { align-items: stretch; }
.module-works .work-card { display: flex; flex-direction: column; }
.featured-work-copy { flex: 1; }

/* Keep large monitors readable without stretching illustrations indefinitely. */
.contest-hero, .opc-hero { max-width: var(--site-max); margin-inline: auto; height: auto; min-height: 320px; }
.contest-hero-copy, .opc-hero-copy { width: 53%; min-width: 0; padding: 40px 24px 36px clamp(28px, 4vw, 64px); }
.contest-hero h1, .opc-hero h1 { font-size: clamp(34px, 3.7vw, 58px); letter-spacing: -.055em; overflow-wrap: anywhere; }
.opc-hero-copy p { line-height: 1.7; }
.contest-hero-art, .opc-hero-art { left: 46%; }
.contest-paths, .opc-entry-grid, .opc-community-row, .connect-shell { width: 100%; max-width: var(--site-max); padding-inline: var(--page-gutter); }
.path-card { height: auto; min-height: 290px; padding: 28px clamp(24px, 2.4vw, 38px); }
.path-card h2 { max-width: calc(100% - 30px); white-space: normal; line-height: 1.25; font-size: clamp(26px, 2.2vw, 34px); overflow-wrap: anywhere; }
.path-card > p { max-width: 95%; }
.path-card ul { flex-wrap: wrap; }
.path-card .reviewer-state { position: static; max-width: 100%; margin-top: 8px !important; }
.opc-entry-card { height: auto; min-height: 280px; }
.opc-entry-card .entry-copy { padding-bottom: 28px; }
.entry-stats { overflow-wrap: anywhere; line-height: 1.6; }
.compact-heading, .compact-heading > div { flex-wrap: wrap; }
.compact-heading > div { min-width: 0; gap: 14px; }
.compact-heading > a { flex-shrink: 0; }
.recommended-panel, .connection-aside, .request-column, .connect-tip { min-width: 0; }
.people-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.connect-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.connect-cover { width: calc(100% - 2 * var(--page-gutter)); max-width: calc(var(--site-max) - 2 * var(--page-gutter)); margin: 20px auto 0; }
.connect-search input { min-width: 0; }
.connect-filters { height: auto; min-height: 47px; flex-wrap: wrap; padding-block: 10px; padding-right: 65px; }
.connect-empty, .connect-loading, .opc-empty, .opc-loading { padding: clamp(24px, 4vw, 65px); }
.gallery-navigation, .gallery-section, .work-page { width: min(1320px, calc(100% - 2 * var(--page-gutter))); }
.rules-page { width: min(850px, calc(100% - 2 * var(--page-gutter))); }
.work-content, .work-side, .profile-workspace, .task-sidebar, .work-detail, .score-panel { min-width: 0; }
.gallery-heading { flex-wrap: wrap; }
.gallery-edition-select { flex-wrap: wrap; }
.gallery-card-author { flex-wrap: wrap; }
.gallery-card-author > span { flex-shrink: 1; min-width: 0; }
.reviewer-main { max-width: var(--site-max); margin-inline: auto; }
.reviewer-workspace { grid-template-columns: 230px minmax(0, 1.1fr) minmax(360px, 1fr); }
.work-head { grid-template-columns: 68px minmax(0, 1fr) auto; }
.work-head h1 { overflow-wrap: anywhere; }
.work-tags { flex-wrap: wrap; }
.profile-editor-dialog, .connect-dialog, .contest-dialog { max-width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto; }
.entry-form label, .reviewer-dialog label, .profile-form-grid > *, .editor-form-grid > * { min-width: 0; }
.entry-form input, .entry-form select, .entry-form textarea, .profile-dialog input, .profile-dialog textarea { min-width: 0; max-width: 100%; }

@media (min-width: 901px) and (max-width: 1279px) {
  .home-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-modules .module-works { grid-column: 1 / -1; }
  .home-modules .home-entry { min-height: 350px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .hero { grid-template-columns: minmax(0, 58fr) minmax(0, 42fr); }
  .hero h1 { font-size: clamp(30px, 3.5vw, 38px); }
  .hero-copy { padding-left: 28px; padding-right: 20px; }
  .hero-buttons .button { padding-inline: 18px; }
  .opc-entry-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .reviewer-workspace { grid-template-columns: 220px minmax(0, 1fr); }
  .connect-shell { grid-template-columns: minmax(0, 1fr); }
  .connection-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shared-profile-body { grid-template-columns: minmax(0, 1fr); }
  .shared-tags { grid-column: auto; }
  .welcome-panel { padding-right: 30px; }
  .welcome-art { display: none; }
  .profile-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  body .site-header.site-header { height: auto; min-height: 96px; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 48px 48px; padding-inline: var(--page-gutter); }
  body .site-header .brand.brand { grid-column: 1; grid-row: 1; }
  body .site-header .header-actions.header-actions { grid-column: 2; grid-row: 1; }
  body .site-header .main-nav.main-nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; gap: clamp(20px, 4vw, 36px); font-size: 15px; overflow-x: auto; }
  body .site-header .main-nav.main-nav a { padding-block: 13px; }
  body .site-header .main-nav.main-nav a::after { bottom: 6px; }
  body .site-header .login-button.login-button, body .site-header .register-button.register-button { height: 36px; padding-inline: 16px; }
  .home-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-modules .module-works { grid-column: 1 / -1; }
  .contest-hero, .opc-hero { display: grid; grid-template-columns: minmax(0, 1fr); }
  .contest-hero-copy, .opc-hero-copy { width: 100%; padding: 30px var(--page-gutter) 22px; }
  .contest-hero-art, .opc-hero-art { position: relative; inset: auto; height: clamp(210px, 38vw, 340px); width: 100%; mask-image: none; -webkit-mask-image: none; }
  .contest-hero-art img { left: 0; width: 100%; object-position: center; }
  .opc-hero-art > img { width: 100%; height: 100%; object-fit: cover; object-position: right center; }
  .work-layout { grid-template-columns: minmax(0, 1fr); }
  .work-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .shared-profile-card > header, .shared-profile-actions { flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: minmax(0, 1fr); min-height: 0; grid-template-rows: auto auto; }
  .hero-copy, .hero-baishou .hero-copy { padding: 28px var(--page-gutter) 30px; align-self: stretch; }
  .hero h1 { font-size: clamp(29px, 7.8vw, 42px); margin-top: 20px; line-height: 1.25; }
  .hero-copy > p { font-size: 15px; }
  .hero-buttons { flex-direction: row; }
  .hero-buttons .button { flex: 1 1 180px; }
  .hero-art, .hero-baishou .baishou-art { width: 100%; margin-left: 0; min-height: 0; height: clamp(190px, 52vw, 320px); mask-image: none; -webkit-mask-image: none; }
  .hero-baishou .baishou-art img { top: 0; height: 100%; width: 100%; }
  .hero-baishou .baishou-badge { font-size: 14px; }
  .hero-baishou .baishou-slogan { font-size: clamp(22px, 5.8vw, 29px); }
  .home-modules .module-works { padding: 22px 16px; }
  .module-works .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-modules .home-entry { min-height: 350px; padding: 22px 16px; }
  .home-entry .module-heading h2 { font-size: 19px; }
  .module-works .module-heading h2 { font-size: 19px; letter-spacing: -.6px; }
  .module-works .module-heading a { font-size: 12px; }
  .contest-hero h1, .opc-hero h1 { font-size: clamp(29px, 7.8vw, 42px); }
  .opc-entry-card .entry-copy { padding: 26px 24px 30px; }
  .opc-entry-card { min-height: 310px; }
  .opc-entry-card .entry-copy > p, .opc-entry-card .entry-stats { max-width: 100%; }
  .connect-filters { padding-right: 0; }
  .result-count { position: static; display: block; margin-bottom: 10px; }
  .profile-main { padding-inline: var(--page-gutter); }
  .score-panel footer { flex-wrap: wrap; gap: 12px; }
  .score-options { flex-wrap: wrap; }
  .contest-dialog { max-height: 100dvh; }
}
@media (max-width: 600px) {
  .home-modules, .connection-aside, .work-side { grid-template-columns: minmax(0, 1fr); }
  .home-modules .home-entry { min-height: 350px; }
  .people-grid { grid-template-columns: minmax(0, 1fr); }
  .gallery-navigation { align-items: flex-start; flex-wrap: wrap; }
  .path-card { padding: 25px 22px; }
  .path-card h2 { max-width: 90%; font-size: 27px; }
  .path-icon { right: 18px; top: 22px; font-size: 32px; }
  .entry-button { max-width: 100%; min-width: 0; height: auto; min-height: 44px; padding-block: 10px; }
  .profile-form-grid, .editor-form-grid { grid-template-columns: minmax(0, 1fr); }
  .person-detail { padding: 28px 20px; }
  .detail-top > div, .detail-body { min-width: 0; overflow-wrap: anywhere; }
  .detail-avatar { flex: 0 0 60px; }
  .profile-editor-dialog, .connect-dialog { max-height: calc(100dvh - 24px); }
}
@media (max-width: 720px) {
  .reviewer-workspace { grid-template-columns: minmax(0, 1fr); }
  .work-head { grid-template-columns: 54px minmax(0, 1fr); }
  .work-logo { width: 54px; height: 54px; }
  .work-number { grid-column: 2; justify-self: start; }
}
@media (max-width: 480px) {
  .score-row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-block: 12px; }
  .score-options { justify-content: space-between; }
  .score-panel textarea { min-width: 0; width: 100%; }
}
@media (max-width: 380px) {
  body .site-header .main-nav.main-nav { gap: 18px; font-size: 13px; }
  body .site-header .brand.brand { font-size: 25px; }
  body .site-header .login-button.login-button { min-width: 0; padding-inline: 10px; }
  .module-works .module-heading { align-items: flex-start; }
  .module-works .featured-work-copy { padding: 10px 8px; }
  .entry-actions > div:last-child { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
}
/* Tables scroll inside their panel instead of widening the entire admin page. */
.admin-main { min-width: 0; }
.admin-content { width: 100%; }
.table-scroll, #contest-management .table-scroll { max-width: 100%; overflow-x: auto; }
@media (max-width: 1180px) {
  .contest-admin-grid, .insight-grid { grid-template-columns: minmax(0, 1fr); }
  .section-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .section-heading, .page-heading, .review-command, .contest-admin-actions { flex-wrap: wrap; }
  .section-editor, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters > *, .search-field { min-width: 0; max-width: 100%; }
  .review-command > div { flex-wrap: wrap; }
}
@media (max-width: 480px) { .section-editor { grid-template-columns: minmax(0, 1fr); } }
