@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap");

:root {
    --ink: #18221d;
    --muted: #69736d;
    --soft: #f3f1ea;
    --paper: #fbfaf6;
    --white: #ffffff;
    --line: #dedfd7;
    --green: #49634f;
    --green-dark: #304936;
    --green-soft: #e7eee7;
    --red: #b44d43;
    --red-soft: #f5e5e2;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "DM Sans", sans-serif;
    background: var(--soft);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.55;
}

button,
input,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

header {
    background: var(--ink);
    color: var(--white);
    padding: 32px max(5vw, 28px) 28px;
    border-bottom: 4px solid var(--green);
}

header h1 {
    font-family: "Playfair Display", serif;
    font-size: clamp(34px, 5vw, 48px);
    font-weight: 700;
    letter-spacing: -1.5px;
    line-height: 1;
    margin-bottom: 10px;
}

header p {
    color: #bfc8c0;
    font-size: 14px;
}

nav {
    background: var(--white);
    border-bottom: 1px solid var(--line);
    padding: 0 max(5vw, 28px);
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

nav::-webkit-scrollbar {
    display: none;
}

.navButton {
    position: relative;
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 17px 14px 15px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.navButton::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 2px;
    background: var(--green);
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.navButton:hover {
    background: transparent;
    color: var(--ink);
}

.navButton:hover::after {
    transform: scaleX(1);
}

main {
    width: min(1040px, calc(100% - 48px));
    margin: 44px auto 80px;
}

.appSection {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin-bottom: 36px;
}

.appSection h2 {
    font-family: "Playfair Display", serif;
    font-size: clamp(30px, 4vw, 40px);
    line-height: 1.1;
    letter-spacing: -0.7px;
    margin-bottom: 8px;
}

.appSection > p {
    color: var(--muted);
    font-size: 15px;
    margin-bottom: 28px;
}

#overviewProblems,
#roleProblems,
#problemsFeed,
#solvedProblems {
    display: grid;
    gap: 18px;
    margin-top: 28px;
}

.problemCard {
    position: relative;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 28px 30px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.problemCard::before {
    content: "";
    position: absolute;
    left: -1px;
    top: -1px;
    bottom: -1px;
    width: 3px;
    background: var(--green);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.problemCard:hover {
    border-color: #bdc5bd;
    transform: translateX(3px);
}

.problemCard:hover::before {
    transform: scaleY(1);
}

.problemTag {
    display: inline-block;
    background: transparent;
    color: var(--green);
    padding: 0;
    border-radius: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    margin-bottom: 12px;
}

.problemCard h3 {
    font-family: "Playfair Display", serif;
    font-size: 24px;
    line-height: 1.25;
    letter-spacing: -0.3px;
    margin-bottom: 12px;
}

.problemCard p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
    margin-bottom: 6px;
}

.problemCard p:nth-last-of-type(1) {
    color: #929991;
    font-size: 12px;
}

.problemImages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-top: 22px;
}

.problemImages img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    border-radius: 2px;
    display: block;
}

button {
    border: 1px solid var(--green-dark);
    border-radius: 3px;
    background: var(--green-dark);
    color: var(--white);
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
}

button:hover {
    background: var(--green);
    border-color: var(--green);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#problemFormContainer {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 28px;
    margin-top: 18px;
}

#problemFormContainer h3 {
    font-family: "Playfair Display", serif;
    font-size: 24px;
    margin-bottom: 20px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

input,
textarea {
    width: 100%;
    border: 1px solid #cfd3cc;
    border-radius: 2px;
    padding: 13px 14px;
    font-size: 14px;
    background: var(--white);
    color: var(--ink);
    transition: border-color 0.2s ease;
}

input::placeholder,
textarea::placeholder {
    color: #9aa19b;
}

textarea {
    min-height: 125px;
    resize: vertical;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--green);
}

label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.03em;
}

#problemMessage,
#completionMessage,
#commentMessage {
    color: var(--muted);
    font-size: 13px;
}

#problemDetail {
    max-width: 820px;
}

#backToProblemsButton {
    background: transparent;
    color: var(--green-dark);
    border: 0;
    padding: 0;
    margin-bottom: 30px;
}

#backToProblemsButton:hover {
    background: transparent;
    color: var(--green);
}

#problemDetailContent {
    background: var(--white);
    border: 1px solid var(--line);
    padding: clamp(24px, 5vw, 42px);
}

#problemDetailContent > .problemTag {
    margin-bottom: 16px;
}

#problemDetailContent > h2 {
    font-family: "Playfair Display", serif;
    font-size: clamp(32px, 5vw, 46px);
    line-height: 1.12;
    letter-spacing: -1px;
    margin-bottom: 22px;
}

#problemDetailContent > p {
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 9px;
}

.problemDetailImages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin: 28px 0 34px;
}

.problemDetailImages img {
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    display: block;
}

#problemDetailContent h3 {
    font-family: "Playfair Display", serif;
    font-size: 24px;
    margin-top: 36px;
    margin-bottom: 15px;
}

#likeButton {
    background: transparent;
    color: var(--red);
    border-color: #d9b1ad;
    margin-right: 10px;
}

#likeButton:hover {
    background: var(--red-soft);
    border-color: var(--red);
}

#likeCount {
    color: var(--muted);
    font-size: 13px;
}

#completionInput,
#commentInput {
    min-height: 115px;
}

#commentsContainer {
    display: grid;
    gap: 0;
    margin-top: 20px;
    border-top: 1px solid var(--line);
}

.commentCard {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 20px 4px;
}

.commentCard strong {
    display: block;
    color: var(--ink);
    font-size: 14px;
    margin-bottom: 5px;
}

.commentCard p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
    margin-bottom: 7px;
}

.commentCard small {
    color: #9aa19b;
    font-size: 11px;
}

#solvedProblems .problemCard {
    border-left: 3px solid var(--green);
}

#solvedProblems .problemCard::before {
    display: none;
}

#solvedProblems .problemTag {
    color: var(--green);
}

#solvedProblems .problemCard h3 {
    margin-bottom: 10px;
}

#settingsLogoutButton {
    background: transparent;
    color: var(--red);
    border-color: #d9b1ad;
    margin-top: 10px;
}

#settingsLogoutButton:hover {
    background: var(--red-soft);
    border-color: var(--red);
}

@media (max-width: 700px) {
    header {
        padding: 26px 20px 24px;
    }

    header h1 {
        font-size: 38px;
    }

    nav {
        padding: 0 16px;
    }

    .navButton {
        padding: 15px 12px 13px;
        font-size: 13px;
    }

    main {
        width: calc(100% - 32px);
        margin: 30px auto 60px;
    }

    .problemCard {
        padding: 22px;
    }

    .problemCard h3 {
        font-size: 21px;
    }

    .problemImages {
        grid-template-columns: 1fr;
    }

    .problemImages img {
        height: 230px;
    }

    #problemFormContainer {
        padding: 20px;
    }

    #problemDetailContent {
        padding: 24px 20px;
    }

    .problemDetailImages {
        grid-template-columns: 1fr;
    }
}