* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: "Microsoft JhengHei", "PingFang TC", sans-serif;
    margin: 0;
    background: #f5f5f0;
    color: #333;
}
.contest-header {
    background: #ff8a5b;
    color: #fff;
    padding: 0.8em 1.5em;
}
.contest-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    max-width: 1200px;
    margin: 0 auto;
}
.contest-logo { color: #fff; font-weight: bold; font-size: 1.8em; text-decoration: none; line-height: 1.8; display: flex; align-items: center; gap: 0.5em; flex-shrink: 0; }
.contest-logo-img { height: 73px; width: 73px; border-radius: 50%; object-fit: cover; }
.contest-nav { display: flex; flex-direction: column; align-items: flex-end; }
.contest-nav-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.contest-nav-row + .contest-nav-row { margin-top: 0.3em; }
.contest-nav a { color: #fff; margin-left: 1em; text-decoration: none; }
.contest-nav a:hover { text-decoration: underline; }
.contest-nav a.contest-nav-highlight {
    color: #fff;
    font-weight: bold;
    background: #1a3c6e;
    padding: 0.2em 0.6em;
    border-radius: 4px;
}
.contest-nav a.contest-nav-highlight:hover { background: #274d87; text-decoration: none; }
.contest-user-info { margin-left: 1em; font-size: 0.9em; }
.contest-main { max-width: 1000px; margin: 1.5em auto; padding: 0 1em; }
.contest-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5em;
    margin-bottom: 1.5em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.contest-card h1 { margin-top: 0; color: #d9622b; }
label { display: block; margin-top: 0.8em; font-weight: bold; }
input[type=text], input[type=password], input[type=number], input[type=file], select, textarea {
    width: 100%;
    padding: 0.5em;
    margin-top: 0.3em;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.checkbox-inline { display: inline-block; font-weight: normal; margin-right: 1em; }
button, .btn-cancel {
    margin-top: 1em;
    padding: 0.5em 1.2em;
    background: #ff8a5b;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
button:hover, .btn-cancel:hover { background: #e56f3f; }
.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #a5281a; }
.contest-table { width: 100%; border-collapse: collapse; margin-top: 1em; }
.contest-table th, .contest-table td {
    border-bottom: 1px solid #eee;
    padding: 0.6em;
    text-align: left;
}
.contest-drag-handle { cursor: grab; color: #999; text-align: center; width: 1.5em; }
.contest-drag-row.contest-drag-dragging { opacity: 0.4; background: #fdf0e6; }
.contest-sb3-preview-frame { width: 100%; max-width: 500px; height: 470px; border: 1px solid #ddd; border-radius: 4px; margin-top: 0.5em; display: block; }
.contest-lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    padding: 2em;
}
.contest-lightbox.contest-lightbox-open { display: flex; }
.contest-lightbox img { max-width: 100%; max-height: 100%; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
.flash { padding: 0.8em 1em; border-radius: 4px; margin-bottom: 1em; }
.flash-success { background: #d4edda; color: #155724; }
.flash-error { background: #f8d7da; color: #721c24; }
.flash-info { background: #d1ecf1; color: #0c5460; }
.contest-login-card { max-width: 400px; margin: 2em auto; }
.contest-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1em; }
.contest-gallery-item { background: #fafafa; border-radius: 6px; padding: 0.8em; text-align: center; }
.contest-gallery-item img { max-width: 100%; border-radius: 4px; }
.contest-gallery-desc { font-size: 0.85em; color: #666; }
.contest-submission-item { border-left: 4px solid #ff8a5b; }
.contest-category-heading {
    margin: 1.5em 0 0.5em 0;
    padding: 0.4em 0.8em;
    background: #ff8a5b;
    color: #fff;
    border-radius: 4px;
}
.contest-category-heading:first-of-type { margin-top: 0.5em; }
.contest-archive-year-heading {
    margin: 2em 0 0.8em 0;
    padding-bottom: 0.3em;
    border-bottom: 3px solid #d9622b;
    color: #d9622b;
}
h2.contest-archive-year-heading:first-of-type { margin-top: 0.5em; }
.contest-jump-nav {
    background: #fdf3ec;
    border: 1px solid #f0ddc9;
    border-radius: 6px;
    padding: 0.8em 1em;
    margin-bottom: 1em;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em;
}
.contest-jump-btn {
    display: inline-block;
    background: #ff8a5b;
    color: #fff;
    padding: 0.25em 0.7em;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
}
.contest-jump-btn:hover { background: #e56f3f; }
.contest-back-to-top {
    position: fixed;
    right: 1.5em;
    bottom: 1.5em;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ff8a5b;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    z-index: 500;
}
.contest-back-to-top:hover { background: #e56f3f; }
.contest-category-heading { scroll-margin-top: 1em; }
.contest-announcement { padding: 0.8em 0; border-bottom: 1px solid #f0e6dc; }
.contest-announcement:last-child { border-bottom: none; }
.contest-announcement h3 { margin: 0 0 0.2em 0; color: #d9622b; }
.contest-announcement-date { font-size: 0.8em; color: #999; margin: 0 0 0.5em 0; }
.contest-footer {
    max-width: 1200px;
    margin: 3em auto 0;
    padding: 1.2em 1.5em 2em;
    border-top: 1px solid #e5ded5;
    text-align: center;
    color: #000;
    font-size: 15pt;
}
.contest-footer p { margin: 0.2em 0; }
.contest-footer-credit { color: #000; }
