:root {
    /*--bg: #0b0f0c;*/
    /*--bg: #121212;*/
    --bg: #000000;
    --text: #d6ddd8;
    --gold: #9d9c7c;
    /*--text: #ffffff;*/
    --muted: #98a39d;
    --bright-green: #1ed135;
    --dim-white: #c9c9c9;
    /*--green: #39ff88;*/

    --dark-green: #008000;
    --green: #279b36;
    --green-dim: rgba(57, 255, 136, 0.4);
    --dark-grey: #3b3b3b;
    --mid-grey: #6d716d;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

main {
    /*width: 35em;*/
    width: 100%;
    margin: 0 auto
}

hr {
    border: none;
    height: 2px;
    background-color: var(--dark-grey);
    margin: 20px auto;
    /*width: 80%; !* Optional: narrows the line width *!*/
    width: 28em;
    max-width: 80%;
}

/* Links */
a {
    color: var(--green);
    text-decoration: none;
    width: 50px;
    display: inline;
    /*margin: 0 16px;*/
}

a:hover {
    text-decoration: underline;
}

/* Top nav (since I saw that in your screenshot) */
nav {
    text-align: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--green-dim);
}

nav a {
    margin: 0;
    margin-right: 32px;
    font-size: 0.95rem;
    /*opacity: 0.85;*/
    text-decoration: none;
    color: var(--green);
}

nav a:hover {
    opacity: 1;
}

h1, h2, h3, ul {
    margin: 0;
}

ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

h1 {
    color: var(--bright-green);
}

h2 {
    color: #48791e
}

h3, p, li {
    color: var(--text);
    margin-bottom: 1em;
    line-height: 1.3em;
}

h3 {
    margin-bottom: 0.5em;
}

li {
    margin-bottom: 0.3em;
}

small {
    color: var(--dim-white);
}

body {
    font-family: sans-serif;
    /*line-height: 1.5;*/
    padding: 0 20px;
    max-width: 800px;
    margin: 0 auto;
}

form div {
    margin-bottom: 1rem;
}

section {
    margin-bottom: 3em;
}

.centre {
    text-align: center;
}

.notice {
    color: #555;
    font-style: italic;
}

.subtitle {
    color: var(--mid-grey);
}

p.tagline {
    margin: 0;
    font-size: smaller;
    color: var(--dim-white);
}

.grid-row-wrapper {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.module {
    border: 1px solid #ffffff;
    border-radius: 5px;
    padding: 15px;
    text-align: left;
    background-color: black;
}

/* --- Dynamic Column Spans --- */
.span-1 {
    grid-column-end: span 1;
}

.span-2 {
    grid-column-end: span 2;
}

.span-3 {
    grid-column-end: span 3;
}

.span-4 {
    grid-column-end: span 4;
}

.span-5 {
    grid-column-end: span 5;
}

.span-6 {
    grid-column-end: span 6;
}

/* --- Dynamic Column Start Tracks (Forces Gaps) --- */
.start-1 {
    grid-column-start: 1;
}

.start-2 {
    grid-column-start: 2;
}

.start-3 {
    grid-column-start: 3;
}

.start-4 {
    grid-column-start: 4;
}

.start-5 {
    grid-column-start: 5;
}

.start-6 {
    grid-column-start: 6;
}

/* Mobile view: 2-column grid and remove specific spans/starts */
@media (max-width: 600px) {
    .grid-row-wrapper {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* Reset grid start and span properties so modules fit 2-column grid */
    .module[class*="span-"],
    .module[class*="start-"] {
        grid-column: auto !important;
    }
}

.button {
    display: inline-block;
    padding: 8px 14px;
    background-color: var(--green);
    color: #000;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    border: none;
    cursor: pointer;
    width: auto;
}

.button:hover {
    background-color: var(--bright-green);
    text-decoration: none;
}

.button.secondary {
    background-color: var(--dark-grey);
    color: var(--text);
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 8px;
    background: #222;
    border: 1px solid var(--mid-grey);
    color: var(--text);
}

fieldset {
    border: 1px solid var(--dark-grey);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

legend {
    padding: 0 0.5rem;
    color: var(--gold);
}

/* Profile Header Styles */
.profile-info {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.profile-pic {
    border-radius: 8px;
    border: 2px solid var(--gold);
    width: 150px;
    height: 150px;
    object-fit: cover;
}

.profile-details-text {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 150px;
}

.primary-info, .secondary-info {
    display: flex;
    flex-direction: column;
}

.profile-details-text h1 {
    margin: 0;
    line-height: 1;
}

.profile-details-text .welcome {
    margin: 0;
    font-style: italic;
    color: var(--dim-white);
    font-size: 0.95rem;
    margin-top: 8px;
}

.age-line, .location-line {
    margin: 0;
    line-height: 1.5;
}

.manage-profile-form {
    background: #111;
    padding: 20px;
    border: 1px dashed var(--gold);
    text-align: left;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    border-radius: 8px;
}

.profile-pic-edit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 150px;
}

.profile-pic-edit .profile-pic {
    margin-bottom: 0;
}

.profile-pic-edit label.change-pic-label {
    font-size: 0.8rem;
    color: var(--mid-grey);
    text-align: center;
    width: 100%;
    display: block;
}

.custom-file-upload {
    font-size: 0.75rem !important;
    padding: 4px 10px !important;
    cursor: pointer;
    display: inline-block;
    margin-top: 2px;
}

.profile-pic-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    justify-content: center;
}

.remove-pic-btn {
    padding: 4px 8px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--dark-grey) !important;
    color: #fff !important;
}

.remove-pic-btn:hover {
    background-color: #c00 !important;
}

#file-chosen {
    font-size: 0.9rem;
    color: var(--gold);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-details-edit {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 150px;
    flex-grow: 1;
}

.primary-edit, .secondary-edit {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.location-edit {
    display: flex;
    gap: 10px;
}

.location-edit label {
    flex: 1;
}

.manage-profile-form label {
    display: block;
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--gold);
}

.manage-profile-form input[type="text"],
.manage-profile-form input[type="number"],
.manage-profile-form textarea {
    width: 100%;
    background: #222;
    border: 1px solid var(--mid-grey);
    color: #fff;
    padding: 4px 8px;
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.form-actions button, .form-actions .button {
    font-size: 0.85rem;
    padding: 6px 12px;
}

.module.manage-mode {
    position: relative;
    border-style: dashed;
    border-color: var(--gold);
}

.module-manage-overlay {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 10;
}

.delete-btn {
    background: #c00;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    padding: 2px 6px;
}

.delete-btn:hover {
    background: #f00;
}

.add-module-placeholder {
    border: 2px dashed #444;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    grid-column: span 2;
}