/* front/css/card.css */

:root {
    --bg-color: #0d1117;
    --card-bg-inner: #0d1117;
    --text-white: #ffffff;
    --text-gray: #6e7a8e;
    --accent: #00f3ff;
    --font-tech: 'Rajdhani', sans-serif;
    --font-jp: 'Rajdhani', 'Hiragino Sans', 'Noto Sans CJK JP', sans-serif;
}

/* 基本設定 */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    /* 通常時はスクロール許可 */
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none; 
    -ms-overflow-style: none;
    
    /* ★修正: 背景色(#000)を削除（ここで指定すると画像を隠してしまうため） */
    background-color: transparent; 
    
    font-family: var(--font-tech);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

body::-webkit-scrollbar {
    display: none;
}

/* ★背景画像＋ぼかし用のレイヤー */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    
    /* ★修正: 背景色(#000)はここに移動（画像読み込み前や隙間対策） */
    background-color: #000;
    
    /* 背景画像の設定 */
    background-image: url('/front/img/Achievementsimage.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* ぼかしフィルター */
    filter: blur(4px);
    /* ぼかした端が見えないように少し拡大 */
    transform: scale(1.1);
    
    /* 一番奥に配置 */
    z-index: -2;
}

/* 暗くするフィルター用のレイヤー */
body::after {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    /* 画像(z-index:-2)より手前、コンテンツより奥 */
    z-index: -1;
}

.content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;
    width: 100%;
    padding-bottom: 0;
    box-sizing: border-box;
}

.nav-container {
    position: absolute;
    top: 10px;
    left: 10px;
    flex-shrink: 0;
    z-index: 100;
    pointer-events: none;
}

.back-button {
    color: #ccc;
    text-decoration: none;
    font-size: 1rem;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: background-color 0.2s;
    display: inline-block;
    cursor: pointer;
    border: none;
    font-family: var(--font-jp);
    pointer-events: auto;
}
.back-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

#card-container {
    position: relative;
    width: 800px;
    max-width: 100%; 
    height: 400px;
    margin: 0 auto; 
    background-color: var(--card-bg-inner);
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

.bg-gradient {
    position: absolute;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 30% 50%, #161b2e 0%, #0d1117 100%);
    z-index: 0;
}

.stars {
    position: absolute;
    width: 100%; height: 100%;
    background-image: radial-gradient(white 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.1;
    z-index: 0;
}

#planet-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

.card-content {
    position: absolute;
    top: 0; right: 0;
    width: 55%;
    height: 100%;
    padding: 20px 30px; 
    box-sizing: border-box;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: right;
}

.header-section { margin-bottom: 20px; }

.id-label {
    font-size: 0.8rem;
    color: var(--accent);
    letter-spacing: 0.2em;
    font-weight: 600;
    margin-bottom: 5px;
    opacity: 0.8;
}

.user-name {
    font-size: 2.8rem;
    font-weight: 700;
    margin: 0;
    line-height: 0.9;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(180deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(165, 180, 252, 0.4));
}

.stats-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 25px;
    margin-bottom: 25px;
}

.stat-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-gray);
    letter-spacing: 0.1em;
    font-weight: 600;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-transform: uppercase;
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: rgba(255,255,255,0.1);
}

.footer-section { margin-top: auto; }

.lang-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-gray);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    font-weight: 600;
}

.sys-status {
    color: var(--accent);
    animation: blink 2s infinite;
}

.bar-track {
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,0.1);
    position: relative;
}

.bar-fill {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    transition: width 1s ease-out;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.share-container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    text-align: center;
    color: white;
    box-sizing: border-box;
}

.share-container p {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 600;
    font-family: var(--font-jp);
}

.code-box {
    background: #0d1117; 
    padding: 12px 18px;
    border-radius: 4px;
    border: 1px solid #30363d; 
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
}

code {
    font-family: 'Courier New', monospace;
    font-size: 1.0rem;
    font-weight: 700;
    word-break: break-all;
    text-align: left;
    color: #ffffff;
    flex-grow: 1;
}

button#copy-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 8px;
    width: 40px; 
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

button#copy-btn svg {
    display: block;
}

button#copy-btn:hover {
    background: var(--accent);
    color: #050508;
}

@media screen and (max-width: 850px) {
    #card-container {
        width: 90vw;
        height: auto;
        aspect-ratio: 2 / 1;
    }

    .card-content {
        padding: 4% 5%;
    }

    .user-name {
        font-size: 5.5vw;
    }
    .stat-value {
        font-size: 3.5vw;
    }
    .id-label, .stat-label, .lang-label-row {
        font-size: 1.6vw;
    }

    .header-section { margin-bottom: 2%; }
    .stats-row { gap: 3%; margin-bottom: 3%; }
    .stat-divider { height: 4vw; }
    
    .code-box {
        flex-direction: row;
        padding: 10px 14px;
        gap: 12px;
        align-items: center;
    }
    code {
        font-size: 0.8rem;
        text-align: left;
    }
    button#copy-btn {
        width: 38px;
        height: 38px;
        flex-shrink: 0;
    }
}

/* =========================================
   スクリーンショット撮影モード (fix=true)
   ========================================= */
/* HTMLタグにクラスがついた場合も適用されるように変更 */
html.is-screenshot,
html.is-screenshot body,
body.is-screenshot {
    margin: 0 !important;
    padding: 0 !important;
    /* 幅は画面いっぱいにする */
    width: 100vw !important;
    /* ★修正: 縦幅を100vhから400px固定に変更 */
    height: 400px !important;
    /* スクロールバーを強制的に消す */
    overflow: hidden !important;
    background-color: var(--card-bg-inner) !important;
    background-image: none !important;
    display: block !important;
}

html.is-screenshot .content-wrapper,
html.is-screenshot .nav-container,
html.is-screenshot .share-container,
html.is-screenshot .bg-gradient,
html.is-screenshot .stars,
html.is-screenshot ::before,
html.is-screenshot ::after, /* ★追加: スクショ時は暗いフィルターも消す */
body.is-screenshot .content-wrapper,
body.is-screenshot .nav-container,
body.is-screenshot .share-container,
body.is-screenshot .bg-gradient,
body.is-screenshot .stars,
body.is-screenshot ::before,
body.is-screenshot ::after { /* ★追加: スクショ時は暗いフィルターも消す */
    display: none !important;
}

/* カード本体の強制スタイル */
html.is-screenshot #card-container,
body.is-screenshot #card-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    
    /* コンテナも縦幅を400pxに固定して、下に余分な空白を作らせない */
    width: 100% !important;
    height: 400px !important;
    
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
    z-index: 9999 !important;
    
    max-width: none !important;
    aspect-ratio: auto !important;
}