/* リセット */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基本スタイル */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f8fa;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1da1f2;
    margin-bottom: 10px;
}

.subtitle {
    color: #657786;
    font-size: 1.1rem;
}

/* メインコンテンツ */
main {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

/* 入力セクション */
.input-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e1e8ed;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #14171a;
}

.input-wrapper {
    display: flex;
    gap: 10px;
}

input[type="url"] {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ccd6dd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

input[type="url"]:focus {
    outline: none;
    border-color: #1da1f2;
}

#preview-btn {
    padding: 12px 24px;
    background-color: #1da1f2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

#preview-btn:hover {
    background-color: #1a91da;
}

#preview-btn:active {
    transform: translateY(1px);
}

.hint {
    display: block;
    margin-top: 8px;
    color: #657786;
    font-size: 14px;
}

/* オプション */
.options {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #14171a;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* プレビューセクション */
.preview-section {
    margin-bottom: 30px;
}

.preview-section h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #14171a;
}

.preview-container {
    min-height: 300px;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 20px;
    background-color: #fff;
}

/* 空の状態 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    color: #657786;
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
    text-align: center;
}

/* ローディング状態 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1da1f2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* エラー状態 */
.error-state {
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #c33;
}

/* 埋め込みツイート */
.twitter-embed {
    display: flex;
    justify-content: center;
    margin: 0 auto;
}

.twitter-embed > div {
    max-width: 550px;
    width: 100%;
}

/* ダークテーマ */
body.dark-theme {
    background-color: #15202b;
    color: #fff;
}

body.dark-theme .container {
    color: #fff;
}

body.dark-theme main {
    background-color: #192734;
}

body.dark-theme .preview-container {
    background-color: #192734;
    border-color: #38444d;
}

body.dark-theme input[type="url"] {
    background-color: #253341;
    border-color: #38444d;
    color: #fff;
}

body.dark-theme input[type="url"]:focus {
    border-color: #1da1f2;
}

body.dark-theme .empty-state,
body.dark-theme .hint {
    color: #8899a6;
}

body.dark-theme h1,
body.dark-theme h2,
body.dark-theme label,
body.dark-theme .checkbox-label {
    color: #fff;
}

/* 情報セクション */
.info-section {
    margin-top: 30px;
}

.info-section h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
    color: #14171a;
}

.info-section h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #14171a;
}

.info-section ol {
    margin-left: 20px;
    margin-bottom: 16px;
}

.info-section li {
    margin-bottom: 8px;
    color: #14171a;
}

.supported-services {
    margin: 20px 0;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.supported-services ul {
    margin-left: 20px;
}

.supported-services li {
    margin-bottom: 6px;
}

.note {
    background-color: #f0f8ff;
    border-left: 4px solid #1da1f2;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
}

body.dark-theme .info-section h2,
body.dark-theme .info-section h3,
body.dark-theme .info-section li {
    color: #fff;
}

body.dark-theme .supported-services {
    background-color: #253341;
}

body.dark-theme .note {
    background-color: #1e3a4c;
    color: #fff;
}

/* フッター */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    color: #657786;
}

body.dark-theme footer {
    color: #8899a6;
}

/* 動画埋め込み */
.video-embed {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

.video-embed iframe {
    border-radius: 8px;
}

/* Instagram埋め込み */
.instagram-embed {
    max-width: 540px;
    margin: 0 auto;
}

/* TikTok埋め込み */
.tiktok-embed {
    max-width: 605px;
    margin: 0 auto;
}

/* フォールバック */
.fallback-embed {
    text-align: center;
    padding: 40px 20px;
}

.view-original-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #1da1f2;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.view-original-btn:hover {
    background-color: #1a91da;
}

/* IRIAM埋め込み */
.iriam-embed {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.iriam-embed iframe {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* IRIAMプレビューカード */
.iriam-preview-card {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    max-width: 500px;
    margin: 0 auto;
}

.iriam-logo {
    margin-bottom: 20px;
}

.iriam-logo svg {
    opacity: 0.9;
}

.iriam-preview-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.live-id,
.user-id {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 20px;
    font-family: monospace;
}

.preview-note {
    margin-bottom: 30px;
    line-height: 1.6;
    opacity: 0.95;
}

.iriam-preview-card .view-original-btn {
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    padding: 12px 30px;
    font-weight: 600;
}

.iriam-preview-card .view-original-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* ダークモード対応 */
body.dark-theme .iriam-embed iframe {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-theme .iriam-preview-card {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

/* IRIAMユーザーカード専用スタイル */
.iriam-user-card {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

body.dark-theme .iriam-user-card {
    background: linear-gradient(135deg, #c44569 0%, #a8456c 100%);
}

/* リッチプレビューカード */
.rich-preview-card {
    position: relative;
    display: flex;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    max-width: 600px;
    margin: 0 auto;
    transition: box-shadow 0.2s;
}

.rich-preview-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.preview-image {
    flex-shrink: 0;
    width: 160px;
    height: 160px;
    overflow: hidden;
    background: #f5f8fa;
}

.preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.preview-site-name {
    font-size: 12px;
    color: #657786;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-title {
    font-size: 16px;
    font-weight: 600;
    color: #14171a;
    margin: 0 0 8px 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.preview-description {
    font-size: 14px;
    color: #657786;
    margin: 0 0 8px 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.preview-url {
    font-size: 12px;
    color: #657786;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* ダークモード対応 */
body.dark-theme .rich-preview-card {
    background: #192734;
    border-color: #38444d;
}

body.dark-theme .preview-image {
    background: #253341;
}

body.dark-theme .preview-title {
    color: #fff;
}

body.dark-theme .preview-site-name,
body.dark-theme .preview-description,
body.dark-theme .preview-url {
    color: #8899a6;
}

/* プレビューラッパー */
.preview-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

/* OGP詳細 */
.ogp-details {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.ogp-details h4 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    color: #14171a;
}

.ogp-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
}

.ogp-table th,
.ogp-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
}

.ogp-table th {
    background: #f5f8fa;
    font-weight: 600;
    color: #14171a;
    width: 150px;
    font-size: 13px;
}

.ogp-table td {
    color: #657786;
    font-size: 14px;
    word-break: break-all;
}

.ogp-table tr:last-child th,
.ogp-table tr:last-child td {
    border-bottom: none;
}

.image-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-info a {
    color: #1da1f2;
    text-decoration: none;
    word-break: break-all;
}

.image-info a:hover {
    text-decoration: underline;
}

.no-ogp-message {
    text-align: center;
    color: #657786;
    font-style: italic;
    margin-top: 16px;
}

body.dark-theme .no-ogp-message {
    color: #8899a6;
}

.generic-logo {
    margin-bottom: 20px;
}

.generic-logo svg {
    stroke: #657786;
}

.download-btn {
    align-self: flex-start;
    padding: 6px 12px;
    background-color: #1da1f2;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.download-btn:hover {
    background-color: #1a91da;
}

/* BOOTH専用スタイル */
.booth-preview .preview-site-name {
    color: #ff6b6b;
}

.booth-logo {
    margin-bottom: 20px;
}

.booth-logo svg {
    stroke: #ff6b6b;
}

/* ダークモード対応 */
body.dark-theme .ogp-details {
    background: #192734;
}

body.dark-theme .ogp-details h4 {
    color: #fff;
}

body.dark-theme .ogp-table {
    background: #253341;
}

body.dark-theme .ogp-table th {
    background: #192734;
    color: #fff;
}

body.dark-theme .ogp-table td {
    color: #8899a6;
    border-bottom-color: #38444d;
}

body.dark-theme .ogp-table tr:last-child td {
    border-bottom: none;
}

/* モバイル対応 */
@media (max-width: 480px) {
    .rich-preview-card {
        flex-direction: column;
    }
    
    .preview-image {
        width: 100%;
        height: 200px;
    }
    
    .ogp-table th {
        width: 100px;
        font-size: 12px;
    }
    
    .ogp-table td {
        font-size: 13px;
    }
}

/* レスポンシブ */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .input-wrapper {
        flex-direction: column;
    }
    
    #preview-btn {
        width: 100%;
    }
    
    .options {
        flex-direction: column;
        gap: 12px;
    }
}