@import url('https://fonts.googleapis.com/css2?family=Saira:wght@500;700;800;900&family=Noto+Sans+JP:wght@400;700;900&display=swap');

:root {
    --theme-color: #00f2ff;
    --theme-glow: rgba(0, 242, 255, 0.4);
    --font-heading: 'Saira', 'Barlow', 'Inter', sans-serif;
    --font-body: 'Noto Sans JP', 'Saira', 'Barlow', 'Inter', sans-serif;
}

/* デフォルトズーム調整: Chrome の 100% 表示時に全体を縮小して収める */
html {
    /* 値を調整して表示を最適化してください（例: 0.85〜0.95） */
    zoom: 0.45;
}

body {
    font-family: var(--font-body);
    background-color: #0a0a0a;
    color: #ffffff;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== フォント適用 ===== */
.card-brand,
.card-title,
.panel-header h2,
.section-title,
.name-label,
.name-value,
.uid-value,
.info-heading,
.info-label,
.info-value,
.comment-label,
.save-button,
.theme-button,
.checkbox-item label,
.field-group label {
    font-family: var(--font-heading);
}

/* ===== テーマカラー ===== */
.theme-jinzhou { --theme-color: #00f2ff; --theme-glow: rgba(0, 242, 255, 0.4); }
.theme-blackshores { --theme-color: #bc00ff; --theme-glow: rgba(188, 0, 255, 0.4); }
.theme-rinascenter { --theme-color: #ff003c; --theme-glow: rgba(255, 0, 60, 0.4); }
.theme-startorch { --theme-color: #ffcc00; --theme-glow: rgba(245, 158, 11, 0.4); }

/* ===== キャプチャ領域 ===== */
#capture-boundary {
    /* プレビュー全体の余白。デスクトップで画面端寄せにするため小さめに */
    padding: 16px 12px 12px 12px;
    background: transparent;
    display: inline-block;
}

/* レイアウト調整: 編集パネルとプレビューを左右に並べる */
#main-grid {
    min-height: calc(100vh - 96px); /* body の py-12 を考慮して高さを確保 */
    gap: 32px;
    align-items: start;
}

/* デスクトップでは flex にして左右カラムを確実に横並びにする */
@media (min-width: 1024px) {
    #main-grid {
        display: flex !important;
        flex-direction: row;
        align-items: flex-start;
        gap: 32px;
        width: 100%;
        padding-left: 12px;
        padding-right: 12px;
    }

    /* 左カラム（プレビュー）を固定幅に */
    #main-grid > div:first-child {
        flex: 0 0 520px;
        max-width: 520px;
        align-self: flex-start;
    }

    /* 右カラム（編集パネル）は残りを使う */
    #main-grid > .control-panel {
        flex: 1 1 0;
        min-width: 380px;
    }
}

/* モバイルでは縦並びに戻す */
@media (max-width: 1023px) {
    #main-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.control-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.control-panel > .space-y-10 {
    flex: 1;
    overflow: auto; /* 下の項目がはみ出す場合スクロール可能に */
}

@media (min-width: 1024px) {
    .control-panel { padding-right: 1rem; }
}

/* ===== ランヤード（紐） ===== */
.lanyard-rope {
    width: 24px;
    height: 200px;
    background: #ffffff;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(0,0,0,0.1) 4px, rgba(0,0,0,0.1) 8px),
        repeating-linear-gradient(-45deg, transparent, transparent 4px, rgba(0,0,0,0.05) 4px, rgba(0,0,0,0.05) 8px);
    position: absolute;
    top: -160px;
    left: 50%;
    transform: translateX(-50%);
    z-index: -5; /* 元に戻す */
    border-radius: 12px 12px 0 0;
    box-shadow: 6px 0 20px rgba(0,0,0,0.5);
    border: 1px solid #ddd;
}


/* カード全体の横幅を固定（高さは現状を維持） */
#card-root {
    width: 500px;
    max-width: 500px;
}

.id-holder {
    width: 100%;
    max-width: 500px;
    border-radius: 24px;      /* 外側の白背景を角丸 */
    overflow: visible;        /* バッジの飛び出しを許可 */
    position: relative;
}

/* 下部の白いはみ出しを隠すオーバーレイ */
.id-holder::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    height: 50px;
    background: #00000000; /* 赤色に変更 */
    border-radius: 0 0 24px 24px;
    z-index: 100; /* バッジより前 */
    pointer-events: none;
}

/* ===== ホルダーアクセント（装飾） ===== */
.holder-accent-black {
    position: absolute;
    background: #111;
}

.accent-left { top: 100px; left: 0; width: 4px; height: 120px; border-radius: 0 2px 2px 0; }
.accent-right { top: 100px; right: 0; width: 4px; height: 120px; border-radius: 2px 0 0 2px; }
.accent-bottom { bottom: 0; left: 50%; transform: translateX(-50%); width: 140px; height: 6px; border-radius: 4px 4px 0 0; }

/* ===== ホルダー取付部分 ===== */
.holder-attachment {
    width: 200px;
    height: 54px;
    background: #111111;
    position: absolute;                  /* ホルダーの位置 */
    top: -50px;
    left: 50%;                          /* 中央に配置 */
    transform: translateX(-50%);
    border-radius: 16px 16px 0px 0px;   /* 上丸・下やや角 */
    z-index: 10;                        /* カードより前に出す */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: none;                     /* 影は消してフラットに */
    border: 2px solid #b5beca;            /* 枠線は残す（背景に馴染む薄い色） */
    overflow: visible;
}

/* タグとカードを一体化させる下側の青い帯 */
.holder-attachment::after {
    content: '';
    position: absolute;
    left: -2px;
    right: -2px;
    bottom: -6px;
    height: 6.1px;
    background: #111111; /* カード枠と同系の薄いブルー */
    z-index: -1; /* タグの背面に配置 */
}

/* ===== 金属アイレット ===== */
.metal-eyelet {
    width: 60px;
    height: 14px;
    background: #000;
    border: 2px solid #444;
    border-radius: 7px;
    position: relative;
}

.metal-eyelet::after {
    content: '';
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 22px;
    border: 5px solid #aaa;
    border-radius: 4px;
}

/* ===== カード表示エリア ===== */
.card-display {
    position: relative;
    width: 100%;
    flex-grow: 1;
    background: #f7f7f7;
    border-radius: 24px;
    overflow: hidden; /* グレーのはみ出しをクリップ */
    display: flex;
    flex-direction: column;
    border: 2px solid #b5beca;
    box-shadow: inset 0 0 0 1px #dde2e8;
}

/* ===== カードのレイアウト（新） ===== */
/* 位置やサイズを調整したい場合は、このブロック内の値を編集してください。 */
.card-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #141414;
    color: #f5f5f5;
    padding: 18px 22px;
    border-bottom: 6px solid #d1d1d1;
    border-radius: 22px 22px 12px 12px;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.card-brand {
    font-size: 34px;
}

.card-title {
    font-size: 13px;
    font-weight: 700;
}

.card-body-layout {
    position: relative;
    flex: 1;
    padding: 16px 16px 0 16px; /* 下部パディングなし、負マージンで対応 */
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7f7f7; /* 画像枠まわりを純白で統一 */
    overflow: visible;
}

.portrait-frame {
    position: relative;
    height: 340px;
    width: 100%;
    border-radius: 22px;
    overflow: visible;
    border: 0px solid #7fb3ff;
    box-shadow: 0 0 0 1px #c1d4ff inset;
    background: #000000;
}

.portrait-bg {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #000000, #000000);
    background-size: cover;
    background-position: center;
}

.name-badge {
    position: absolute;
    left: -6px;               /* 名前バッジの横方向の配置 */
    top: 390px;               /* 名前バッジの縦方向の配置 */
    width: 260px;             /* バッジの横幅 */
    min-height: 120px;        /* 余裕を持たせて見切れ防止 */
    height: auto;
    background: #efefef;      /* バッジの背景色 */
    border-radius: 7px;      /* 角の丸み */
    box-shadow: 4px 4px 0 rgba(0,0,0,0.25); /* 右と下に6pxはみ出るシャドウ（ぼかし無し） */
    border: 1px solid #d0d0d0; /* 薄いアウトライン */
    padding: 14px 16px 16px 32px; /* 上右下左の内側余白を広げる */
    display: flex;
    flex-direction: column;
    gap: 6px;                 /* 名前とUID行の間隔 */
    overflow: visible;        /* 長文で溢れないようにする */
    z-index: 80;              /* バッジを前面に表示 */
}

.name-badge::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 12px;
    bottom: auto;           /* UIDの部分には来ないように */
    height: calc(14px + 28px + 1.1em); /* label + value の高さ分 */
    width: 6px;
    background: #4a4a4a;
    border-radius: 4px;
}

.name-label {
    font-size: 14px;
    font-weight: 800;
    color: #2c2c2c;
}

.name-value {
    font-size: 28px;
    font-weight: 900;
    color: #1a1a1a;
    line-height: 1.1;
    display: -webkit-box;           /* 行数制限用 */
    -webkit-line-clamp: 2;          /* 最大2行 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uid-value {
    font-size: 14px;
    font-weight: 800;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    padding-bottom: 0px;              /* 下線との間隔 */
    border-bottom: 2px solid #1a1a1a; /* UID部分に下線を追加 */
    display: block;                   /* blockにして幅制限を有効化 */
    width: calc(100% + 20px);         /* 左に拡張 */
    margin-left: -30px;               /* 左に移動 */
    padding-left: 20px;               /* テキストを右に調整 */
}

.info-panel {
    position: relative;
    margin: 16px -16px 0 -16px; /* 下部マージンなし */
    overflow: hidden; /* 下部の飛び出しをクリップ */
    display: grid;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 10px;
    background: #3d3d3d;
    border-radius: 0 0 24px 24px;
    padding: 22px 16px 18px 16px;
    color: #f5f5f5;
    border-top: 6px solid rgba(0,0,0,0.3);
    box-shadow: inset 0 8px 16px rgba(0,0,0,0.25);
    height: auto; /* ビューポート依存の高さを避けてプレビューとキャプチャを一致させる */
}

.info-left {
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-left: 5px solid #d6d6d6;
    padding-left: 10px;
}

.info-heading {
    font-size: 22px;
    font-weight: 800;
    color: #f6f6f6;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom: 2px solid #d6d6d6;
    padding-bottom: 6px;
}

.info-label {
    font-size: 12px;
    font-weight: 700;
    color: #e2e2e2;
}

.info-value {
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    display: -webkit-box;
    -webkit-line-clamp: 1; /* 1行に収める */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-left: 5px solid #d6d6d6;
    padding-left: 10px;
}

.comment-label {
    font-size: 12px;
    font-weight: 700;
    color: #e2e2e2;
}

/* ===== コメント欄 ===== */
.comment-box {
    flex: 1;
    min-height: 180px;            /* コメント欄の最小高さ */
    max-height: 280px;            /* コメント欄の最大高さ（超過テキストは非表示） */
    border-top: 2px solid #d6d6d6;    /* 上部の区切り線 */
    border-bottom: 2px solid #d6d6d6; /* 下部の区切り線 */
    color: #ffffff;               /* テキストの色 */
    font-size: 14px;              /* テキストのサイズ */
    font-weight: 700;             /* テキストの太さ */
    line-height: 1.5;             /* 行の高さ（行間） */
    position: relative;
}


.comment-box p {
    margin: 0;
    white-space: pre-line;
    word-break: break-word;
    display: block;
}

/* ===== キャラクター表示 ===== */
.character-clipper {
    position: absolute;
    inset: 0;
    clip-path: inset(-200px 0px 0px 0px);
    z-index: 30;
    pointer-events: none;
}

.character-layer {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 155%;
    height: 110%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.character-layer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,1));
}

/* ===== ローディングスキャンライン ===== */
.loading-scan {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--theme-color);
    box-shadow: 0 0 15px var(--theme-color);
    z-index: 60;
    animation: scanMove 1.5s infinite;
    display: none;
}

@keyframes scanMove {
    0% { top: 0; opacity: 0; }
    50% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* ===== スキャンラインオーバーレイ ===== */
.scan-line-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.5) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 45;
    opacity: 0.4;
}

/* ===== ID名タグ ===== */
.id-name-tag {
    background: var(--theme-color);
    color: #000;
    padding: 8px 32px;
    font-weight: 900;
    font-size: 1.7rem;
    clip-path: polygon(0 0, 96% 0, 100% 100%, 0% 100%);
    box-shadow: 0 10px 40px var(--theme-glow);
    z-index: 55;
    position: relative;
    transform: skewX(-12deg);
    margin-left: -15px;
    font-style: normal;
}

/* ===== ステータスコンテナ ===== */
.status-container {
    background: rgba(10, 10, 10, 0.95);
    border-left: 6px solid var(--theme-color);
    border-radius: 2px;
    z-index: 50;
    position: relative;
    box-shadow: 0 15px 30px rgba(0,0,0,0.8);
    overflow: hidden;
}

/* ===== ラベルテキスト ===== */
.label-tiny {
    font-size: 7px;
    font-weight: 900;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

/* ===== 値テキスト ===== */
.value-text {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-top: -2px;
}

/* ===== ボルト（装飾） ===== */
/* .bolt {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #d1d1d1;
    border-radius: 50%;
    z-index: 15;
} */

/* ===== ローディングカーテン ===== */
.loading-curtain {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* ===== サムネイル ===== */
.thumb-preview {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #222;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.1);
}

/* ===== レイアウト用クラス ===== */
.field-group {
    space-y: 3;
}

.field-group label {
    display: block;
    font-size: 11px;
    color: #a0a0a0;
    font-weight: 700;
    margin-left: 4px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.field-group input,
.field-group select {
    width: 100%;
    background-color: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px 20px;
    font-size: 14px;
    color: #fff;
    outline: none;
    transition: all 0.2s;
}

.field-group textarea {
    width: 100%;
    background-color: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px 20px;
    font-size: 14px;
    color: #fff;
    outline: none;
    transition: all 0.2s;
    resize: vertical;
    min-height: 120px;
}

.field-group textarea:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.1);
}

/* ===== 画像調整ツールバー ===== */
.image-adjust-panel {
    margin-top: 8px;
}

.image-adjust-card {
    background: #0f0f0f;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-adjust-title {
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.image-adjust-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.image-adjust-row label {
    font-size: 11px;
    font-weight: 800;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.image-adjust-inputs {
    display: grid;
    grid-template-columns: 1fr 72px 32px;
    gap: 8px;
    align-items: center;
}

.image-adjust-inputs input[type="range"] {
    width: 100%;
}

.image-adjust-inputs input[type="number"] {
    width: 100%;
    background: #000;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px;
    color: #fff;
    font-size: 13px;
    outline: none;
}

.image-adjust-inputs .unit {
    font-size: 11px;
    color: #808080;
    text-align: right;
    padding-right: 6px;
}

.field-group input:focus,
.field-group select:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.1);
}

/* ===== パネルスタイル ===== */
.control-panel {
    background: #111111;
    padding: 24px; /* 余白を縮めて左右並び時に収まるように調整 */
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.panel-header {
    margin-bottom: 48px;
}

.panel-header h2 {
    font-size: 30px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.02em;
    font-style: italic;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.panel-header .accent-bar {
    width: 40px;
    height: 6px;
    background: #00f2ff;
}

.panel-header p {
    font-size: 11px;
    color: #808080;
    letter-spacing: 0.2em;
    margin-left: 56px;
}

.section-title {
    font-size: 12px;
    font-weight: 900;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.section-title::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--theme-color);
    border-radius: 2px;
}

/* ===== ボタンスタイル ===== */
.theme-button {
    background: #333;
    border: 1px solid #555;
    padding: 16px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-button:hover {
    background: #444;
}

.theme-button.active {
    background: var(--theme-color);
    color: #000;
    border-color: var(--theme-color);
}

.save-button {
    width: 100%;
    background: #fff;
    color: #000;
    padding: 24px;
    border-radius: 32px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.save-button:hover {
    background: #00f2ff;
}

.save-button:active {
    transform: scale(0.95);
}

/* ===== ファイルアップロード ===== */
.file-upload-item {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-item:hover {
    background: rgba(0, 0, 0, 0.6);
}

.file-upload-item.char-upload {
    background: rgba(0, 153, 255, 0.1);
    border-color: rgba(0, 153, 255, 0.2);
}

.file-upload-item.char-upload:hover {
    background: rgba(0, 153, 255, 0.2);
}

/* デスクトップ向け: 上部余白を減らしてプレビューを上揃えにする */
@media (min-width: 1024px) {
    body {
        padding-top: 8px; /* tailwind の py-12 を抑える（画面端に寄せるため） */
        padding-bottom: 8px;
    }

    /* プレビュー内の余白を小さくして上に寄せる */
    #capture-boundary {
        padding: 16px 12px 12px 12px;
    }

    /* メイングリッドの左カラム（プレビュー）を上揃えにする */
    #main-grid > div:first-child {
        align-self: start;
        justify-self: start;
    }
}

.file-upload-icon {
    background: #333;
    padding: 16px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-upload-item.char-upload .file-upload-icon {
    background: rgba(0, 153, 255, 0.2);
}

.file-upload-text {
    flex-grow: 1;
}

.file-upload-text p {
    font-size: 12px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.file-upload-item.char-upload .file-upload-text p {
    color: #00ccff;
}

/* ===== チェックボックス ===== */
input[type="checkbox"] {
    accent-color: var(--theme-color);
}

.checkbox-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-item:hover {
    border-color: var(--theme-color);
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.checkbox-item label {
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin: 0;
}

/* ===== 背景 ===== */
.bg-dark {
    background-color: #080808;
}
