body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    color: #222;
}

.page {
    width: min(1500px, calc(100vw - 40px));
    margin: 40px auto;
    padding: 0 20px;
}

.card {
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

h1, h2 {
    margin-top: 0;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

input[type="email"],
input[type="password"],
input[type="text"] {
    width: 100%;
    max-width: 420px;
    padding: 10px 12px;
    border: 1px solid #bbb;
    border-radius: 6px;
    box-sizing: border-box;
    margin-bottom: 12px;
    background: #fff;
}

button,
.button {
    display: inline-block;
    padding: 10px 16px;
    border: 1px solid #2d6cdf;
    background: #2d6cdf;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

button:hover,
.button:hover {
    filter: brightness(0.96);
}

.button.secondary {
    background: #fff;
    color: #2d6cdf;
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form input {
    margin-bottom: 0;
}

.muted {
    color: #666;
}

.alert {
    padding: 12px 14px;
    border-radius: 6px;
    margin-top: 10px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fdecec;
    color: #8d1f1f;
    border: 1px solid #e6b8b8;
}

.alert-success {
    background: #edf8ed;
    color: #226622;
    border: 1px solid #b8ddb8;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card p {
    line-height: 1.55;
}

.card ul {
    margin-top: 10px;
    margin-bottom: 16px;
    padding-left: 22px;
}

.card li {
    margin-bottom: 8px;
    line-height: 1.5;
}

pre {
    background: #f3f4f6;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: monospace;
    font-size: 14px;
}

#profile-message,
#flag-message {
    margin-top: 10px;
}

#my-score-summary,
#leaderboard {
    min-height: 24px;
}

a {
    color: #2d6cdf;
}

a:hover {
    text-decoration: underline;
}

.challenge-item {
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
}

.challenge-item.solved {
    background: #f1f9f1;
    border-color: #b9ddb9;
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.challenge-name {
    font-weight: bold;
    margin-bottom: 6px;
}

.challenge-description {
    color: #555;
    line-height: 1.45;
    font-size: 0.7em;
}

.challenge-meta {
    text-align: right;
    min-width: 150px;
}

.challenge-points {
    font-weight: bold;
    margin-bottom: 6px;
}

.challenge-status {
    color: #666;
    font-size: 14px;
}

.score-table {
    width: 100%;
    border-collapse: collapse;
}

.score-table th,
.score-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e3e3e3;
    text-align: left;
}

.score-table th {
    background: #f8f8f8;
}

.event-item {
    padding: 12px 0;
    border-bottom: 1px solid #e8e8e8;
}

.event-item:last-child {
    border-bottom: none;
}

.event-message {
    margin-bottom: 4px;
}

.event-time {
    color: #777;
    font-size: 13px;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.dashboard-main,
.dashboard-side {
    min-width: 0;
}

.event-feed-scroll {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.45;
    background: #fafafa;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    padding: 10px 12px;
}

.event-line {
    white-space: nowrap;
    overflow-x: auto;
    padding: 3px 0;
    border-bottom: 1px solid #ececec;
}

.event-line:last-child {
    border-bottom: none;
}

@media (max-width: 1100px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

.topbar-stats {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
}

.topbar-stat {
    min-width: 110px;
    padding: 10px 14px;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    background: #fafafa;
    text-align: center;
}

.topbar-stat-label {
    color: #666;
    font-size: 13px;
    margin-bottom: 4px;
}

.topbar-stat-value {
    font-size: 24px;
    font-weight: bold;
    line-height: 1.1;
}

.topbar-stat-sub {
    color: #777;
    font-size: 13px;
    margin-top: 2px;
}
