* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    max-width: 700px;
    margin: 0 auto;
    padding: 15px 15px 10px;
    background: #f5f7fa;
    line-height: 1.5;
    font-size: 15px;
}

.header {
    background: #3498db;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    box-shadow: 0 8px 32px rgba(52, 152, 219, 0.2);
    position: relative;
    text-align: center;
}

.header-content {
    max-width: 100%;
}

.header h1 {
    margin: 0 0 3px 0;
    font-size: 1.6rem;
    font-weight: 700;
}

.header p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

.github-link {
    position: absolute;
    top: 10px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.github-link:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.github-link svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.generator {
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 4px 20px rgba(44, 62, 80, 0.1);
    border: 1px solid #e8eaed;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

/* メイン入力欄（VimeoURL）の強調スタイル */
.form-group.primary label {
    font-size: 15px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 6px;
}

.form-group.primary input[type="url"] {
    padding: 12px 16px;
    border: 3px solid #3498db;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
    transition: all 0.3s ease;
}

.form-group.primary input[type="url"]:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.25);
    transform: translateY(-1px);
}

.form-group.primary input[type="url"]::placeholder {
    color: #7fb3d3;
    opacity: 0.8;
}

/* サブ入力欄の控えめなスタイル */
.form-group.secondary label {
    font-size: 13px;
    font-weight: 500;
    color: #5a6c7d;
    opacity: 0.9;
}

.form-group input[type="url"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s ease;
    background: #fafbfc;
}

.form-group input[type="url"] {
    font-size: 16px;
}

.form-group input[type="number"] {
    font-size: 13px;
}

.form-group select option {
    font-size: 13px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.generate-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.generate-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.generate-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.preview-section,
.code-section {
    background: white;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 6px;
    box-shadow: 0 4px 20px rgba(44, 62, 80, 0.1);
    border: 1px solid #e8eaed;
}

.code-section {
    margin-top: 2px;
}

.preview-section h2,
.code-section h2,
.code-section h3 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 1.05rem;
}

.code-section h3 {
    font-size: 0.9rem;
    margin: 0 0 6px 0;
    font-weight: 600;
}

.preview-area {
    border: 2px dashed #95a5a6;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    /* スマホでのタッチ操作最適化 */
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

.preview-area:has(div:not(.placeholder)) {
    background: white;
    border: 2px solid #3498db;
    /* ターンテーブル表示時の最適化 */
    padding: 10px;
    text-align: center;
    align-items: center;
    justify-content: center;
}

.placeholder {
    color: #6c757d;
    font-style: italic;
}

.code-display {
    background: #0d1117;
    color: #f0f6fc;
    border: 1px solid #30363d;
    padding: 0;
    border-radius: 8px;
    position: relative;
    box-sizing: border-box;
    max-height: 120px;
    overflow-y: auto;
    font-size: 12px;
}

.code-display pre {
    margin: 0;
    padding: 16px;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
    line-height: 1.45;
    word-wrap: normal;
    white-space: pre;
}

.code-display code {
    background: transparent;
    color: inherit;
    font-size: inherit;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    display: block;
}

.code-display #codeContent {
    margin: 0;
    padding: 0;
    display: block;
    color: #f0f6fc;
}

.code-display::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.code-display::-webkit-scrollbar-track {
    background: #0d1117;
    border-radius: 8px;
}

.code-display::-webkit-scrollbar-thumb {
    background: #484f58;
    border-radius: 8px;
    border: 2px solid #0d1117;
}

.code-display::-webkit-scrollbar-thumb:hover {
    background: #6e7681;
}

#codeContent {
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
    padding: 0;
    line-height: 1.4;
    min-height: 1em;
    border: none;
    outline: none;
    color: inherit;
}

.copy-btn {
    position: sticky;
    top: 8px;
    right: 8px;
    float: right;
    margin-bottom: -40px;
    background: #21262d;
    color: #f0f6fc;
    border: 1px solid #30363d;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.copy-btn:hover {
    background: #30363d;
    border-color: #6e7681;
}

.copy-success {
    background: rgba(34, 197, 94, 0.2) !important;
    color: #22c55e !important;
    border-color: rgba(34, 197, 94, 0.4) !important;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2) !important;
}

.error {
    color: #c0392b;
    background: #fadbd8;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 10px;
}

.help {
    background: #bee3f8;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid #3182ce;
    font-size: 14px;
    line-height: 1.4;
}

/* helpセクションのタイトルと説明文のスタイル分離 */
.help-title {
    display: block;
    font-size: 1em;
    font-weight: bold;
    margin-bottom: 2px;
    color: #2a3a4a;
    letter-spacing: 0.05em;
}

.help-desc {
    display: block;
    font-size: 0.9em;
    color: #444;
    line-height: 1.7;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 14px;
    }

    .header {
        padding: 12px 16px;
        position: relative;
        margin-bottom: 6px;
    }

    .header h1 {
        font-size: 1.3rem;
        margin-right: 60px;
        /* GitHubリンクのための余白確保 */
    }

    .header p {
        font-size: 0.75rem;
    }

    .github-link {
        position: absolute;
        top: 8px;
        right: 12px;
        font-size: 11px;
        gap: 4px;
        padding: 4px 6px;
    }

    .github-link svg {
        width: 12px;
        height: 12px;
    }

    .generator,
    .preview-section,
    .code-section {
        padding: 10px;
        margin-bottom: 5px;
    }

    .code-section {
        margin-top: 1px;
    }

    .help {
        padding: 6px 10px;
        font-size: 12px;
        line-height: 1.3;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    /* モバイルでのメイン入力欄調整 */
    .form-group.primary input[type="url"] {
        padding: 10px 14px;
        font-size: 16px;
        /* iOS zoom防止 */
    }

    .form-group.secondary label {
        font-size: 12px;
    }

    /* プレビューエリアのモバイル対応 */
    .preview-area {
        padding: 8px;
        /* モバイルでのタッチ最適化 */
        touch-action: manipulation;
    }

    .preview-area:has(div:not(.placeholder)) {
        padding: 5px;
        align-items: center;
    }

    /* モバイルでのコード表示調整 */
    .code-display {
        max-height: 80px;
        font-size: 11px;
    }

    .code-display pre {
        padding: 12px;
        font-size: 11px;
    }

    .copy-btn {
        top: 6px;
        right: 6px;
        padding: 4px 8px;
        font-size: 11px;
    }

    .code-section h3 {
        font-size: 0.85rem;
        margin: 0 0 5px 0;
    }
}

/* 小さなスマホ画面向け追加調整 */
@media (max-width: 480px) {
    .header {
        margin-bottom: 5px;
    }

    .header h1 {
        font-size: 1.1rem;
        margin-right: 55px;
        line-height: 1.3;
    }

    .header p {
        font-size: 0.7rem;
        margin-top: 2px;
    }

    .github-link {
        top: 6px;
        right: 8px;
        font-size: 10px;
        gap: 3px;
        padding: 3px 5px;
    }

    .github-link svg {
        width: 10px;
        height: 10px;
    }

    .form-row {
        gap: 6px;
    }

    .generator,
    .preview-section,
    .code-section {
        margin-bottom: 4px;
        padding: 8px;
    }

    .code-section h3 {
        font-size: 0.8rem;
        margin: 0 0 4px 0;
    }
}