* {
    margin: 0;
    padding: 0;
}

html {
    color: #FFF;
    background-color: #111;
}

body {
    display: flex;
    width: 100%;
    height: 100dvh;
}

.hs {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 16px;
}

.vs {
    display: block;
    box-sizing: border-box;
    width: 16px;
    height: 100%;
}

.container {
    display: flex;
    flex-direction: column;
    justify-items: stretch;
    width: 300px;
    margin: auto auto;
}

.error-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 16px;
}

.hero-logo {
    display: block;
    box-sizing: border-box;
    margin: 0 auto;
    width: 66%;
    height: 66%;
}

.hero-label {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 24pt;
    font-weight: 700;
}

.auth-logo {
    display: block;
    box-sizing: border-box;
    margin: 0 auto;
    width: 50%;
    height: 50%;
}

.auth-label {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 20pt;
    font-weight: 700;
}

.button {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 1;
    border: none;
    border-radius: 4px;
    color: #FFF;
    background-color: #50A0F0;
    font-size: 16pt;
    font-weight: 700;
    cursor: pointer;
}

.button:focus {
    color: #EEE;
    background-color: #4595E5;
    outline-color: #70C0F0;
    outline-width: 2px;
}

.button:hover {
    color: #EEE;
    background-color: #4595E5;
}

.button:active {
    color: #CCC;
    background-color: #3585D5;
}

.auth-input {
    aspect-ratio: 4 / 1;
}

.text-input {
    display: block;
    box-sizing: border-box;
    padding-left: 8px;
    margin: auto;
    width: 100%;
    border: none;
    border-radius: 4px;
    background-color: #FFF;
    font-size: 16pt;
    font-weight: 700;
}

.text-input::placeholder {
    color: #777;
}

.text-input:focus {
    background-color: #FFF;
    outline-color: #70C0F0;
    outline-width: 2px;
}

.chats-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.chat-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: 64px;
    background-color: #222;
}

.chat-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.chat-title {
    margin-right: auto;
    font-size: 18pt;
    font-weight: 700;
}

.chat-title:first-child {
    margin-left: 16px;
}

.chat-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: 56px;
    border-bottom-color: #222;
    border-bottom-width: 1px;
    border-bottom-style: solid;
}

.chat-link {
    color: #fff;
    text-decoration: none;
}

.chat-name {
    margin-left: 16px;
    font-size: 14pt;
}

.empty-label {
    display: none;
    width: 100%;
    margin-top: 16px;
    text-align: center;
    font-size: 16pt;
    font-weight: 500;
}

.empty-label:first-child {
    display: initial;
}

.action {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    cursor: pointer;
}

.action img {
    width: 32px;
    height: 32px;
    margin: 0px 16px;
}

.message-list {
    display: flex;
    flex-direction: column-reverse;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.message {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 8px;
}

.message a {
    max-width: 66%;
    max-height: 50vh;
    margin: 0px 16px 8px 16px;
}

.message a img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.align-start {
    align-items: start;
}

.align-end {
    align-items: end;
}

.message:first-child .message-datetime {
    margin-bottom: 0px;
}

.message-username {
    margin: 0px 16px 10px 16px;
    font-size: 14pt;
    font-weight: 700;
}

.message-text {
    margin: 0px 16px 8px 16px;
    padding: 12px 16px 16px 16px;
    font-size: 16pt;
    font-weight: 500;
    word-break: break-word;
    color: #eee;
    max-width: 66%;
    border-radius: 8px;
    list-style-position: inside;
}

.user-message {
    background-color: #4595E5;
}

.friend-message {
    background-color: #222;
}

.message-datetime {
    margin: 0px 16px;
    font-size: 11pt;
    font-weight: 500;
    color: #666;
}

.input-form {
    display: flex;
    flex-direction: row;
}

.input-form .text-input {
    margin: 8px 0px;
    height: 56px;
}

.input-form .text-input:first-child {
    margin-left: 16px;
}

.input-form .button {
    margin: 8px 16px;
    width: 84px;
    height: 56px;
    cursor: pointer;
}

.add-button {
    display: flex;
    box-sizing: border-box;
    position: absolute;
    width: 64px;
    height: 64px;
    bottom: 16px;
    right: 16px;
    border-radius: 16px;
    background-color: #50A0F0;
}

.add-button:focus {
    background-color: #4595E5;
    outline-color: #70C0F0;
    outline-width: 2px;
}

.add-button:hover {
    background-color: #4595E5;
}

.add-button:active {
    background-color: #3585D5;
}

.add-button img {
    width: 66%;
    height: 66%;
    margin: auto;
}

.back-button {
    display: flex;
    box-sizing: border-box;
    position: absolute;
    width: 64px;
    height: 64px;
    left: 16px;
    top: 16px;
}

.back-button img {
    width: 66%;
    height: 66%;
    margin: auto;
}

#load-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.load-more {
    display: block;
    width: 128px;
    height: 40px;
    margin: 16px auto 0px auto;
    border-style: solid;
    border-width: 1px;
    border-radius: 40px;
    border-color: #50A0F0;
    color: #50A0F0;
    background-color: transparent;
    font-size: 16pt;
    font-weight: 500;
}

.load-more:focus {
    color: #4595E5;
    border-color: #4595E5;
    outline-color: #70C0F0;
    outline-width: 2px;
}

.load-more:hover {
    color: #4595E5;
    border-color: #4595E5;
}

.load-more:active {
    color: #3585D5;
    border-color: #3585D5;
}

.version {
    margin: 0px 16px 8px 16px;
    color: #555;
    text-align: end;
    font-size: 12pt;
}

#message-attachment {
    display: none;
}

#attachment-preview {
    display: none;
    align-items: center;
    padding-left: 16px;
    border-color: #555;
    border-style: dashed;
    border-width: 1px;
}

#attachment-filename {
    width: 100%;
}

/* #attachment-preview:has(#attachment-filename:empty) {
    display: none;
} */

.preview {
    width: 100dvw;
    height: 100dvh;
    object-fit: contain;
}

@media screen and (max-width: 600px) {
    .hs {
        height: 12px;
    }
    
    .vs {
        width: 12px;
    }
    
    .container {
        width: 256px;
    }
    
    .hero-label {
        font-size: 20pt;
    }

    .auth-label {
        font-size: 18pt;
    }

    .button {
        font-size: 12pt;
    }

    .text-input {
        font-size: 12pt;
    }

    .chat-header {
        height: 56px;
    }

    .chat-title {
        font-size: 16pt;
    }

    .chat-title:first-child {
        margin-left: 12px;
    }

    .chat-item {
        height: 48px;
    }
    
    .chat-name {
        margin-left: 12px;
        font-size: 13pt;
    }
    
    .empty-label {
        margin-top: 12px;
        font-size: 14pt;
    }

    .action img {
        width: 26px;
        height: 26px;
        margin: 0px 12px;
    }

    .message {
        margin-top: 6px;
    }

    .message a {
        margin: 0px 14px 7px 14px;
    }

    .message a img {
        border-radius: 7px;
    }

    .message-username {
        margin: 0px 14px 8px 14px;
        font-size: 12pt;
    }
    
    .message-text {
        margin: 0px 14px 6px 14px;
        padding: 10px 14px 14px 14px;
        border-radius: 7px;
        font-size: 14pt;
    }
    
    .message-datetime {
        margin: 0px 14px;
        font-size: 10pt;
    }

    .input-form .text-input {
        margin: 6px 0px;
        height: 48px;
    }

    .input-form .text-input:first-child {
        margin-left: 12px;
    }
    
    .input-form .button {
        margin: 6px 12px;
        width: 72px;
        height: 48px;
    }

    .add-button {
        width: 48px;
        height: 48px;
        bottom: 12px;
        right: 12px;
        border-radius: 12px;
    }

    .back-button {
        width: 56px;
        height: 56px;
        left: 12px;
        top: 12px;
    }

    .load-more {
        width: 120px;
        height: 32px;
        margin: 12px auto 4px auto;
        border-radius: 32px;
        font-size: 14pt;
    }

    .version {
        margin: 0px 12px 6px 12px;
        font-size: 11pt;
    }

    #attachment-preview {
        padding-left: 12px;
    }
}

@media screen and (max-width: 400px) {
    .hs {
        height: 10px;
    }
    
    .vs {
        width: 10px;
    }
    
    .container {
        width: 192px;
    }
    
    .hero-label {
        font-size: 18pt;
    }

    .auth-label {
        font-size: 16pt;
    }

    .button {
        font-size: 10pt;
    }

    .text-input {
        font-size: 10pt;
    }

    .chat-header {
        height: 48px;
    }

    .chat-title {
        font-size: 14pt;
    }

    .chat-title:first-child {
        margin-left: 10px;
    }

    .chat-item {
        height: 40px;
    }
    
    .chat-name {
        margin-left: 10px;
        font-size: 12pt;
    }
    
    .empty-label {
        margin-top: 10px;
        font-size: 12pt;
    }

    .action img {
        width: 23px;
        height: 23px;
        margin: 0px 11px;
    }

    .message {
        margin-top: 4px;
    }

    .message a {
        margin: 0px 12px 6px 12px;
    }

    .message a img {
        border-radius: 6px;
    }

    .message-username {
        margin: 0px 12px 6px 12px;
        font-size: 11pt;
    }
    
    .message-text {
        margin: 0px 12px 4px 12px;
        padding: 9px 12px 12px 12px;
        border-radius: 6px;
        font-size: 13pt;
    }
    
    .message-datetime {
        margin: 0px 12px;
        font-size: 9pt;
    }

    .input-form .text-input {
        margin: 5px 0px;
        height: 40px;
    }

    .input-form .text-input:first-child {
        margin-left: 10px;
    }
    
    .input-form .button {
        margin: 5px 10px;
        width: 60px;
        height: 40px;
    }

    .add-button {
        width: 40px;
        height: 40px;
        bottom: 10px;
        right: 10px;
        border-radius: 10px;
    }

    .back-button {
        width: 48px;
        height: 48px;
        left: 10px;
        top: 10px;
    }

    .load-more {
        width: 112px;
        height: 28px;
        margin: 10px auto 4px auto;
        border-radius: 28px;
        font-size: 12pt;
    }

    .version {
        margin: 0px 10px 5px 10px;
        font-size: 10pt;
    }

    #attachment-preview {
        padding-left: 10px;
    }
}

@media screen and (max-width: 240px) {
    .hs {
        height: 8px;
    }
    
    .vs {
        width: 8px;
    }

    .container {
        width: 128px;
    }
    
    .hero-label {
        font-size: 16pt;
    }

    .auth-label {
        font-size: 14pt;
    }

    .button {
        font-size: 8pt;
    }

    .text-input {
        font-size: 8pt;
    }

    .chat-header {
        height: 40px;
    }

    .chat-title {
        font-size: 13pt;
    }

    .chat-title:first-child {
        margin-left: 8px;
    }

    .chat-item {
        height: 32px;
    }
    
    .chat-name {
        margin-left: 8px;
        font-size: 11pt;
    }
    
    .empty-label {
        margin-top: 8px;
        font-size: 11pt;
    }

    .action img {
        width: 20px;
        height: 20px;
        margin: 0px 10px;
    }

    .message {
        margin-top: 4px;
    }

    .message a {
        margin: 0px 10px 5px 10px;
    }

    .message a img {
        border-radius: 5px;
    }

    .message-username {
        margin: 0px 10px 4px 10px;
        font-size: 10pt;
    }
    
    .message-text {
        margin: 0px 10px 4px 10px;
        padding: 7px 10px 10px 10px;
        border-radius: 5px;
        font-size: 12pt;
    }
    
    .message-datetime {
        margin: 0px 10px;
        font-size: 8pt;
    }

    .input-form .text-input {
        margin: 4px 0px;
        height: 32px;
    }

    .input-form .text-input:first-child {
        margin-left: 8px;
    }
    
    .input-form .button {
        margin: 4px 8px;
        width: 48px;
        height: 32px;
    }

    .add-button {
        width: 32px;
        height: 32px;
        bottom: 8px;
        right: 8px;
        border-radius: 8px;
    }

    .back-button {
        width: 40px;
        height: 40px;
        left: 8px;
        top: 8px;
    }
    
    .load-more {
        width: 104px;
        height: 24px;
        margin: 8px auto 4px auto;
        border-radius: 24px;
        font-size: 11pt;
    }

    .version {
        margin: 0px 8px 4px 8px;
        font-size: 9pt;
    }

    #attachment-preview {
        padding-left: 8px;
    }
}
