* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Hiragino Sans', sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    margin-bottom: 1rem;
}

header h1 {
    font-size: 1.4rem;
    color: #1a1a1a;
}

header p {
    font-size: 0.85rem;
    color: #666;
}

.usage {
    margin-top: 0.8rem;
    font-size: 0.85rem;
    color: #444;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 0.5rem 1rem;
}

.usage summary {
    cursor: pointer;
    font-weight: 600;
    color: #333;
}

.usage ol, .usage ul {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.usage li {
    margin-bottom: 0.3rem;
}

.usage code {
    background: #e8e8e8;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.82rem;
}

.toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-separator {
    width: 1px;
    height: 1.5rem;
    background: #ddd;
    margin: 0 0.3rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn:hover {
    background: #f0f0f0;
}

.btn-primary {
    background: #1a73e8;
    color: #fff;
    border-color: #1a73e8;
}

.btn-primary:hover {
    background: #1557b0;
}

.btn-insert {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: #f6f8fa;
    border-color: #ccc;
}

.btn-insert:hover {
    background: #e8ecf0;
}

.editor-wrapper {
    flex: 1;
    min-height: 0;
}

#editor {
    width: 100%;
    height: 100%;
    padding: 1rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    outline: none;
    background: #fff;
    tab-size: 2;
}

#editor:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 0.95rem;
}

.modal-header .close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0 0.5rem;
}

.modal-header .close:hover {
    color: #000;
}

#preview-frame {
    flex: 1;
    border: none;
    width: 100%;
}

/* メッセージ */
.message {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 2000;
    animation: fadeIn 0.3s;
}

.message.success {
    display: block;
    background: #e6f7e6;
    color: #2d7a2d;
    border: 1px solid #b8e6b8;
}

.message.error {
    display: block;
    background: #ffeaea;
    color: #cc3333;
    border: 1px solid #ffcccc;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
