/* Popular topics */
.dg-hot {
    margin: 20px 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
}
.dg-hot h2, .dg-hot h3 {
    margin: 0;
    padding: 12px 16px;
    border: 0;
    background: var(--raised);
    border-radius: 9px 9px 0 0;
    font: 650 1.25rem/1.3 var(--heading);
}
.dg-hot .dg-hot-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.dg-hot-list > li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    min-width: 0;
}
.dg-hot-list > li:last-child {border-radius: 0 0 9px 9px}
.dg-hot-list > li:focus-within, .dg-hot-list > li:hover {background: var(--raised)}
.dg-hot .dg-hot-title {
    min-width: 0;
    font: 600 1.08rem/1.4 var(--heading);
    color: var(--text);
    text-decoration: none;
    overflow-wrap: anywhere;
}
.dg-hot a.dg-hot-title:hover, .dg-hot .dg-hot-title a:hover {color: var(--accent); text-decoration: underline}
.dg-hot .dg-hot-meta {
    flex: 0 1 auto;
    color: var(--soft);
    font-size: .79rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* mChat loads its prosilver CSS after the base theme. Keep the overrides scoped
   to its wrapper so that ordinary post forms and control panels stay independent. */
#phpbb .mchat-wrapper {
    background: var(--surface);
    color: var(--text);
    margin: 18px 0;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.mchat-wrapper .mchat-header li.header {background: var(--raised)}
.mchat-wrapper .mchat-header li.header dt .list-inner {
    margin: 0;
    padding: 11px 16px;
    text-align: left;
}
.mchat-wrapper .mchat-title, .mchat-wrapper .mchat-title a {
    color: var(--text);
    font: 650 1.24rem/1.35 var(--heading);
    text-transform: none;
}
.mchat-wrapper .mchat-title a:hover {color: var(--accent)}
.mchat-wrapper #mchat-status .mchat-status-ok {color: var(--aqua)}
.mchat-wrapper #mchat-status .mchat-status-paused {color: var(--accent)}
.mchat-wrapper #mchat-status .mchat-status-error {color: #ffad9c}
.mchat-wrapper #mchat-body, .mchat-wrapper #mchat-messages {
    background: var(--surface);
    color: var(--text);
    border-radius: 0 0 9px 9px;
}
.mchat-wrapper #mchat-messages {scrollbar-color: #657373 var(--surface)}
.mchat-wrapper #mchat-messages:has(> .mchat-no-messages:only-child) {
    height: auto !important;
    min-height: 0;
}
.mchat-wrapper #mchat-messages .mchat-message,
.mchat-wrapper #mchat-body .mchat-static {
    /* The upstream stylesheet sets the row padding with !important. */
    padding: 10px 15px !important;
    background-color: var(--surface);
    color: var(--soft);
    border-color: var(--border);
    line-height: 1.5;
    font-size: .9rem;
}
.mchat-wrapper #mchat-messages .mchat-message:hover {background-color: #1c2426}
.mchat-wrapper .mchat-message .mchat-text {
    color: var(--text);
    font: 400 .95rem/1.5 system-ui,sans-serif;
    padding: 2px 0 0;
    overflow-wrap: anywhere;
}
.mchat-wrapper .mchat-message-header {color: var(--soft); font-size: .85rem}
.mchat-wrapper .mchat-time {color: var(--soft); font-size: .78rem}
.mchat-wrapper .mchat-buttons li, .mchat-wrapper li:hover .mchat-buttons li {opacity: .86}
.mchat-wrapper .mchat-buttons li a {color: var(--aqua)}
.mchat-wrapper .mchat-buttons li a:hover {color: var(--accent)}
.mchat-wrapper .mchat-message-flash {animation-name: dg-mchat-flash}
@keyframes dg-mchat-flash {
    from {background-color: #463b2e}
    to {background-color: var(--surface)}
}
.mchat-wrapper #mchat-panel {
    background: var(--raised);
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0 0 9px 9px;
    color: var(--soft);
    padding: 10px 13px;
}
.mchat-wrapper #mchat-panel .mchat-controls {margin: 0; align-items: stretch; gap: 6px}
.mchat-wrapper .mchat-input-container.inputbox {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 1px solid #59696d;
    border-radius: 6px;
    background: var(--floor);
}
.mchat-wrapper .mchat-input-container:focus-within {border-color: var(--accent)}
.mchat-wrapper #mchat-input {
    display: block;
    min-height: 40px;
    width: 100%;
    max-width: 100%;
    padding: 8px 4px 8px 11px;
    font: 400 .94rem/1.45 system-ui,sans-serif;
    border-right-width: 42px;
    color: var(--text);
    caret-color: var(--accent);
    background: transparent;
}
.mchat-wrapper .mchat-input-control {width: 40px; right: 1px}
.mchat-wrapper button#mchat-add {
    width: 32px;
    height: 30px;
    margin: 0;
    padding: 3px;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    background: var(--accent);
    color: #232522;
}
.mchat-wrapper button#mchat-add:hover {background: #f7c198}
.mchat-wrapper button#mchat-add .icon {color: inherit}
.mchat-wrapper .mchat-input-control button:focus-visible {outline: 2px solid var(--accent); outline-offset: 2px}
.mchat-wrapper .mchat-panel-buttons {flex-wrap: wrap; margin: 0; gap: 5px}
.mchat-wrapper .mchat-panel-buttons .button {margin: 0; min-width: 36px; color: var(--text); background: var(--surface)}
.mchat-wrapper .mchat-panel-buttons .button:hover, .mchat-wrapper .mchat-button-is-down {color: var(--accent); border-color: var(--accent)}
#mchat-confirm textarea {background-color: var(--floor); color: var(--text); border: 1px solid var(--border); border-radius: 5px}
.mchat-wrapper #mchat-exceed-character-count {color: #ffad9c}
@media (max-width: 700px) {
    .dg-hot-list > li {display: grid; grid-template-columns: minmax(0,1fr); gap: 2px; padding: 9px 12px}
    .dg-hot h2, .dg-hot h3, .mchat-wrapper .mchat-header li.header dt .list-inner {padding: 10px 12px}
    .mchat-wrapper #mchat-panel {padding: 9px}
    .mchat-wrapper .mchat-controls {flex-direction: column}
    .mchat-wrapper .mchat-input-container {flex: none; width: 100%}
    .mchat-wrapper #mchat-panel .mchat-panel-buttons {align-self: flex-start; margin: 0 !important}
    .mchat-wrapper .mchat-header .mchat-title {display: inline-block}
    .mchat-wrapper #mchat-input {font-size: 16px}
}
@media (prefers-reduced-motion: reduce) {
    .mchat-wrapper .mchat-message-flash {animation: none}
}

#recovery-email-help {
    display: block;
    max-width: 42em;
    margin-top: .45em;
    color: var(--soft);
    line-height: 1.45;
}

.dg-community-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}
.dg-community-top:not(:has(> *)) {display: none}
.dg-community-top > * {min-width: 0}
.dg-community-top .dg-hot, #phpbb .dg-top-chat .mchat-wrapper {margin: 0}
.dg-community-top .dg-hot-list > li {display: grid; gap: 1px; padding: 6px 14px}
@media (min-width: 850px) {
    .dg-community-top:has(.dg-top-chat):has(.dg-hot) {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }
    #phpbb .dg-top-chat .mchat-wrapper {height: 100%; box-sizing: border-box}
}

@media (max-width: 700px) {
    #phpbb .dg-top-chat #mchat-messages {
        height: auto;
        max-height: 250px;
        overflow-y: auto;
    }
    #login input.inputbox.autowidth, #register input.inputbox.autowidth {
        box-sizing: border-box;
        /* The inherited autowidth utility sets width with !important. */
        width: 100% !important;
        max-width: 100%;
    }
}

/* Main heading and conversation */
.dg-hero {min-height: clamp(145px, 14vw, 180px); margin-bottom: 16px;}
.dg-hero-copy p {margin-bottom: 0;}
.mchat-wrapper .mchat-title {display: inline-flex; align-items: center; gap: 9px;}
.mchat-title .fa-comments-o {color: var(--aqua);}
.mchat-wrapper .dg-avatar-letter {
    display: grid; place-items: center; width: 36px; height: 36px;
    border-radius: 50%; background: #304342; color: #c7e3df;
    font: 650 1.05rem/1 var(--heading);
}
.mchat-wrapper .mchat-avatar img {border-radius: 50%; object-fit: cover;}
.mchat-wrapper .mchat-message-wrapper {padding-inline-start: 5px;}
.mchat-wrapper .mchat-message-header {margin-bottom: 5px;}
.mchat-wrapper .mchat-message .mchat-text {
    width: fit-content; max-width: 100%; padding: 7px 11px;
    background: #253033; border-radius: 2px 10px 10px;
}
.mchat-wrapper .dg-chat-join {
    display: flex; align-items: center; gap: 9px; min-height: 44px;
    padding: 0 15px; border-top: 1px solid var(--border); color: var(--aqua);
    font-weight: 600;
}
.mchat-wrapper .dg-chat-join:focus-visible, #mchat-messages:focus-visible {
    outline: 2px solid var(--accent); outline-offset: -3px;
}
.mchat-wrapper #mchat-input:focus {outline-offset: -2px;}
@media (max-width: 520px) {
    .dg-hero {min-height: 0; margin-bottom: 12px; padding: 18px 15px;}
    .dg-hero-copy p {max-width: 100%; margin-top: 8px;}
}
