* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: #f4f6f8;
}

.app {
    max-width: 800px;
    height: 100vh;

    margin: auto;

    display: flex;
    flex-direction: column;

    background: white;
}


/* ヘッダー */

header {
    display: flex;
    align-items: center;

    padding: 15px 20px;

    border-bottom: 1px solid #ddd;
}

.logo {
    font-size: 40px;
    margin-right: 10px;
}

h1 {
    margin: 0;
    font-size: 20px;
}

/* サブタイトル(タイトル直下の一言) */
.subtitle {
    margin: 2px 0 0;

    font-size: 11px;
    line-height: 1.4;

    color: #999;
}

.status {
    font-size: 12px;
    color: #4caf50;
}

.status.offline {
    color: #e05c5c;
}

.history-link {
    margin-left: auto;
    font-size: 13px;

    text-decoration: none;

    color: #555;

    background: #f1f1f1;

    padding: 6px 12px;

    border-radius: 15px;
}

.history-link:hover {
    background: #e2e2e2;
}


/* チャット */

main {
    flex: 1;

    overflow-y: auto;

    padding: 20px;
}


/* メッセージ */

.message {
    display: flex;
    align-items: flex-start;

    margin-bottom: 20px;
}

.icon {
    font-size: 28px;

    margin-right: 10px;
}

.bubble {
    padding: 12px 16px;

    border-radius: 15px;

    background: #f1f1f1;

    max-width: 70%;

    /* 改行・空行をそのまま表示する(AIの返答の \n を潰さない) */
    white-space: pre-wrap;

    /* 長い単語・URLも吹き出し内で折り返す */
    word-wrap: break-word;
}

.user {
    flex-direction: column;
    align-items: flex-end;
}

.user .bubble {
    background: #d9fdd3;
}

/* ユーザー名ラベル */
.name {
    display: block;
    font-size: 11px;
    color: #888;
    margin: 0 2px 4px;
    line-height: 1.2;
}

/* システム通知(みっちーがオフライン時など) */
.sysnote {
    margin: 0 auto 16px;

    padding: 6px 14px;

    font-size: 12px;

    color: #8a6d3b;

    background: #fff6df;

    border-radius: 12px;

    width: fit-content;

    max-width: 90%;
}


/* 入力欄 */

footer {
    display: flex;

    padding: 15px;

    border-top: 1px solid #ddd;
}

input {
    flex: 1;

    padding: 12px;

    font-size: 16px;

    border: 1px solid #ccc;

    border-radius: 10px;
}

button {
    margin-left: 10px;

    padding: 0 20px;

    border: none;

    border-radius: 10px;

    cursor: pointer;

    background: #333;

    color: white;
}