:root {
    --stone-light: #eeeae2;
    --stone: #d8d2c7;
    --stone-dark: #aaa398;
    --text: #292722;
    --muted: #777168;
    --accent: #756a5c;
    --accent-dark: #5d5449;
    --border: #bdb5a8;
    --background: #f5f2ec;
    --white: #fffdf9;
}

* {
    box-sizing: border-box;
}

html {
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: var(--text);
    background: var(--background);
}

body {
    margin: 0;
    min-height: 100vh;

    background:
        radial-gradient(
            circle at 20% 10%,
            rgba(255, 255, 255, 0.8),
            transparent 35%
        ),
        radial-gradient(
            circle at 80% 90%,
            rgba(180, 175, 165, 0.18),
            transparent 40%
        ),
        var(--background);
}

/* ------------------------------------------------------------
   Page layout
   ------------------------------------------------------------ */

.page {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 64px;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 42px;
}

.logo {
    color: var(--text);
    text-decoration: none;
}

.logo-name {
    display: block;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.logo-subtitle {
    display: block;

    margin-top: 2px;

    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* ------------------------------------------------------------
   Add message button
   ------------------------------------------------------------ */

.add-message {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;

    border: 1px solid var(--border);
    border-radius: 50%;

    color: var(--text);
    background: var(--stone-light);

    font-size: 1.7rem;
    line-height: 1;
    text-decoration: none;

    box-shadow:
        0 2px 5px rgba(50, 45, 38, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);

    transition:
        transform 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
}

.add-message:hover {
    background: var(--stone);

    box-shadow:
        0 4px 10px rgba(50, 45, 38, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);

    transform: translateY(-1px);
}

/* ------------------------------------------------------------
   Homepage
   ------------------------------------------------------------ */

.page-introduction {
    margin-bottom: 28px;
    text-align: center;
}

.page-introduction h1 {
    margin: 0;

    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
}

.page-introduction p {
    margin: 10px 0 0;

    color: var(--muted);
    font-size: 1rem;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 12px;

    width: min(850px, 100%);
    margin: 0 auto;
}

.message-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 24px;

    padding: 20px 22px;

    border: 1px solid var(--border);
    border-radius: 8px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.6),
            rgba(210, 205, 195, 0.35)
        ),
        var(--stone-light);

    box-shadow:
        0 2px 5px rgba(50, 45, 38, 0.07),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);

    position: relative;
}

.message-card::before {
    content: "";

    position: absolute;
    inset: 0;

    border-radius: inherit;

    pointer-events: none;

    opacity: 0.15;

    background-image:
        repeating-linear-gradient(
            115deg,
            transparent 0,
            transparent 13px,
            rgba(80, 75, 67, 0.08) 14px,
            transparent 15px
        );
}

.message-content {
    position: relative;
    z-index: 1;
}

.message-rank {
    display: block;

    margin-bottom: 8px;

    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
}

.message-text {
    margin: 0;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.18rem;
    line-height: 1.45;
}

.message-meta {
    display: flex;
    gap: 18px;

    margin-top: 12px;

    color: var(--muted);
    font-size: 0.82rem;
}

.message-value {
    color: var(--text);
    font-weight: 700;
}

/* ------------------------------------------------------------
   More / Less link
   ------------------------------------------------------------ */

.more-link {
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.more-link:hover {
    text-decoration: underline;
}

/* ------------------------------------------------------------
   TOP button
   ------------------------------------------------------------ */

.top-message {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: center;
    gap: 9px;
	
	display: block;
	width: fit-content;
	margin-left: auto;

    align-self: center;

    min-width: 155px;
    padding: 10px 12px;

    border: 1px solid var(--border);
    border-radius: 6px;

    color: var(--text);
    background: rgba(255, 253, 249, 0.7);

    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-decoration: none;
    text-align: left;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.top-message:hover {
    border-color: var(--accent);
    background: var(--white);
    transform: translateY(-1px);
}

.top-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 24px;
    height: 24px;

    border-radius: 50%;

    color: var(--white);
    background: var(--accent);

    font-size: 0.9rem;
    font-weight: 700;
}

/* ------------------------------------------------------------
   Form layout
   ------------------------------------------------------------ */

.form-container {
    width: min(800px, 100%);
    margin: 0 auto;
}

.form-field {
    margin-bottom: 1.5rem;
}

.form-field label {
    display: block;

    margin-bottom: 0.5rem;

    color: var(--text);
    font-weight: 600;
}

.form-field textarea,
.form-field select {
    display: block;

    width: 100%;

    border: 1px solid var(--border);
    border-radius: 8px;

    color: var(--text);
    background: var(--stone-light);

    font: inherit;

    padding: 0.8rem;

    box-shadow:
        inset 0 1px 2px rgba(50, 45, 38, 0.05);
}

.form-field textarea {
    min-height: 190px;

    resize: vertical;

    line-height: 1.5;
}

.form-field textarea::placeholder {
    color: var(--muted);
}

.form-field textarea:focus,
.form-field select:focus {
    outline: none;

    border-color: var(--accent);

    box-shadow:
        0 0 0 2px rgba(117, 106, 92, 0.12);
}

.language-field {
    width: min(400px, 100%);
}

.character-counter {
    margin-top: 0.4rem;

    color: var(--muted);

    font-size: 0.85rem;
    text-align: right;
}

.form-submit {
    display: block;

    width: 100%;

    padding: 0.9rem 1.2rem;

    border: 1px solid var(--accent-dark);
    border-radius: 8px;

    color: var(--white);
    background: var(--accent);

    font: inherit;
    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

.form-submit:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

/* ------------------------------------------------------------
   Other pages
   ------------------------------------------------------------ */

.content {
    width: min(750px, 100%);
    margin: 0 auto;
}

.content h1 {
    margin: 0 0 20px;

    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 5vw, 3rem);
}

.content p {
    line-height: 1.7;
}

.navigation {
    display: flex;
    gap: 20px;

    margin-top: 32px;
}

.navigation a {
    color: var(--accent-dark);
    font-weight: 600;
    text-decoration: none;
}

.navigation a:hover {
    text-decoration: underline;
}

/* ------------------------------------------------------------
   Empty state
   ------------------------------------------------------------ */

.empty-state {
    padding: 50px 20px;

    border: 1px dashed var(--border);
    border-radius: 8px;

    color: var(--muted);
    text-align: center;
}

/* ------------------------------------------------------------
   Responsive layout
   ------------------------------------------------------------ */

@media (max-width: 650px) {
    .page {
        width: min(100% - 20px, 1100px);
        padding-top: 20px;
    }

    .site-header {
        margin-bottom: 30px;
    }

    .logo-name {
        font-size: 1.65rem;
    }

    .message-card {
        grid-template-columns: 1fr;
        gap: 16px;

        padding: 17px;
    }

    .top-message {
        justify-self: stretch;
        justify-content: center;
    }

    .message-meta {
        flex-wrap: wrap;
        gap: 8px 18px;
    }

    .navigation {
        flex-direction: column;
        gap: 10px;
    }

    .form-container {
        width: 100%;
    }

    .form-field textarea {
        min-height: 170px;
    }

    .language-field {
        width: 100%;
    }
}