* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Comic Sans MS', 'Yusei Magic', 'M PLUS Rounded 1c', sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #a8e6cf, #1a91ff);
    overflow: hidden;
    position: relative;
}

/* アニメーション付き背景要素 */
.floating-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
    z-index: 0;
    animation: float 15s infinite ease-in-out;
}

.shape1 {
    width: 100px;
    height: 100px;
    background-color: #8ee3c8;
    top: 15%;
    left: 10%;
    animation-delay: 0s;
}

.shape2 {
    width: 150px;
    height: 150px;
    background-color: #7dcfff;
    bottom: 20%;
    right: 15%;
    animation-delay: 2s;
}

.shape3 {
    width: 80px;
    height: 80px;
    background-color: #b9ffb7;
    top: 60%;
    left: 20%;
    animation-delay: 4s;
}

.shape4 {
    width: 120px;
    height: 120px;
    background-color: #5fb8ff;
    top: 30%;
    right: 25%;
    animation-delay: 6s;
}

.shape5 {
    width: 70px;
    height: 70px;
    background-color: #88d8c0;
    bottom: 15%;
    left: 30%;
    animation-delay: 8s;
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(10deg);
    }
    100% {
        transform: translateY(0) rotate(0deg);
    }
}

/* 背景の泡アニメーション */
.bubbles {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    top: 0;
    left: 0;
}

.bubble {
    position: absolute;
    bottom: -100px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    opacity: 0.5;
    animation: rise 15s infinite ease-in;
}

.bubble:nth-child(1) {
    width: 40px;
    height: 40px;
    left: 10%;
    animation-duration: 12s;
}

.bubble:nth-child(2) {
    width: 20px;
    height: 20px;
    left: 20%;
    animation-duration: 16s;
    animation-delay: 1s;
}

.bubble:nth-child(3) {
    width: 50px;
    height: 50px;
    left: 35%;
    animation-duration: 14s;
    animation-delay: 2s;
}

.bubble:nth-child(4) {
    width: 30px;
    height: 30px;
    left: 50%;
    animation-duration: 18s;
    animation-delay: 3s;
}

.bubble:nth-child(5) {
    width: 25px;
    height: 25px;
    left: 65%;
    animation-duration: 13s;
    animation-delay: 4s;
}

.bubble:nth-child(6) {
    width: 45px;
    height: 45px;
    left: 80%;
    animation-duration: 15s;
    animation-delay: 5s;
}

@keyframes rise {
    0% {
        bottom: -100px;
        transform: translateX(0);
    }
    50% {
        transform: translateX(100px);
    }
    100% {
        bottom: 1080px;
        transform: translateX(-200px);
    }
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.7);
    position: relative;
    z-index: 10;
    animation: appear 1s ease-out;
}

@keyframes appear {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-title {
    text-align: center;
    margin-bottom: 1.8rem;
    font-size: 2.2rem;
    color: #4361ee;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    /* アニメーションを削除 */
}

.login-form {
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 1.2rem;
    position: relative;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #3a7ca5;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s;
}

input {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 3px solid #a8e6cf;
    border-radius: 16px;
    font-size: 1rem;
    transition: all 0.3s;
    background-color: rgba(255, 255, 255, 0.8);
}

input:focus {
    outline: none;
    border-color: #2a9d8f;
    box-shadow: 0 0 15px rgba(42, 157, 143, 0.3);
    background-color: white;
}

.login-button {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(45deg, #02b27a, #4361ee);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.4);
    position: relative;
    overflow: hidden;
}

.login-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.6);
}

.login-button:active {
    transform: translateY(0);
}

.login-button::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.login-button:hover::after {
    transform: translateX(100%);
}

.divider {
    display: flex;
    align-items: center;
    margin: 1.8rem 0;
    color: #3a7ca5;
    font-size: 1.1rem;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 3px;
    background: linear-gradient(to right, #a8e6cf, #4361ee);
    border-radius: 3px;
}

.divider::before {
    margin-right: 1rem;
}

.divider::after {
    margin-left: 1rem;
}

.register-link {
    text-align: center;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    transition: all 0.3s;
    border: 2px dashed #a8e6cf;
}

.register-link:hover {
    background-color: rgba(255, 255, 255, 0.9);
    transform: scale(1.03);
}

.register-link a {
    color: #4361ee;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    display: block;
    transition: all 0.3s;
}

.register-link a:hover {
    color: #2a9d8f;
    transform: scale(1.05);
}

/* エラーメッセージのスタイル */
.error-message {
    background-color: rgba(255, 99, 71, 0.2);
    border-left: 4px solid #ff6347;
    color: #d32f2f;
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* スレッド一覧ページのスタイル */
.page-container {
    width: 100%;
    max-width: 800px;
    padding: 2.5rem;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.7);
    position: relative;
    z-index: 10;
    animation: appear 1s ease-out;
    margin: 2rem;
    max-height: 90vh;
    overflow-y: auto;
}

.page-title {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 2.2rem;
    color: #4361ee;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.user-status {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1.5rem;
}

.logout-link {
    color: #4361ee;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.5);
}

.logout-link:hover {
    background-color: rgba(255, 255, 255, 0.8);
    color: #2a9d8f;
}

.back-link {
    color: #3a7ca5;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    margin-bottom: 1.5rem;
    display: inline-block;
}

.back-link:hover {
    color: #2a9d8f;
    text-decoration: underline;
}

.new-thread-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: rgba(125, 207, 255, 0.15);
    border-radius: 16px;
    border: 2px dashed #a8e6cf;
}

.section-title {
    margin-bottom: 1rem;
    color: #2a9d8f;
    font-size: 1.3rem;
    font-weight: 600;
}

.thread-form {
    display: flex;
    flex-direction: column;
}

.create-button {
    align-self: flex-start;
    padding: 0.7rem 1.5rem;
    background: linear-gradient(45deg, #02b27a, #4361ee);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.create-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(67, 97, 238, 0.4);
}

.thread-list {
    list-style: none;
    padding: 0;
}

.thread-item {
    margin-bottom: 1rem;
    padding: 1.2rem;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    border: 2px solid #a8e6cf;
    border-left: 4px solid #4361ee;
    transition: all 0.2s;
    cursor: pointer;
}

.thread-item:hover {
    transform: translateX(5px);
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: #7dcfff;
}

.thread-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #3a7ca5;
    margin-bottom: 0.5rem;
}

.thread-title a {
    color: #3a7ca5;
    text-decoration: none;
    transition: all 0.2s;
}

.thread-title a:hover {
    color: #2a9d8f;
    text-decoration: underline;
}

.thread-creator {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0.3rem;
}

.thread-date {
    font-size: 0.8rem;
    color: #8a8a8a;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .page-container {
        padding: 1.5rem;
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .thread-form {
        flex-direction: column;
    }
    
    .create-button {
        align-self: stretch;
        margin-top: 0.5rem;
    }
    
    .user-status {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .logout-link {
        margin-top: 0.5rem;
    }
}

/* エラーメッセージのアニメーション追加 */
.error-message {
    animation: shake 0.5s ease-in-out;
}

/* スレッド閲覧ページ用のスタイル */
.thread-header {
    margin-bottom: 1.5rem;
}

.thread-meta {
    color: #3a7ca5;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: rgba(125, 207, 255, 0.15);
    border-radius: 16px;
    border: 2px dashed #a8e6cf;
}

.post-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 3px solid #a8e6cf;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    background-color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s;
}

.post-textarea:focus {
    outline: none;
    border-color: #2a9d8f;
    box-shadow: 0 0 15px rgba(42, 157, 143, 0.3);
    background-color: white;
}

.file-input-container {
    margin-bottom: 1rem;
}

.file-input-label {
    display: inline-block;
    padding: 0.6rem 1rem;
    background-color: rgba(255, 255, 255, 0.6);
    border: 2px solid #a8e6cf;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.file-input-label:hover {
    background-color: rgba(255, 255, 255, 0.8);
    border-color: #7dcfff;
}

.file-input {
    display: none;
}

.file-name {
    margin-left: 0.5rem;
    font-size: 0.9rem;
    color: #3a7ca5;
}

.post-button {
    padding: 0.7rem 1.5rem;
    background: linear-gradient(45deg, #02b27a, #4361ee);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.post-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(67, 97, 238, 0.4);
}

.template-section {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.template-select {
    flex-grow: 1;
    padding: 0.6rem;
    border: 2px solid #a8e6cf;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.8);
    color: #3a7ca5;
    font-size: 0.95rem;
}

.template-select:focus {
    outline: none;
    border-color: #2a9d8f;
}

.template-link {
    color: #4361ee;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.template-link:hover {
    color: #2a9d8f;
    text-decoration: underline;
}

.post-list {
    margin-top: 2rem;
}

.post-item {
    margin-bottom: 1.2rem;
    padding: 1.2rem;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    border: 2px solid #a8e6cf;
    transition: all 0.2s;
}

.post-item:hover {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.post-author {
    font-weight: 600;
    color: #3a7ca5;
    margin-bottom: 0.5rem;
}

.post-content {
    margin-bottom: 0.8rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.post-file {
    margin-bottom: 0.5rem;
}

.post-file a {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.8rem;
    background-color: rgba(168, 230, 207, 0.3);
    border-radius: 6px;
    color: #2a9d8f;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.post-file a:hover {
    background-color: rgba(168, 230, 207, 0.5);
}

.post-date {
    font-size: 0.8rem;
    color: #8a8a8a;
    text-align: right;
}

.login-prompt {
    padding: 1.5rem;
    background-color: rgba(125, 207, 255, 0.15);
    border-radius: 16px;
    text-align: center;
    margin-bottom: 2rem;
}

.login-prompt a {
    color: #4361ee;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.login-prompt a:hover {
    color: #2a9d8f;
    text-decoration: underline;
}

/* テンプレート管理ページのスタイル */
.template-form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: rgba(125, 207, 255, 0.15);
    border-radius: 16px;
    border: 2px dashed #a8e6cf;
}

.template-form {
    display: flex;
    flex-direction: column;
}

.template-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 3px solid #a8e6cf;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
    background-color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1rem;
}

.template-textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 3px solid #a8e6cf;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    background-color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s;
}

.template-input:focus,
.template-textarea:focus {
    outline: none;
    border-color: #2a9d8f;
    box-shadow: 0 0 15px rgba(42, 157, 143, 0.3);
    background-color: white;
}

.save-button {
    align-self: flex-start;
    padding: 0.7rem 1.5rem;
    background: linear-gradient(45deg, #02b27a, #4361ee);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.save-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(67, 97, 238, 0.4);
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.template-item {
    padding: 1.2rem;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    border: 2px solid #a8e6cf;
    transition: all 0.2s;
}

.template-item:hover {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.template-title {
    color: #3a7ca5;
    font-size: 1.2rem;
    margin: 0;
}

.template-actions {
    display: flex;
    gap: 0.5rem;
}

.edit-button,
.delete-button {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-button {
    background-color: rgba(168, 230, 207, 0.4);
    border: 1px solid #a8e6cf;
    color: #2a9d8f;
}

.edit-button:hover {
    background-color: rgba(168, 230, 207, 0.6);
}

.delete-button {
    background-color: rgba(255, 99, 71, 0.1);
    border: 1px solid rgba(255, 99, 71, 0.3);
    color: #d32f2f;
    text-decoration: none;
    display: inline-block;
}

.delete-button:hover {
    background-color: rgba(255, 99, 71, 0.2);
}

.template-content {
    white-space: pre-wrap;
    line-height: 1.5;
    color: #555;
    font-size: 0.95rem;
    background-color: rgba(255, 255, 255, 0.5);
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.no-templates {
    text-align: center;
    padding: 1.5rem;
    color: #6c757d;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    border: 1px dashed #ccc;
}

@media (max-width: 768px) {
    .template-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .template-actions {
        margin-top: 0.5rem;
    }
    
    .save-button {
        align-self: stretch;
    }
}