
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 0;
    padding: 0;
    background-color: #fafafa;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ヘッダー */
.header {
    background-color: #fff;
    border-bottom: 2px solid #3498db;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header h1 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
}

.header a {
    background-color: #3498db;
    color: white;
    padding: 8px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.header a:hover {
    background-color: #2980b9;
}

/* メインコンテナ */
.container {
    flex: 1;
    display: flex;
    overflow: hidden;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

#hint {
    cursor: pointer;
}

/* 左側: エディタエリア */
.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background-color: #fff;
    margin: 20px 10px 20px 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.editor-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
}

.button-group {
    display: flex;
    gap: 10px;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

button:hover:not(:disabled) {
    background-color: #2980b9;
}

button:active:not(:disabled) {
    transform: translateY(1px);
}

button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

button.secondary {
    background-color: #e74c3c;
}

button.secondary:hover:not(:disabled) {
    background-color: #c0392b;
}

#code-editor {
    flex: 1;
    width: 100%;
    padding: 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: none;
    background-color: #2c3e50;
    color: #ecf0f1;
}

#code-editor:focus {
    outline: none;
    border-color: #3498db;
}

/* 右側: 出力エリア */
.output-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background-color: #fff;
    margin: 20px 20px 20px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.output-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
}

#output {
    flex: 1;
    padding: 15px;
    background-color: #ecf8ff;
    border: 1px solid #3498db;
    border-radius: 5px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 変数表示エリア */
.variables-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.variables-section h3 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 16px;
}

#variables-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #555;
    max-height: 150px;
    overflow-y: auto;
}

.variable-item {
    padding: 2px 0;
}

.variable-name {
    color: #e74c3c;
    font-weight: bold;
}

/* サンプル選択 */
.samples-section {
    margin-bottom: 15px;
}

.samples-section label {
    margin-right: 10px;
    font-weight: bold;
    color: #2c3e50;
}

#sample-select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

/* エラー表示 */
.error {
    background-color: #ffe6e6;
    border-left: 4px solid #e74c3c;
    padding: 10px;
    margin: 10px 0;
    font-weight: bold;
}

/* 成功メッセージ */
.success {
    background-color: #e6ffe6;
    border-left: 4px solid #27ae60;
    padding: 10px;
    margin: 10px 0;
}

/* モバイル対応 */
@media (max-width: 800px) {
    .container {
        flex-direction: column;
        overflow: scroll;
    }

    #code-editor {
        min-height: 250px;
    }

    .editor-section,
    .output-section {
        margin: 10px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    button {
        padding: 8px 15px;
        font-size: 14px;
    }
}

/* ローディング */
.loading {
    opacity: 0.6;
    pointer-events: none;
}
