body {
    font-family: 'Noto Serif JP', serif;
    background-color: #ffffff;
    transition: background-color 0.5s ease;
    margin: 0;
    padding: 0;
    color: #515151;
}
body ::selection {
    background-color: #515151;
    color: #ffffff;
}

#header {
    display: flex;
    justify-content: space-between;
    margin: 20px 20px 80px 20px;
    font-size: 12px;
    position: relative;
    z-index: 1;
}

.index {
    cursor: pointer;
    margin: 0;
    font-size: 16px;
    letter-spacing: 1.1em;
    color: #515151;
}

#name {
    text-decoration: none;
    cursor: pointer;
}

.name {
    margin: 0;
    font-size: 16px;
    letter-spacing: 1.1em;
    color: #515151;
}

.grid-container {
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    padding: 0 10px;
    overflow-x: hidden;
}

.flex-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.thumbnail {
    box-sizing: border-box; 
    margin: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    max-width: calc(100vw - 40px);
}

.thumbnail:hover {
    filter: grayscale(100%);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.size-a { width: 150px; height: 100px; }
.size-b { width: 300px; height: 200px; }
.size-c { width: 450px; height: 300px; }
.size-d { width: 600px; height: 400px; }

#cursor-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999; 
    pointer-events: none;
}

/* --- 仮想ウィンドウ --- */
.virtual-window {
    position: fixed;
    background-color: #ffffff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 12px rgba(81, 81, 81, 0.15);
    display: flex;
    flex-direction: column;
    min-width: 250px;
    min-height: 150px;
}

.window-header {
    display: flex;
    justify-content: flex-start; 
    align-items: center;
    background-color: #ffffff;
    height: 30px;
    padding: 0 10px;
    border-bottom: 1px solid #ccc;
    cursor: move;
    flex-shrink: 0;
    position: relative; 
}

.window-close {
    width: 15px;
    height: 15px;
    cursor: pointer;
    font-size: 25px;
    line-height: 10px;
    text-align: center;
    color: #515151;
    opacity: 0.8;
    z-index: 2; 
}
.window-close:hover {
    opacity: 1;
    color: #c6c6c6;
}

.window-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scaleX(0.65); 
    transform-origin: center center;
    font-size: 16px;
    color: #515151;
    white-space: nowrap;
    pointer-events: none; 
    width: auto;
}

.window-content {
    padding: 10px 5px 5px 5px;
    overflow: auto;
    flex-grow: 1;
    min-height: 0;
    color: #515151;
    overflow-x: hidden;   
    overflow-y: auto;
}

.window-type-text { width: 320px; height: 380px; }
.window-type-text .window-content pre {
   white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    font-family: 'Noto Serif JP', serif;
    
    /* ▼ テキストを横に潰すためのスタイルを追加 */
    display: block;
    width: 153.846%;           /* 縮小分（1 / 0.65）の幅を確保して折り返し位置を維持 */
    transform: scaleX(0.65);   /* 横幅を 65% に縮小 */
    transform-origin: left top;/* 左上を起点に変形 */
    line-height: 1.8;       /* 潰した際に見やすくなるよう、必要に応じて行間を調整 */
}

.window-type-image { width: 600px; height: 420px; }
.window-type-image .window-content {
    padding: 15px; 
    display: flex;
    flex-direction: column;
}
.window-type-image .window-content img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

::-webkit-scrollbar {
  height: 20px;
  width: 12px;
}
::-webkit-scrollbar-thumb {
 background: #ffffff;
 border: #515151 0.5px solid;
  border-radius: 20px;
}
::-webkit-scrollbar-track {
  background: #e5e5e5;
  border-radius: 20px;
}

/* --- MENU / INDEXレイアウト --- */
#index-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 50vw; 
    height: 100vh;
    background-color: #ffffff;
    z-index: 9998;
    padding: 20px 20px; 
    box-sizing: border-box;
    transform: translateX(100%);
    overflow-y: auto;
    border-left: 1px solid #f0f0f0; 
}

#index-menu.active {
    transform: translateX(0);
}

.menu-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 80px;
}

.close-menu {
    cursor: pointer;
    margin: 0;
    font-size: 16px;
    letter-spacing: 1.1em;
    color: #515151;
    display: inline-block;
    transform: scaleX(0.65);
    transform-origin: right center;
    margin-right: -1.1em;
}

.menu-links {
    display: flex;
    margin-bottom: 80px;
    gap: 20px;
}

.menu-link {
    font-size: 14px;
    letter-spacing: 1.1em;
    color: #515151;
    text-decoration: none;
    padding-bottom: 2px;
    position: relative;
}

.menu-link::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 1.1em;
    height: 1px;
    background-color: #515151;
}

/* ★ ヘッダー行 (INDEX/TAGS) の整列修正 ★ */
.menu-headers-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    height: 50px;
}

.tags-trigger-container {
    position: relative;
    width: 80px; /* ★ リストのタグ列（item-tags）と完全に一致させる */
    display: flex;
    justify-content: flex-start;
}

.menu-index-title {
    border: #ff3b79 1px solid;
    color: #ff3b79;
    font-size: 14px;
    padding: 2px 0; /* 左右パディングをリセット */
    width: 80px; /* ★ 枠の幅を固定。これで絶対にはみ出さない */
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
     letter-spacing: 1.1em;
}

/* 文字と矢印を中央にまとめて縮小 */
.menu-index-title span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 153.846%; /* 1 / 0.65 = 153.846% (縮小分を逆算して100%の見た目にする) */
    transform: scaleX(0.65);
    transform-origin: center center;
    white-space: nowrap;
     letter-spacing: 0.7em;
}

#tags-arrow {
    margin-left: 2px;
}

.tags-dropdown {
    display: none;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: 30px;
    width: 80px;
    background: #fff;
    z-index: 100;
}

.tags-dropdown.active { display: flex; }

.tags-dropdown .tag-row {
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

/* --- 作品リスト --- */
.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.menu-item {
    font-family: 'Noto Serif JP', serif;
    font-size: 14px;
    color: #515151;
    text-decoration: none;
    padding: 15px 0;
    display: flex;
    align-items: center;
    flex-grow: 1;
    border-bottom: 1px solid #f0f0f0;
}

.item-number { width: 60px; flex-shrink: 0; }
.item-title { flex-grow: 1; }
.item-category { width: 100px; text-align: right; padding-right: 30px; flex-shrink: 0; }

/* カラーコード列 */
.item-tags {
    width: 80px; /* ★ 上の見出し（TAGS）の幅と完全に一致 */
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-left: 30px;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.menu-list li:hover .menu-item,
.menu-list li:hover .item-tags {
    border-bottom-color: #515151; 
}

.tag-text {
    cursor: pointer;
}
.tag-text:hover,
.tag-text.active {
    color: var(--tag-color);
}

.menu-title { opacity: 0; }

/* --- テキスト縮小共通 --- */
.name, .index, .menu-title, .menu-link, 
.item-number, .item-title, .item-category, 
.window-close, .tag-text {
    display: inline-block; 
    transform: scaleX(0.65); 
    transform-origin: left center; 
}

.index {
    transform-origin: right center;
    margin-right: -1.1em; 
}

/* --- 画像・全画面 --- */
.image-gallery-container { display: flex; flex-direction: column; width: 100%; height: 100%; }
.image-wrapper { flex-grow: 1; display: flex; justify-content: center; align-items: center; overflow: hidden; padding: 0; }
.gallery-img { width: 100%; height: 100%; object-fit: contain; }

.gallery-controls { 
    flex-shrink: 0; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    margin-top: 15px; 
    gap: 15px; 
}

.arrows { 
    display: flex; 
    gap: 40px; 
}

.arrow {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.arrow:hover {
    opacity: 0.7;
}

.full-size-view {
    font-size: 14px;
    text-decoration: underline; 
    text-underline-offset: 4px;
    cursor: pointer; 
    display: inline-block;
    transform: scaleX(0.65);
    transform-origin: center center;
}
.full-size-view:hover {
    opacity: 0.7;
}

.virtual-window.maximized { top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important; z-index: 99999 !important; border: none !important; }

/* --- ABOUT ページ用スタイル --- */
.main { margin: 20px; }
.about-head { display: flex; justify-content: space-between; }
.left { display: flex; gap: 20px; }
.profile { width: 400px; object-fit: contain; align-self: flex-start; }
.profile-text { display: flex; flex-direction: column; gap: 10px; width: 40vw; font-size: 20px; }
.profile-text p { margin: 0; display: block; width: 153.846%; transform: scaleX(0.65); transform-origin: left top; }
.right { display: flex; gap: 60px; font-size: 40px; }
.right a { color: #ff3b79; text-decoration: underline 2px; display: inline-block; transform: scaleX(0.65); transform-origin: right center; font-weight:200; }
.right a:hover { opacity: 0.7; }
.about-bottom { margin-top: 80px; margin-bottom: 80px; }
.about-bottom-text { margin: 0; display: block; width: 153.846%; transform: scaleX(0.65); transform-origin: left top; font-size: 14px; line-height: 1.8; }

@media (max-width: 768px) {
    #index-menu { width: 100vw; }
    .item-tags, .tags-trigger-container { width: 60px; }
    /* モバイルでも幅を同期 */
    .menu-index-title { width: 60px; }
    .item-category { display: none; }
    .sp-none { display: none; }
    .thumbnail { margin: 10px; }
    .window-type-text { width: 280px !important; height: 320px !important; }
    .window-type-image { width: 300px !important; height: 340px !important; }
    .virtual-window { min-width: 200px; }

    .menu-index-title span {
   font-size: 11px;
}
}

@media (max-width: 768px) {
    .about-head { flex-direction: column; gap: 40px; }
    .left { flex-direction: column; }
    .profile { width: 100%;  }
    .profile-text { width: 100%; }
    .right { gap: 40px; font-size: 30px; justify-content: flex-start; }
    .right a { transform-origin: left center; }
    .about-bottom { margin-top: 40px; border-top: #515151 1px solid; }
}

/* ==========================================
   ▼ macOSライクな全周囲リサイズハンドル領域
   ========================================== */
.resize-handle {
    position: absolute;
    z-index: 10;
    /* background: rgba(0, 0, 0, 0.05);  ←領域を目視で確認したい場合はコメントアウトを外してください */
}

/* --- 四辺のリサイズ領域（掴みやすいように境界線の内外4pxずつに広げて配置） --- */
.resize-handle.top {
    top: -4px;
    left: 8px;
    right: 8px;
    height: 8px;
    cursor: n-resize; /* 上下のカーソル */
}
.resize-handle.bottom {
    bottom: -4px;
    left: 8px;
    right: 8px;
    height: 8px;
    cursor: s-resize; /* 上下のカーソル */
}
.resize-handle.right {
    right: -4px;
    top: 8px;
    bottom: 8px;
    width: 8px;
    cursor: e-resize; /* 左右のカーソル */
}
.resize-handle.left {
    left: -4px;
    top: 8px;
    bottom: 8px;
    width: 8px;
    cursor: w-resize; /* 左右のカーソル */
}

/* --- 四隅のリサイズ領域（斜め方向への快適なドラッグのために少し広めの角を確保） --- */
.resize-handle.top-left {
    top: -6px;
    left: -6px;
    width: 14px;
    height: 14px;
    cursor: nwse-resize; /* 左上・右下の斜めカーソル */
}
.resize-handle.top-right {
    top: -6px;
    right: -6px;
    width: 14px;
    height: 14px;
    cursor: nesw-resize; /* 右上・左下の斜めカーソル */
}
.resize-handle.bottom-left {
    bottom: -6px;
    left: -6px;
    width: 14px;
    height: 14px;
    cursor: nesw-resize; /* 右上・左下の斜めカーソル */
}
.resize-handle.bottom-right {
    bottom: -6px;
    right: -6px;
    width: 14px;
    height: 14px;
    cursor: nwse-resize; /* 左上・右下の斜めカーソル */
}