/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Footer (Simplified for focus) */
header, footer { text-align: center; margin-bottom: 20px; }
header h1 a { text-decoration: none; color: #333; }

/* Main Content Styles */
main {
    max-width: 100%;
    margin: 2rem auto;
    padding: 0 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* --- New Tournament Bracket Styles from user request --- */
.bracket-container-new {
    overflow-x: auto;
    padding: 20px;
    background: #fdfdfd;
}

.bracket-header-new {
    display: flex;
    border: 1px solid #ccc;
}

.round-title-new {
    flex: 1;
    text-align: center;
    font-weight: bold;
    padding: 10px;
    background: #f0f0f0;
    border-right: 1px solid #ccc;
    min-width: 220px; /* Match the .round-new min-width */
}

.round-title-new:last-child {
    border-right: none;
}

.bracket-body-new {
    display: flex;
}

.round-new {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex-grow: 1;
    min-width: 220px;
}

.match-wrapper-new {
    display: flex;
    align-items: center;
    margin: 20px 0;
    position: relative;
}

.match-new {
    border: 1px solid #ccc;
    width: 200px;
    background: white;
}

.player-new {
    display: flex;
    justify-content: space-between;
    padding: 8px;
}

.player-new:first-child {
    border-bottom: 1px solid #ccc;
}

.player-new.winner {
    background-color: #d4edda;
}

.name-new {
    flex-grow: 1;
}

.score-new {
    font-weight: bold;
    padding-left: 10px;
}

.match-new.is-bye .player-new:last-child {
    color: #999;
    font-style: italic;
}

.round-new:not(:last-child) .match-wrapper-new {
    position: relative;
}

.round-new:not(:last-child) .match-wrapper-new::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 2px;
    background: #ccc;
}

.round-new:not(:last-child) .match-wrapper-new:nth-child(2n-1)::before {
    content: '';
    position: absolute;
    left: calc(100% + 20px);
    top: 50%;
    width: 2px;
    height: calc(100% + 40px);
    background: #ccc;
}

/* --- Enhanced Blue Design --- */
.enhanced-design {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: #e9f7ff; /* Light blue background */
    color: #212529; /* Dark gray text */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.enhanced-design header {
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.enhanced-design header h1 a {
    color: #0056b3; /* Primary blue */
    font-weight: 700;
}

.enhanced-design main {
    max-width: 1200px;
    padding: 0 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.enhanced-design h2, .enhanced-design h3 {
    color: #004085; /* Darker blue */
    font-weight: 700;
    border-bottom: 2px solid #0056b3; /* Primary blue */
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.enhanced-design .button, .enhanced-design button {
    background-color: #0056b3; /* Primary blue */
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    display: inline-block;
}

.enhanced-design .button:hover, .enhanced-design button:hover {
    background-color: #004085; /* Darker blue */
    transform: translateY(-2px);
}

.enhanced-design .button-secondary {
    background-color: #6c757d; /* Gray for secondary actions */
}

.enhanced-design .button-secondary:hover {
    background-color: #5a6268;
}

.poll-card {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s, transform 0.3s;
}

.poll-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
}

.poll-card h3 {
    border: none;
    margin-bottom: 0.5rem;
    color: #0056b3; /* Primary blue */
}

.poll-card p {
    color: #495057;
    flex-grow: 1;
}

.poll-card small {
    color: #6c757d;
    display: block;
    margin-bottom: 1rem;
}

.poll-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.ranking-section ol {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 1rem 1rem 1rem 2.5rem;
}

.ranking-section li {
    font-size: 1.1rem;
    padding: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.ranking-section li:last-child {
    border-bottom: none;
}

/* --- Page Structure & Layouts --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h2 {
    margin-bottom: 0;
}
.page-header-actions {
    display: flex;
    gap: 0.5rem;
}

.tournament-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.tournament-card {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s, transform 0.3s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.tournament-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
    color: inherit;
}

.tournament-card h3 {
    border: none;
    margin-bottom: 0.5rem;
    color: #0056b3; /* Primary blue */
}

.tournament-card small {
    color: #6c757d;
    display: block;
    margin-top: auto;
    padding-top: 1rem;
}

/* --- Messages Framework --- */
.messages-container {
    max-width: 1200px;
    margin: 0 auto 1.5rem auto;
    padding: 0 1rem;
}
.message {
    padding: 1rem 1.5rem;
    border-radius: 5px;
    border: 1px solid transparent;
    margin-bottom: 1rem;
}
.message.success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}
.message.error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}
.message.info {
    background-color: #cce5ff;
    border-color: #b8daff;
    color: #004085;
}
.message.warning {
    background-color: #fff3cd;
    border-color: #ffeeba;
    color: #856404;
}

/* --- Ranking Medal Styles --- */
.ranking-section li {
    border-radius: 5px;
    margin-bottom: 0.5rem;
}
.rank-gold {
    background: linear-gradient(to right, #f7d43b, #e7c83c);
    color: #4d3c0a;
    font-size: 1.5rem !important;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(247, 212, 59, 0.4);
    transform: scale(1.05);
    border: 1px solid #d6b833;
}
.rank-silver {
    background: linear-gradient(to right, #e0e0e0, #d0d0d0);
    color: #3d3d3d;
    font-size: 1.4rem !important;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(192, 192, 192, 0.4);
    transform: scale(1.03);
    border: 1px solid #b0b0b0;
}
.rank-bronze {
    background: linear-gradient(to right, #d9a784, #c99774);
    color: #5d3a1e;
    font-size: 1.3rem !important;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(205, 127, 50, 0.3);
    transform: scale(1.01);
    border: 1px solid #b88662;
}

/* --- Results Table Styles --- */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.9em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.results-table thead tr {
    background-color: #0056b3;
    color: #ffffff;
    text-align: left;
}

.results-table th,
.results-table td {
    padding: 12px 15px;
    border: 1px solid #dddddd;
}

.results-table tbody tr {
    border-bottom: 1px solid #dddddd;
}

.results-table tbody tr:nth-of-type(even) {
    background-color: #f3f3f3;
}

.results-table tbody tr:last-of-type {
    border-bottom: 2px solid #0056b3;
}

.results-table tbody tr:hover {
    background-color: #f1f1f1;
}

/* --- Drink Redemption System Styles --- */

/* Verification Form Styles */
.form-container {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.form-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}
.form-field {
    margin-bottom: 1.5rem;
}
.form-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #333;
}
.form-field input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
.form-container .button { /* Specificity for button inside form */
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
}
.error-message {
    color: #d93025;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}
.form-errors, .field-errors {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    border-radius: 4px;
}
.form-errors p, .field-errors p {
    margin: 0;
}

/* Redemption Status Page Styles */
.status-page-container {
    max-width: 600px;
    margin: 1rem auto;
    padding: 1rem;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.student-info-header {
    text-align: left;
    margin-bottom: 1rem;
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.student-info-header p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}
.status-card {
    padding: 4rem 2rem;
    border-radius: 15px;
    color: white;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: background-color 0.5s ease;
    position: relative;
    overflow: hidden;
}
.status-text {
    font-size: 4rem;
    font-weight: bold;
    position: relative;
    z-index: 2;
}
.redeemed-text {
    font-size: 3.5rem;
}
.sub-text {
    font-size: 1.5rem;
    margin-top: 0.5rem;
    opacity: 0.9;
    position: relative;
    z-index: 2;
}
.status-adult { background-color: #0056b3; }
.status-minor { background-color: #e8590c; }
.status-redeemed { background-color: #6c757d; }

.swipe-container {
    margin-top: 2rem;
    background: #e9ecef;
    border-radius: 50px;
    padding: 5px;
    position: relative;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.swipe-button {
    background-color: rgba(0, 86, 179, 0.8);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 5px;
    top: 5px;
    z-index: 2;
    cursor: grab;
}
.swipe-arrow {
    font-size: 2rem;
}
.swipe-text {
    color: #333;
    font-weight: bold;
    z-index: 1;
}
.hidden {
    display: none;
}
.redeemed-final-message {
    margin-top: 2rem;
    font-size: 1.2rem;
    color: #333;
}

/* --- Home Page Styles --- */
.home-container {
    text-align: center;
    padding: 4rem 1rem;
}
.home-container h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #004085; /* Darker blue from the theme */
    border-bottom: none;
}
.home-container p {
    font-size: 1.2rem;
    color: #495057;
    margin-bottom: 3rem;
}
.home-actions {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}
.home-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 150px;
    background-color: #ffffff;
    color: #0056b3; /* Primary blue */
    text-decoration: none;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    font-weight: 700;
}
.home-button:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}
.button-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}
.button-text {
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .home-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .home-button {
        width: auto;
        height: 140px;
    }
    .home-container h2 {
        font-size: 2rem;
    }
}

/* --- Drink Confirmation Page Styles --- */
.confirmation-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    text-align: center;
}
.confirmation-container h2 {
    margin-bottom: 1rem;
}
.confirmation-container p {
    margin-bottom: 2rem;
    font-size: 1.1rem;
    color: #555;
}
.info-card {
    text-align: left;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.info-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    font-size: 1.2rem;
    border-bottom: 1px solid #eee;
}
.info-item:last-child {
    border-bottom: none;
}
.info-label {
    font-weight: bold;
    color: #333;
}
.info-value {
    color: #000;
}
.age-status .info-value.adult {
    color: #0056b3;
    font-weight: bold;
}
.age-status .info-value.minor {
    color: #e8590c;
    font-weight: bold;
}
.confirmation-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Style for emphasizing student information */
.emphasized-info {
    color: #0056b3; /* A nice blue color */
    font-weight: bold;
    font-size: 1.2em; /* Slightly larger font */
}

/* --- Status Tag Styles --- */
.status-tag {
    padding: 0.25em 0.6em;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 15px;
    color: #fff;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Poll Statuses */
.status-実施前, .status-preparing {
    background-color: #007bff; /* Blue */
}
.status-実施中, .status-ongoing {
    background-color: #28a745; /* Green */
}
.status-終了, .status-completed {
    background-color: #6c757d; /* Gray */
}

/* Card Header Adjustments */
.tournament-card-header, .poll-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.tournament-card-header h3, .poll-card-header h3 {
    margin: 0;
}

.tournament-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}
