:root {
    --primary-green: #a8e6cf;
    --secondary-green: #88d8a3;
    --accent-green: #7fcdcd;
    --light-green: #dcedc1;
    --text-dark: #2d3436;
    --text-light: #636e72;
    --border-light: #e8f5e8;
    --error-bg: rgba(255, 107, 107, 0.2);
    --error-text: #d63031;
    --shadow: 0 2px 8px rgba(168, 230, 207, 0.3);
    --shadow-hover: 0 4px 16px rgba(168, 230, 207, 0.4);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f8fbf8 0%, #e8f5e8 100%);
    color: var(--text-dark);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 24px;
}

.header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-dark);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.content-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 32px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border: 1px solid var(--border-light);
}

.title-section {
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 16px;
}

.title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    background: var(--light-green);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    flex-wrap: wrap;
}

.stats.error {
    background: var(--error-bg);
}

.stats-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stats-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-light);
}

.char-count.error {
    color: var(--error-text);
    font-weight: 600;
}

.body-container {
    position: relative;
    flex: 1;
    min-height: 300px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.body-content {
    width: 100%;
    height: 100%;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    background: #f8fffe;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    overflow-y: auto;
    max-height: 500px;
}

.exceed {
    background-color: var(--error-bg);
    border-radius: 3px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.copy-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
    color: var(--text-dark);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.copy-btn:active {
    transform: translateY(0);
}

.edit-section {
    border-top: 2px solid var(--border-light);
    padding-top: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.edit-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    max-width: 300px;
}

.form-group label {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
}

.form-input {
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #fafafa;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(168, 230, 207, 0.2);
    background: white;
}

.edit-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent-green), var(--secondary-green));
    color: var(--text-dark);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    white-space: nowrap;
}

.edit-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.edit-btn:active {
    transform: translateY(0);
}

.edit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.hidden {
    display: none !important;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
}

.modal h2 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
}

.modal p {
    margin: 0 0 20px 0;
    color: var(--text-light);
    text-align: center;
    line-height: 1.5;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
    color: var(--text-dark);
}

.modal-btn.secondary {
    background: #f8f9fa;
    color: var(--text-light);
    border: 1px solid var(--border-light);
}

.modal-btn:hover {
    transform: translateY(-1px);
}

.error-message {
    color: var(--error-text);
    font-size: 12px;
    margin-top: 8px;
    text-align: center;
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-light);
    border-radius: 50%;
    border-top-color: var(--primary-green);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .content-card {
        padding: 24px;
    }

    .header h1 {
        font-size: 24px;
    }

    .title {
        font-size: 20px;
    }

    .stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .stats-left, .stats-right {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .body-content {
        font-size: 13px;
    }

    .edit-section {
        flex-direction: column;
        align-items: stretch;
    }

    .edit-form {
        flex-direction: column;
    }

    .form-group {
        max-width: none;
    }

    .modal {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .content-card {
        padding: 20px;
    }

    .header h1 {
        font-size: 20px;
    }

    .modal-buttons {
        flex-direction: column;
    }
}

.home-link {
    color: inherit;
    text-decoration: none;
}

.home-link:hover {
    text-decoration: underline;
}

.header h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-dark);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Share button styles */
.share-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Share modal styles */
.share-url-container {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.share-url-container .form-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.share-social-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: white;
}

.share-social-btn.twitter {
    background: #1da1f2;
}

.share-social-btn.twitter:hover {
    background: #0d8bd9;
}

.share-social-btn.facebook {
    background: #1877f2;
}

.share-social-btn.facebook:hover {
    background: #166fe5;
}

.share-social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 関連リンク機能のCSS */

/* 関連リンクのラベル */
.related-list + label,
label[for="relatedList"] {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
    display: block;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 8px;
}

/* 関連リンクのリスト */
.related-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: linear-gradient(135deg, #f8fbf8 0%, #f0f8f0 100%);
    border-radius: 12px;
    border: 2px solid var(--border-light);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}

/* 関連リンクのリストアイテム */
.related-list li {
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    min-height: 40px;
}

/* 関連リンクのリンク */
.related-list a {
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
    display: block;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    text-align: left;
}

/* リンクアイコン */
.related-list a::before {
    content: "🔗";
    margin-right: 8px;
    font-size: 12px;
    opacity: 0.7;
}

/* ホバー効果 */
.related-list a:hover {
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    border-color: var(--secondary-green);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

/* アクティブ状態 */
.related-list a:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 関連リンクがない場合のメッセージ */
.related-list li:only-child {
    color: var(--text-light);
    font-style: italic;
    font-size: 14px;
    text-align: center;
    padding: 20px;
    background: none;
    border: none;
    box-shadow: none;
}

/* 関連リンクがない場合の特別なスタイル */
.related-list li:only-child::before {
    content: "";
    margin-right: 8px;
    opacity: 0.5;
}

/* 空の状態でのリスト */
.related-list:empty::after {
    content: "📝 関連プレイングはありません";
    color: var(--text-light);
    font-style: italic;
    font-size: 14px;
    text-align: center;
    padding: 20px;
    display: block;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .related-list {
        padding: 12px;
        gap: 6px;
    }

    .related-list a {
        padding: 8px 12px;
        font-size: 13px;
    }

    .related-list + label,
    label[for="relatedList"] {
        font-size: 14px;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .related-list {
        padding: 10px;
    }

    .related-list a {
        padding: 6px 10px;
        font-size: 12px;
    }

    .related-list + label,
    label[for="relatedList"] {
        font-size: 13px;
        margin-bottom: 8px;
    }
}

/* フォーカス状態（アクセシビリティ） */
.related-list a:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    border-color: var(--secondary-green);
}

/* アニメーション効果 */
.related-list li {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 複数の関連リンクがある場合のスタイリング */
.related-list li:nth-child(even) a {
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
}

.related-list li:nth-child(even) a:hover {
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
}

/* 関連リンクセクション全体のスタイリング */
.related-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid var(--border-light);
}

/* サイドノート（備考）表示 */

.sidenote-section {
    margin-top: 16px;
    padding: 16px 20px;
    border-radius: 12px;
    border: 2px solid var(--border-light);
    background: linear-gradient(135deg, #f8fbf8 0%, #f0f8f0 100%);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidenote-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidenote-title::before {
    content: "📝";
    font-size: 14px;
    opacity: 0.9;
}

.sidenote-body {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-dark);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* モバイルでの余白調整 */
@media (max-width: 768px) {
    .sidenote-section {
        padding: 12px 14px;
    }

    .sidenote-body {
        font-size: 12px;
    }
}
