:root {
  --canvas: #f3f6f2;
  --surface: #ffffff;
  --surface-soft: #eef4ef;
  --ink: #17231a;
  --muted: #637068;
  --line: #dce5de;
  --green: #187346;
  --green-dark: #105b36;
  --green-soft: #dff1e6;
  --amber: #9a6615;
  --amber-soft: #fff0cf;
  --red: #b83f43;
  --red-soft: #fde8e8;
  --shadow: 0 1px 2px rgba(20, 38, 26, .05), 0 8px 24px rgba(20, 38, 26, .05);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  display: block;
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--green) 0 68%, #df9c2f 68% 82%, #d36a5d 82%);
  z-index: 100;
}
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; letter-spacing: 0; line-height: 1.16; }
h1 { font-size: clamp(2rem, 7vw, 3.35rem); margin-bottom: .65rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
img { display: block; max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid rgba(24, 115, 70, .28); outline-offset: 2px; }

.shell { width: min(100% - 32px, 960px); margin-inline: auto; }
.page { padding-block: 36px 64px; }
.narrow-page { max-width: 760px; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(220, 229, 222, .9);
  background: rgba(243, 246, 242, .94);
  backdrop-filter: blur(14px);
}
.header-inner { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; font-family: Georgia, serif; font-size: 1.05rem; white-space: nowrap; }
.brand img { width: 36px; height: 36px; object-fit: contain; }
.brand strong { color: var(--green); font-weight: 700; }
.nav { display: flex; align-items: center; gap: 3px; }
.nav > a { padding: 8px 9px; border-radius: 6px; color: var(--muted); font-size: .86rem; font-weight: 650; }
.nav > a:hover { background: var(--surface-soft); color: var(--green-dark); }
.icon-button, .logout-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.icon-button:hover, .logout-button:hover { background: var(--surface-soft); color: var(--green-dark); }
.icon-button svg, .logout-button svg { width: 20px; height: 20px; }
.notification { position: relative; }
.notification-count {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 17px;
  height: 17px;
  padding-inline: 4px;
  border: 2px solid var(--canvas);
  border-radius: 9px;
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 800;
  line-height: 13px;
}
.dropdown-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: min(340px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 55px rgba(20, 38, 26, .16);
}
.dropdown-heading, .dropdown-footer { padding: 12px 14px; }
.dropdown-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
.dropdown-footer { display: block; border-top: 1px solid var(--line); color: var(--green-dark); text-align: center; font-size: .86rem; font-weight: 700; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--green-dark); font-size: .75rem; font-weight: 700; }
.empty-small { margin: 0; padding: 28px 16px; color: var(--muted); text-align: center; font-size: .86rem; }
.notification-entry-form { border-bottom: 1px solid var(--line); }
.notification-entry-form:last-child { border-bottom: 0; }
.notification-entry {
  display: grid;
  width: 100%;
  grid-template-columns: 10px minmax(0, 1fr) 7px;
  align-items: start;
  gap: 10px;
  padding: 11px 14px;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}
.notification-entry:hover, .notification-entry.unread { background: #f1f8f3; }
.notification-entry strong, .notification-page-item strong { display: block; font-size: .8rem; font-weight: 650; line-height: 1.4; }
.notification-entry small, .notification-page-item small { display: block; margin-top: 3px; color: var(--muted); font-size: .68rem; }
.notification-entry i, .notification-page-item i { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--green); }
.notification-mark { width: 9px; height: 9px; margin-top: 4px; border: 2px solid var(--green); border-radius: 50%; }
.notification-mark.winner { border-radius: 2px; border-color: #c48722; transform: rotate(45deg); }
.profile-chip { display: flex; align-items: center; gap: 7px; margin-left: 4px; padding-left: 8px; border-left: 1px solid var(--line); }
.profile-chip form { display: flex; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); font-size: .76rem; font-weight: 800; }
.profile-name { max-width: 105px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 700; }

.home-intro { padding: 26px 0 34px; }
.home-intro h1 { max-width: 660px; }
.home-intro > p:last-child, .page-heading p, .submission-heading p { max-width: 650px; margin-bottom: 0; color: var(--muted); }
.eyebrow { margin-bottom: 7px; color: var(--green); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.contest-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.contest-card, .contest-detail, .submission-card, .upload-card, .photo-frame, .admin-row, .admin-tools, .admin-submission, .user-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.contest-card { overflow: hidden; transition: transform .18s ease, box-shadow .18s ease; }
.contest-card:hover { transform: translateY(-2px); box-shadow: 0 12px 35px rgba(20, 38, 26, .10); }
.contest-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-soft); }
.contest-media > img, .detail-banner > img { width: 100%; height: 100%; object-fit: cover; }
.contest-media > img { transition: transform .4s ease; }
.contest-card:hover .contest-media > img { transform: scale(1.025); }
.media-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: #91aa9a; }
.media-placeholder svg { width: 50px; height: 50px; }
.media-badges { position: absolute; top: 10px; left: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.contest-card-body { padding: 16px; }
.contest-card-body h3 { margin-bottom: 6px; }
.contest-card-body > p { min-height: 45px; margin-bottom: 12px; color: var(--muted); font-size: .88rem; }
.meta-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; color: var(--muted); font-size: .76rem; }
.clamp-2 { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.badge-row, .inline-meta, .button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge-row h1, .badge-row h2 { margin-bottom: 0; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.badge-open { background: var(--green-soft); color: var(--green-dark); }
.badge-closed, .badge-neutral { background: #edf0ed; color: #56615a; }
.badge-wait { background: var(--amber-soft); color: var(--amber); }
.badge-done { background: var(--green); color: white; }
.badge-danger { background: var(--red); color: white; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.back-link { display: inline-block; margin-bottom: 18px; color: var(--muted); font-size: .88rem; font-weight: 700; }
.back-link:hover { color: var(--green-dark); }
.contest-detail { overflow: hidden; }
.detail-banner { aspect-ratio: 21 / 8; background: var(--surface-soft); }
.detail-body { padding: 25px; }
.detail-body h1 { margin: 13px 0 10px; font-size: clamp(2rem, 6vw, 3rem); }
.detail-meta { display: flex; flex-wrap: wrap; gap: 7px 22px; color: var(--muted); font-size: .84rem; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.72; }
.detail-body > .prose { margin-top: 23px; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.content-section { margin-top: 34px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.section-heading h2 { margin-bottom: 0; }
.section-heading span { color: var(--muted); font-size: .78rem; }
.submission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.submission-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px; transition: border-color .18s ease, box-shadow .18s ease; }
.submission-card:hover { border-color: #b9cbbf; box-shadow: 0 9px 24px rgba(20, 38, 26, .09); }
.submission-card.large { padding: 12px; }
.thumb { position: relative; flex: 0 0 68px; width: 68px; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: var(--surface-soft); }
.large .thumb { flex-basis: 82px; width: 82px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.rank-ribbon { position: absolute; inset: auto 0 0; padding: 3px 4px; background: rgba(24, 115, 70, .94); color: white; text-align: center; font-size: .58rem; font-weight: 850; text-transform: uppercase; }
.submission-card-body { min-width: 0; flex: 1; }
.submission-card-body h3 { overflow: hidden; margin-bottom: 3px; text-overflow: ellipsis; white-space: nowrap; }
.author { overflow: hidden; margin-bottom: 7px; color: var(--muted); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.inline-meta { color: var(--muted); font-size: .72rem; }
.score { color: var(--green-dark); font-size: .84rem; }
.row-arrow { color: #89958d; font-size: 1.5rem; }

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: .84rem;
  font-weight: 750;
  line-height: 1.2;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.button:active { transform: translateY(1px); }
.button.primary { background: var(--green); color: white; box-shadow: 0 4px 10px rgba(24, 115, 70, .16); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.button.secondary:hover, .button.ghost:hover { border-color: #b8c9bd; background: var(--surface-soft); }
.button.ghost { border-color: transparent; background: transparent; color: var(--green-dark); }
.button.small { min-height: 34px; padding: 7px 11px; font-size: .78rem; }

.page-heading { margin-bottom: 24px; }
.page-heading h1 { font-size: 2.3rem; }
.split-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.form-stack { display: grid; gap: 20px; }
.field { min-width: 0; padding: 0; border: 0; margin: 0; }
.field > label, .field > legend, .inline-form label { display: block; margin-bottom: 7px; color: var(--ink); font-size: .84rem; font-weight: 750; }
.field > legend span { color: var(--muted); font-weight: 500; }
input, textarea, select {
  width: 100%;
  border: 1px solid #ccd8cf;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: #64a17c; box-shadow: 0 0 0 3px rgba(24, 115, 70, .10); }
textarea { resize: vertical; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: .73rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.submit-button { width: fit-content; min-width: 130px; }
.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.upload-card { overflow: hidden; }
.image-picker { position: relative; display: grid; aspect-ratio: 4 / 3; place-items: center; overflow: hidden; background: var(--surface-soft); color: var(--green); cursor: pointer; }
.image-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.image-picker img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.picker-placeholder { display: grid; justify-items: center; gap: 7px; font-size: .78rem; font-weight: 750; }
.picker-placeholder svg { width: 36px; height: 36px; }
.upload-card > input { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.banner-input { display: flex; align-items: center; gap: 13px; }
.banner-preview { flex: 0 0 145px; width: 145px; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.banner-preview img { width: 100%; height: 100%; object-fit: cover; }
.notice { margin-bottom: 18px; padding: 11px 13px; border: 1px solid; border-radius: 6px; font-size: .84rem; }
.notice-error { border-color: #f1bbbb; background: var(--red-soft); color: #8f282d; }
.notice-success { border-color: #b8dcc6; background: var(--green-soft); color: var(--green-dark); }

.list-stack, .admin-list, .admin-submission-list { display: grid; gap: 11px; }
.submission-heading { margin-bottom: 22px; }
.submission-heading h1 { margin: 11px 0 7px; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.photo-frame { overflow: hidden; margin: 0; }
.photo-frame img { width: 100%; height: auto; }
.photo-frame figcaption { padding: 10px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.plain-section { margin-top: 20px; padding-block: 18px; border-block: 1px solid var(--line); }
.plain-section h2 { margin-bottom: 7px; color: var(--muted); font-family: "Segoe UI", sans-serif; font-size: .77rem; text-transform: uppercase; letter-spacing: .08em; }
.result-panel { display: grid; grid-template-columns: 130px 1fr; gap: 25px; margin-top: 22px; padding: 24px; border: 1px solid #bcd8c6; border-radius: var(--radius); background: #edf7f1; }
.score-block { display: grid; aspect-ratio: 1; place-items: center; align-content: center; border-radius: 50%; background: var(--green); color: white; }
.score-block strong { font-family: Georgia, serif; font-size: 2.4rem; line-height: 1; }
.score-block span { font-size: .7rem; opacity: .8; }
.result-copy h2 { margin-bottom: 9px; }
.model-name { margin: 14px 0 0; color: var(--muted); font-size: .78rem; }
.status-panel { display: flex; align-items: center; gap: 11px; margin-top: 22px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.status-panel p { margin: 0; color: var(--muted); }
.pulse-dot, .idle-dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: #d59b36; }
.pulse-dot { animation: pulse 1.3s infinite; }
.idle-dot { background: #98a19a; }

.empty-state { display: grid; min-height: 230px; place-items: center; align-content: center; padding: 34px; border: 1px dashed #bdcabf; border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty-state h2 { margin-bottom: 5px; color: var(--ink); }
.empty-state p { margin-bottom: 15px; }
.empty-state.compact { min-height: 110px; padding: 20px; }
.empty-state.compact p { margin: 0; }
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-panel { width: min(100%, 430px); padding: 38px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.login-panel img { margin: 0 auto 18px; }
.login-panel h1 { font-size: 2rem; }
.login-panel > p:not(.eyebrow) { color: var(--muted); }
.login-panel .notice { margin-top: 20px; margin-bottom: 0; }

.admin-row { display: flex; align-items: center; gap: 14px; padding: 13px; }
.admin-thumb { flex: 0 0 84px; width: 84px; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 6px; background: var(--surface-soft); }
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-row-main { min-width: 0; flex: 1; }
.admin-row-main h2 { margin: 0; font-size: 1.05rem; }
.admin-row-main p, .admin-submission-main > p, .tool-row p { margin: 5px 0 0; color: var(--muted); font-size: .76rem; }
.admin-tools { overflow: hidden; margin-bottom: 28px; }
.tool-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px; border-bottom: 1px solid var(--line); }
.tool-row:last-child { border-bottom: 0; }
.tool-row form { flex: 0 0 auto; }
.tool-row select { min-width: 210px; }
.winner-tool { align-items: flex-end; }
.inline-form { display: flex; align-items: flex-end; gap: 8px; }
.inline-form label { margin: 0; }
.inline-form input { width: 90px; margin-top: 5px; }
.admin-submission { display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; align-items: start; gap: 13px; padding: 12px; }
.admin-submission-main { min-width: 0; }
.item-title { display: block; overflow: hidden; font-family: Georgia, serif; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.admin-submission-actions { display: grid; justify-items: end; gap: 7px; }
.admin-submission-actions select { min-width: 130px; padding-block: 7px; font-size: .76rem; }
.judge-reason { padding: 8px 10px; border-radius: 6px; background: var(--surface-soft); color: var(--ink) !important; line-height: 1.5; }
.user-list { overflow: hidden; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.large-avatar { flex: 0 0 40px; width: 40px; height: 40px; font-size: .9rem; }
.user-main { display: grid; min-width: 0; flex: 1; }
.user-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-main small { color: var(--muted); font-weight: 500; }
.user-main span { color: var(--muted); font-size: .73rem; }
.user-row select { width: 145px; }
.notification-page-list { display: grid; gap: 10px; }
.notification-page-list form { margin: 0; }
.notification-page-item {
  display: grid;
  width: 100%;
  grid-template-columns: 12px minmax(0, 1fr) 8px;
  align-items: start;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}
.notification-page-item.unread { border-color: #a9d1b8; background: #f3faf5; }
.notification-page-item strong { font-size: .9rem; }

@keyframes reveal { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.82); } }
.reveal { animation: reveal .42s cubic-bezier(.22, 1, .36, 1) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 960px); }
  .page { padding-block: 25px 48px; }
  .brand span { display: none; }
  .nav > a { padding-inline: 7px; font-size: .76rem; }
  .profile-name { display: none; }
  .profile-chip { padding-left: 4px; }
  .contest-grid, .submission-grid, .gallery, .upload-grid, .form-grid, .form-grid.thirds { grid-template-columns: 1fr; }
  .detail-banner { aspect-ratio: 16 / 8; }
  .detail-body { padding: 19px; }
  .split-heading { align-items: stretch; flex-direction: column; }
  .split-heading > .button-row, .split-heading > .button { align-self: flex-start; }
  .banner-input { align-items: stretch; flex-direction: column; }
  .banner-preview { width: 100%; flex-basis: auto; }
  .result-panel { grid-template-columns: 88px 1fr; gap: 16px; padding: 18px; }
  .tool-row { align-items: stretch; flex-direction: column; }
  .tool-row form, .tool-row select { width: 100%; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form input { width: 100%; }
  .admin-row { align-items: flex-start; flex-wrap: wrap; }
  .admin-row-main { min-width: calc(100% - 100px); }
  .admin-row > .button-row { width: 100%; justify-content: flex-end; }
  .admin-submission { grid-template-columns: 62px minmax(0, 1fr); }
  .admin-submission-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; justify-items: stretch; }
  .admin-submission-actions .button, .admin-submission-actions select { width: 100%; }
}

@media (max-width: 430px) {
  .header-inner { gap: 6px; }
  .brand img { width: 32px; height: 32px; }
  .nav { gap: 0; }
  .nav > a { padding-inline: 5px; font-size: .71rem; }
  .profile-chip .avatar { display: none; }
  .profile-chip { margin-left: 0; }
  h1 { font-size: 2.12rem; }
  .home-intro { padding-top: 16px; }
  .submission-card { gap: 9px; }
  .thumb { flex-basis: 61px; width: 61px; }
  .login-panel { padding: 28px 20px; }
  .result-panel { grid-template-columns: 1fr; }
  .score-block { width: 92px; }
  .user-row { align-items: flex-start; flex-wrap: wrap; }
  .user-row form, .user-row select { width: 100%; }
}
