/* =========================================================
   YAKABE'S ROOM - Retro Desktop
   Palette: warm cream / peach / mint / terracotta
   ========================================================= */

:root {
  /* color.png 準拠 */
  --ink: #442626;            /* text primary */
  --accent: #E26049;         /* terracotta */
  --accent-d: #c84b35;
  --white: #ffffff;
  --placeholder: #FFD8B4;
  --bg-hero: #F8E0E0;
  --bg-design: #FFF3C1;
  --bg-illust: #C7F0DB;
  --bg-profile: #FFDDB4;

  /* UI */
  --win-face: #fffaf2;
  --bevel-l: #ffffff;
  --bevel-d: #d6a98a;
  --bar-1: #ED7E63;
  --bar-2: #E26049;
  --shadow: rgba(68,38,38,.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ピクセルらしく：角丸を全廃（円形のSNSボタン等も四角に） */
*, *::before, *::after { border-radius: 0 !important; }
html, body { height: 100%; }

body {
  font-family: "DotGothic16", "Press Start 2P", monospace;
  color: var(--ink);
  overflow: hidden;
  transition: background .6s ease;
}

/* ---- 昼モード：水色の空 ---- */
body.mode-day {
  background: linear-gradient(180deg, #7fc6ff 0%, #a8dcff 45%, #d6f0ff 78%, #eafaff 100%);
}
/* ---- 夜モード：濃紺の星空 ---- */
body.mode-night {
  background: linear-gradient(160deg, #0d0f30 0%, #201b4a 50%, #38295c 100%);
}

/* ===== 空レイヤー（太陽・雲 / 星） ===== */
.sky { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }

/* --- 昼：太陽と雲（ドット絵）--- */
.sun {
  position: absolute; top: 6%; right: 7%; width: 88px; height: 88px;
  filter: drop-shadow(3px 3px 0 rgba(244,167,5,.45));
  animation: sun-bob 5s ease-in-out infinite;
}
.sun svg { width: 100%; height: 100%; }
@keyframes sun-bob { 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(8px); } }

.clouds { position: absolute; inset: 0; }
.cloud { position: absolute; left: -180px; width: 120px; will-change: transform; }
.cloud svg { width: 100%; height: auto; filter: drop-shadow(0 4px 0 rgba(120,170,210,.25)); }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(118vw); } }

/* 昼夜でレイヤーの出し分け */
body.mode-night .sun, body.mode-night .clouds { display: none; }

/* --- 夜：ピクセルアートの星空（昼モードでは非表示）--- */
.stars { position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; }
body.mode-night .stars { opacity: 1; }
.pxstar {
  position: absolute; background: #fff; image-rendering: pixelated;
  animation: twinkle 2.6s steps(2, jump-none) infinite;
}
.pxstar--sparkle {
  /* 4方向に尖ったピクセルきらきら（プラス型） */
  clip-path: polygon(40% 0,60% 0,60% 40%,100% 40%,100% 60%,60% 60%,60% 100%,40% 100%,40% 60%,0 60%,0 40%,40% 40%);
  animation-duration: 1.8s;
}
@keyframes twinkle { 0%,100% { opacity: .25; } 50% { opacity: 1; } }

/* --- 流れ星（夜・ピクセルアート・JSで生成）--- */
.shooting-star {
  position: absolute; width: 64px; height: auto;
  pointer-events: none; opacity: 0;
  animation: shoot 1s ease-in forwards;
}
.shooting-star svg { width: 100%; height: auto; image-rendering: pixelated; }
@keyframes shoot {
  0%   { transform: translate(0,0) rotate(20deg); opacity: 0; }
  12%  { opacity: 1; }
  100% { transform: translate(300px, 150px) rotate(20deg); opacity: 0; }
}

/* --- 飛んでいくピクセルの鳥（昼・JSで生成）--- */
.fly-bird { position: absolute; width: 36px; pointer-events: none; }
.fly-bird svg { width: 100%; height: auto; transform-origin: center; animation: flap .4s steps(2) infinite alternate; }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(.55); } }
@keyframes fly-across {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(28vw, -14px); }
  50%  { transform: translate(56vw, 0); }
  75%  { transform: translate(84vw, -14px); }
  100% { transform: translate(116vw, 0); }
}

/* =========================================================
   デスクトップ
   ========================================================= */
.desktop {
  position: fixed; inset: 0 0 44px 0; z-index: 1; overflow: hidden;
}
/* PC：アイコンは絶対配置（無造作）＆ドラッグ移動可。位置はJSが設定 */
.icons { list-style: none; position: absolute; inset: 0; }
.icon {
  position: absolute; width: 88px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 4px; border-radius: 8px; cursor: grab; text-align: center;
  user-select: none; touch-action: none; transition: background .12s, transform .08s;
}
.icon.dragging { cursor: grabbing; opacity: .85; transition: none; }
.icon:hover { background: rgba(255,255,255,.28); }
.icon:active { transform: scale(.95); }
.icon.selected { background: rgba(226,96,73,.28); outline: 1px dotted #fff; }
.icon__art {
  width: 56px; height: 56px; display: grid; place-items: center;
  font-size: 30px; border-radius: 14px; border: 3px solid #fff;
  box-shadow: 3px 3px 0 var(--shadow);
}
.icon__art--design  { background: linear-gradient(145deg,#fff7cf,#ffe17a); }
.icon__art--illust  { background: linear-gradient(145deg,#dcf7ec,#9be3c6); }
.icon__art--fanart  { background: linear-gradient(145deg,#ffe1e6,#ffacc0); }
.icon__art--profile { background: linear-gradient(145deg,#ffe9cf,#ffc98c); }

/* ピクセルアートSVGアイコン共通サイズ */
.icon__art svg { width: 36px; height: 36px; image-rendering: pixelated; }
.startmenu li span { display: inline-flex; align-items: center; justify-content: center; width: 22px; }
.startmenu li span svg { width: 22px; height: 22px; }
.win-ico { display: inline-flex; vertical-align: middle; margin-right: 4px; }
.win-ico svg { width: 14px; height: 14px; }
.tab-ico { display: inline-flex; vertical-align: middle; }
.tab-ico svg { width: 16px; height: 16px; }
.tray__icon { display: inline-flex; vertical-align: middle; }
.tray__icon svg { width: 16px; height: 16px; }
.modebtn { display: grid; place-items: center; }
.modebtn svg { width: 18px; height: 18px; }
.icon__label {
  font-size: 13px; color: #fff; line-height: 1.2; word-break: break-word;
  /* 明るい背景でも夜空でも読めるよう4方向の濃い縁取り */
  text-shadow:
    1px 1px 0 rgba(68,38,38,.85), -1px 1px 0 rgba(68,38,38,.7),
    1px -1px 0 rgba(68,38,38,.7), -1px -1px 0 rgba(68,38,38,.7);
}

/* =========================================================
   ウィンドウ（98 風）
   ========================================================= */
.window {
  position: absolute; z-index: 2;
  min-width: 280px; width: 480px;
  background: var(--win-face);
  border: 2px solid var(--bevel-d);
  border-top-color: var(--bevel-l); border-left-color: var(--bevel-l);
  border-radius: 6px 6px 4px 4px;
  box-shadow: 5px 6px 0 var(--shadow);
  display: flex; flex-direction: column;
  animation: pop .14s ease-out;
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.window.minimized { display: none; }
.window.maximized { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; }

.window__bar {
  display: flex; align-items: center; gap: 6px; padding: 5px 6px;
  background: linear-gradient(90deg, var(--bar-1), var(--bar-2));
  color: #fff; cursor: grab; border-radius: 3px 3px 0 0;
  border-bottom: 2px solid var(--bevel-d);
}
.window.inactive .window__bar { background: linear-gradient(90deg,#cdbcae,#b29c8a); }
.window__bar:active { cursor: grabbing; }
.window__title {
  font-size: 13px; font-weight: bold; text-shadow: 1px 1px 0 rgba(0,0,0,.3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; pointer-events: none;
}
.window__ctrls { display: flex; gap: 4px; }
.window__ctrls button {
  width: 22px; height: 20px; font-family: "Press Start 2P", monospace; font-size: 9px;
  background: var(--win-face); color: var(--ink);
  border: 2px solid; border-color: #fff var(--bevel-d) var(--bevel-d) #fff;
  cursor: pointer; display: grid; place-items: center; line-height: 1;
}
.window__ctrls button:active { border-color: var(--bevel-d) #fff #fff var(--bevel-d); }
.window__ctrls .x { background: var(--accent); color:#fff; }

.window__content {
  padding: 14px; overflow: auto; flex: 1; max-height: 62vh;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 9px, rgba(226,96,73,.04) 9px, rgba(226,96,73,.04) 10px),
    var(--win-face);
}
.window.maximized .window__content { max-height: none; }
/* セクション別の淡いトーン */
.window[data-key="design"]  .window__content { background-color: #fffdf0; }
.window[data-key="illust"]  .window__content { background-color: #f1fbf6; }
.window[data-key="fanart"]  .window__content { background-color: #fff5f3; }
.window[data-key="profile"] .window__content { background-color: #fff7ec; }

/* ---- ウィンドウ内コンテンツ ---- */
.win-lead { font-size: 14px; margin-bottom: 12px; color: var(--accent-d); font-weight: bold; }
.win-note { font-size: 11px; color: #b79a86; margin-top: 12px; }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gallery--illust { grid-template-columns: repeat(2, 1fr); }
.card {
  background: #fff; border: 2px solid var(--placeholder); border-radius: 8px; padding: 6px;
  box-shadow: 2px 2px 0 rgba(255,216,180,.9);
}
.card figcaption { font-size: 11px; margin-top: 6px; text-align: center; color: var(--ink); }
.thumb {
  aspect-ratio: 4/3; border-radius: 5px; display: grid; place-items: center;
  font-family: "Press Start 2P", monospace; font-size: 11px; color: #fff;
  text-shadow: 1px 1px 0 rgba(68,38,38,.35); background-size: cover;
}
.thumb-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 5px; display: block; cursor: zoom-in; transition: transform .1s; }
.thumb-img:hover { transform: scale(1.02); }
.card__btn {
  display: block; margin-top: 8px; text-align: center; text-decoration: none;
  font-size: 12px; color: #fff; background: var(--accent);
  border: 2px solid; border-color: #fff var(--accent-d) var(--accent-d) #fff;
  border-radius: 5px; padding: 5px;
}
.card__btn:hover { background: var(--accent-d); }
.card__btn:active { border-color: var(--accent-d) #fff #fff var(--accent-d); }

/* もっと見るボタン（ギャラリー下部） */
.more-btn {
  display: block; width: fit-content; margin: 16px auto 4px; text-decoration: none;
  font-size: 13px; color: #fff; background: var(--accent);
  border: 2px solid; border-color: #fff var(--accent-d) var(--accent-d) #fff;
  border-radius: 999px; padding: 9px 22px; box-shadow: 2px 2px 0 var(--shadow);
}
.more-btn:hover { background: var(--accent-d); }
.more-btn:active { border-color: var(--accent-d) #fff #fff var(--accent-d); }

/* 仮サムネのグラデ（Design用） */
.thumb--1{background:linear-gradient(135deg,#ffd9a8,#e26049);}
.thumb--2{background:linear-gradient(135deg,#ffe17a,#ffb15a);}
.thumb--3{background:linear-gradient(135deg,#9be3c6,#5fc2a0);}
.thumb--4{background:linear-gradient(135deg,#ffacc0,#e26049);}
.thumb--5{background:linear-gradient(135deg,#ffd9a8,#ffb15a);}
.thumb--6{background:linear-gradient(135deg,#c7f0db,#9be3c6);}

/* ---- プロフィール ---- */
.profile__head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.profile__avatar {
  width: 74px; height: 74px; border: 3px solid #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 3px 3px 0 var(--shadow); flex-shrink: 0; background: var(--bg-profile);
}
.profile__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile__avatar--logo { background: #fff; }
.profile__avatar--logo img { object-fit: contain; padding: 8px; }
.profile__name h3 { font-size: 18px; color: var(--accent-d); }
.profile__name p { font-size: 12px; color: #b79a86; margin-top: 4px; }
.profile__list { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin-bottom: 16px; }
.profile__list dt { font-size: 12px; color: var(--accent); white-space: nowrap; }
.profile__list dd { font-size: 13px; }
.profile__links { display: flex; gap: 12px; }
.sns {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 2px 2px 0 var(--shadow);
  transition: transform .1s;
}
.sns:hover { transform: translateY(-3px); }
.sns svg { width: 60%; height: 60%; }
.sns--x   { background: #fff; }
.sns--x svg { fill: #000; }
.sns--ig  { background: linear-gradient(45deg,#f9ce34,#ee2a7b 45%,#6228d7); }
.sns--ig svg { width: 66%; height: 66%; }
.sns--note{ background: #41C9B4; }
.sns--note svg { width: 80%; height: auto; }

/* =========================================================
   ダイアログ（ウェルカム）
   ========================================================= */
.dialog {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%,-50%);
  width: 310px; z-index: 9000;
  background: var(--win-face);
  border: 2px solid var(--bevel-d); border-top-color: #fff; border-left-color: #fff;
  border-radius: 6px; box-shadow: 6px 7px 0 var(--shadow);
}
.dialog.hidden { display: none; }
.dialog__bar {
  display: flex; justify-content: space-between; align-items: center; padding: 6px 8px;
  background: linear-gradient(90deg, var(--bar-1), var(--bar-2));
  color: #fff; font-size: 13px; font-weight: bold; border-radius: 4px 4px 0 0;
  text-shadow: 1px 1px 0 rgba(0,0,0,.25);
}
.dialog__bar .x { width: 20px; height: 18px; border: 2px solid; border-color:#fff var(--bevel-d) var(--bevel-d) #fff; background: var(--accent); color:#fff; cursor:pointer; font-family:"Press Start 2P"; font-size:9px; }
.dialog__body { padding: 20px 16px; text-align: center; }
.dialog__msg { font-size: 13px; line-height: 1.8; margin-bottom: 18px; }

.btn {
  font-family: "DotGothic16", monospace; font-size: 14px; padding: 8px 20px; cursor: pointer;
  background: var(--win-face); color: var(--ink);
  border: 2px solid; border-color: #fff var(--bevel-d) var(--bevel-d) #fff;
}
.btn:active { border-color: var(--bevel-d) #fff #fff var(--bevel-d); }
.btn--primary { background: var(--accent); color: #fff; border-color: #fff var(--accent-d) var(--accent-d) #fff; }
.btn--primary:active { border-color: var(--accent-d) #fff #fff var(--accent-d); }

/* =========================================================
   スタートメニュー
   ========================================================= */
.startmenu {
  position: fixed; left: 6px; bottom: 48px; z-index: 8000; width: 232px;
  background: var(--win-face);
  border: 2px solid var(--bevel-d); border-top-color: #fff; border-left-color: #fff;
  border-radius: 6px; box-shadow: 5px 6px 0 var(--shadow);
  display: flex; overflow: hidden; animation: pop .12s ease-out;
}
.startmenu[hidden] { display: none; }
.startmenu__banner {
  writing-mode: vertical-rl; background: linear-gradient(var(--bar-1), var(--bar-2));
  color: #fff; font-family: "Press Start 2P"; font-size: 12px; padding: 12px 7px;
  letter-spacing: 2px; text-align: center; text-shadow: 1px 1px 0 rgba(0,0,0,.25);
}
.startmenu ul { list-style: none; flex: 1; padding: 6px; }
.startmenu li {
  display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 9px 10px;
  border-radius: 6px; cursor: pointer;
}
.startmenu li span { font-size: 18px; }
.startmenu li:hover { background: linear-gradient(90deg,var(--accent),var(--bar-1)); color: #fff; }
.startmenu__sep { height: 2px; background: #f0d9c4; margin: 4px 2px; padding: 0 !important; pointer-events: none; }

/* =========================================================
   タスクバー
   ========================================================= */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 44px; z-index: 7000;
  display: flex; align-items: center; gap: 6px; padding: 4px 6px;
  background: linear-gradient(180deg, #ffe7cc, #ffce9e);
  border-top: 2px solid #fff; box-shadow: 0 -2px 6px var(--shadow);
}
.startbtn {
  display: flex; align-items: center; gap: 8px;
  font-family: "Press Start 2P", monospace; font-size: 11px;
  padding: 8px 14px; cursor: pointer; color: var(--ink);
  background: linear-gradient(180deg,#fff6ea,#ffd8b4);
  border: 2px solid; border-color: #fff var(--bevel-d) var(--bevel-d) #fff; border-radius: 6px;
}
.startbtn:active, .startbtn.active { border-color: var(--bevel-d) #fff #fff var(--bevel-d); }
.startbtn__logo { color: var(--accent); font-size: 16px; }
.taskbar__tabs { display: flex; gap: 5px; flex: 1; overflow: hidden; }
.tasktab {
  display: flex; align-items: center; gap: 7px; max-width: 180px;
  font-family: "Press Start 2P", monospace; font-size: 9px;
  padding: 7px 10px; cursor: pointer; background: rgba(255,255,255,.6); color: var(--ink);
  border: 2px solid; border-color: #fff var(--bevel-d) var(--bevel-d) #fff; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tasktab.active { background: #fff; border-color: var(--bevel-d) #fff #fff var(--bevel-d); }
.tasktab span { font-size: 15px; }
.tray {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px;
  background: rgba(255,255,255,.45);
  border: 2px solid; border-color: var(--bevel-d) #fff #fff var(--bevel-d); border-radius: 5px;
}
.clock { font-family: "Press Start 2P"; font-size: 11px; color: var(--ink); }
.modebtn, .chickbtn {
  font-size: 16px; line-height: 1; cursor: pointer; padding: 3px 6px;
  background: #fff; border: 2px solid; border-color: #fff var(--bevel-d) var(--bevel-d) #fff;
  border-radius: 5px;
}
.modebtn:active, .chickbtn:active { border-color: var(--bevel-d) #fff #fff var(--bevel-d); }
.chickbtn { display: grid; place-items: center; padding: 3px 6px; }
.chickbtn img { width: 18px; height: 18px; object-fit: contain; display: block; }
.chickbtn:hover { background: #fff7d6; }

/* =========================================================
   ライトボックス（画像拡大）
   ========================================================= */
.lightbox {
  position: fixed; inset: 0; z-index: 9500;
  display: grid; place-items: center; padding: 24px;
  background: rgba(44,28,28,.7);
  animation: pop .15s ease-out;
}
.lightbox.hidden { display: none; }
.lightbox__fig {
  max-width: 92vw; max-height: 86vh; text-align: center;
  background: #fff; padding: 10px; border-radius: 8px;
  border: 3px solid #fff; box-shadow: 6px 7px 0 rgba(0,0,0,.4);
}
.lightbox__fig img {
  display: block; max-width: 88vw; max-height: 74vh; object-fit: contain;
  border-radius: 4px; margin: 0 auto;
}
.lightbox__fig figcaption { margin-top: 8px; font-size: 13px; color: var(--ink); }
.lightbox__fig figcaption:empty { display: none; }
.lightbox__close {
  position: absolute; top: 16px; right: 18px;
  width: 38px; height: 34px; cursor: pointer;
  font-family: "Press Start 2P", monospace; font-size: 13px;
  background: var(--accent); color: #fff;
  border: 2px solid; border-color: #fff var(--accent-d) var(--accent-d) #fff; border-radius: 5px;
}
.lightbox__close:active { border-color: var(--accent-d) #fff #fff var(--accent-d); }

/* =========================================================
   ひよこレイン
   ========================================================= */
.chicks { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.chick {
  position: absolute; top: 0; left: 0; will-change: transform; user-select: none;
  object-fit: contain;
  filter: drop-shadow(1px 2px 0 rgba(68,38,38,.18));
}

/* =========================================================
   レスポンシブ（スマホ）
   ========================================================= */
@media (max-width: 600px) {
  /* モバイルはグリッド整列（位置固定）。JSのドラッグ／絶対配置は無効化 */
  .icons {
    position: static !important; display: grid;
    grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 14px;
  }
  .icon {
    position: static !important; left: auto !important; top: auto !important;
    width: 100%; cursor: pointer;
  }
  .window { width: calc(100% - 16px) !important; left: 8px !important; max-width: none; }
  .window__content { max-height: 56vh; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .startbtn { font-size: 10px; padding: 7px 10px; }
  .taskbar__tabs { display: none; }
}
