
body {
  margin: 0;
  background: #111;
  padding: 10px;
  color: white;
  font-family: sans-serif;

  /* Lock the main browser window from scrolling */
  overflow: hidden; 
  /* Recommended: Ensures padding is included in height calculations */
  box-sizing: border-box;
}

/* ============================
   APP TITLE BUTTON (GPUSims)
   ============================ */
.app-title-button {
  /* Resets & Typography */
  background-color: transparent;
  color: var(--text-main);
  font-size: 24px;
  font-weight: 800;
  font-family: inherit;
  letter-spacing: 1px;
  
  /* Layout & Borders */
  padding: 8px 16px;
  border: 2px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  
  /* Smooth transitions for interactions */
  transition: all 0.2s ease-in-out;
}

/* Make the "GPU" part stand out using your accent color */
.app-title-button .brand-accent {
  color: var(--accent-focus);
}

/* Hover State: Subtle background, border, and a soft glow */
.app-title-button:hover {
  background-color: var(--bg-element);
  border-color: var(--accent-focus);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(67, 56, 202, 0.4); /* Uses --accent-focus hex with opacity */
}

/* Active/Click State: Slight shrink effect */
.app-title-button:active {
  background-color: var(--bg-element-hover);
  border-color: var(--accent-active);
  transform: scale(0.97);
  box-shadow: none;
}

/* 全体を囲む view クラスの設定 */
.view {
  /* min-height: 100vh; の代わりに以下を使用 */
  height: calc(100vh - 20px); /* 100vh から body の padding (上下10pxずつ) を引く */
  display: grid;      
  grid-template-rows: auto 1fr auto; 
}

/* メインエリアのスクロール設定（推奨） */
main {
  overflow-y: auto;   /* このまま残します */
  padding-right: 5px; /* スクロールバーがコンテンツに被らないように少し余白を入れると綺麗です */
}

/* headerタグ自体をGridコンテナにする */
header {
  display: grid;
  align-items: center; /* 縦方向の中央揃え */
  padding: 0 16px;     /* 左右が画面端にピッタリくっつかないように少し余白を設ける（お好みで） */
  margin-bottom: 10px;
}

/* headerの直下にある3つのクラスを、すべて同じ「1行目・1列目」に重ねて配置する */
header > .at-left,
header > .at-center,
header > .at-right {
  grid-area: 1 / 1;
}

.one-row {
  display: grid;
  align-items: center; /* 縦方向の中央揃え */
  padding: 0 16px;     /* 左右が画面端にピッタリくっつかないように少し余白を設ける（お好みで） */
}

/* headerの直下にある3つのクラスを、すべて同じ「1行目・1列目」に重ねて配置する */
.one-row > .at-left,
.one-row > .at-center,
.one-row > .at-right {
  grid-area: 1 / 1;
}

/* それぞれ独立して横方向の配置場所を指定 */
.at-left {
  justify-self: start;  /* 左端へ配置 */
}

.at-center {
  justify-self: center; /* 中央へ配置 */
}

.at-right {
  justify-self: end;    /* 右端へ配置 */
}

.main-canvas-grid {
    display: grid;
    grid-template-columns: 80% 20%;

}

#main-canvas, #thumbnail-img {
    aspect-ratio: 16 / 9;
    width: 100%;
    height: auto;
}



/* >>>>>================================================== accordion */

/* Style the main container */
.accordion {
  width: 100%;
  font-family: sans-serif;
}

/* Style the clickable header */
details summary {
  padding: 15px;
  border-bottom: 1px solid #ddd;
  cursor: pointer;
  font-weight: bold;
  list-style: none; /* Removes the default arrow in standard browsers */
}

/* Remove default arrow in WebKit (Safari/Chrome) */
details summary::-webkit-details-marker {
  display: none;
}

/* Add our custom +/- icon BEFORE the text */
details summary::before {
  content: "+";
  display: inline-block;
  font-size: 1.2rem;
  width: 20px;
  margin-right: 10px;
  text-align: center;
}

/* Change icon to '-' when open */
details[open] summary::before {
  content: "-";
}

/* Style the content area */
details .content {
  padding: 15px;
  border-bottom: 1px solid #ddd;
}

/* <<<<<================================================== accordion */


#article-view {
    display: grid;
    grid-template-rows: auto auto auto 1fr; 
    
    /* 以下を追記・修正 */
    position: fixed;      /* 画面に対して位置を固定（bodyのスクロールを無視） */
    top: 0;
    left: 0;
    width: 100vw;         /* 画面幅いっぱい */
    height: 100vh;        /* 画面高さいっぱい */
    z-index: 100;         /* 他の画面より最前面に表示させる */
    
    /* ※重要※ 背景を塗りつぶさないと裏の画面が透けてしまいます */
    /* background-color: var(--bg-page, #121212);  */
 
    padding: 20px; /* 画面の端（上下左右）からの余白 */
    gap: 16px;     /* 各行（ヘッダー、タイトル、タグ、エディタ領域）の間の余白 */
    box-sizing: border-box; /* 画面からはみ出さないための必須設定 */
}

#markdown-editor {
    height: 100%;
    max-width: none; /* 横幅800pxの制限を解除して画面半分に広げる場合 */
}

#markdown-preview {
    height: 100%;
    overflow-y: auto;
    margin-left: 20px;
}

#sub-canvases {
    display: none;
}

.sub-canvas-wrapper{
    display: inline-block;
}

/* ========================================================
   ARTICLES & BOX LAYOUT (Responsive Grid)
   Horizontal layout: Image Left, Text Right
   ======================================================== */

#articles {
  display: grid;
  /* minmax(400px, 1fr) ensures 1 column on portrait mobile, 
     but automatically flows into multiple columns on wider screens. */
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  width: 100%;
  margin: 0;
  padding: 0;
}

.box {
  width: 100%;
  height: 100%; 
  margin: 0;
  display: flex;
  
  /* Change to row so the image and text sit side-by-side */
  flex-direction: row; 
  
  background-color: var(--bg-element);
  border: 1px solid var(--border-idle);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.box:hover {
  background-color: var(--bg-element-hover);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.box-thumbnail {
  /* Restrict thumbnail width so the text has room on the right */
  width: 40%; 
  min-width: 120px; /* Allows it to shrink nicely on narrow mobile screens */
  max-width: 200px; /* <--- THE FIX: Caps the width, which limits the max height to ~112px */  
  aspect-ratio: 16 / 9; 
  background-color: #000;
  flex-shrink: 0;
}

.box-thumbnail img, 
.box-thumbnail canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.box-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1; /* Expands to fill the remaining horizontal space */
  justify-content: center; /* Vertically centers the text content */
}

.box-title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-main);
  margin: 0 0 8px 0;
  overflow-wrap: break-word;
  
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.box-user-id {
  font-size: 0.85rem;
  color: #aaa;
  margin-top: auto; 
}

.box-meta {
  font-size: 0.85rem;
  color: #888;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* >>>>>================================================== Wizard */

.vibe-coding-wizard {
  margin: 0 auto; 
  padding: 20px;
  
  /* Add these 3 lines to enable scrolling */
  height: calc(100vh - 20px); /* Matches the available screen height */
  overflow-y: auto;           /* Tells the browser to add a scrollbar when content overflows */
  box-sizing: border-box;     /* Ensures the 20px padding doesn't push the height past 100vh */
}

.vibe-coding-wizard h1 {
  text-align: center;
  color: var(--text-main);
  margin-bottom: 32px;
}

.wizard-steps {
  list-style-position: inside;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 20px; /* Space between each step card */
}

/* Make each step a distinct card */
.wizard-steps li {
  background-color: var(--bg-element);
  border: 1px solid var(--border-idle);
  border-radius: 12px;
  padding: 24px;
  font-size: 1.1rem;
  line-height: 1.6;
}

/* Align the text immediately following the number */
.wizard-steps li p {
  display: inline;
  margin: 0 0 16px 0;
}

/* Ensure buttons drop to their own line with some spacing */
.wizard-steps li button {
  display: block;
  margin-top: 16px;
}

/* Ensure textareas stay within the card bounds */
.wizard-steps li textarea {
  width: 100%;
  box-sizing: border-box;
  /* margin-top: 16px; */
}

/* Hint Box 
  Overrides the light-mode inline styles to match the dark theme 
*/
.vibe-coding-wizard .hint-box {
  background-color: rgba(55, 48, 163, 0.15) !important; /* Subtle tint based on your accent */
  border-left: 4px solid var(--accent-focus) !important;
  border-radius: 0 8px 8px 0;
  padding: 16px !important;
  margin: 20px 0 0 0;
  color: var(--text-main);
}

.vibe-coding-wizard .hint-box p {
  display: block;
  margin-bottom: 8px;
}

.vibe-coding-wizard .hint-box p:last-child {
  margin-bottom: 0;
}

/* <<<<<================================================== Wizard */

.toast {
  visibility: hidden;
  background-color: #333;
  color: #fff;
  padding: 8px 16px;
  border-radius: 24px; 
  border-style: solid;
  border-width: 1;
  position: absolute; /* Crucial: Allows us to place it anywhere */
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s, visibility 0.3s;
  white-space: nowrap; /* Prevents the text from wrapping awkwardly */
}

.toast.show {
  visibility: visible;
  opacity: 1;
}


/* ============================
   CSS VARIABLES (THEME)
   ============================ */
:root {
  /* Tells the browser's native UI (like suggestion popups) to use dark mode */
  color-scheme: dark; 

  /* Backgrounds */
  --bg-page: #121212;
  --bg-element: #27272a;
  --bg-element-hover: #3f3f46;
  
  /* Text */
  --text-main: #e4e4e7;
  
  /* Borders */
  --border-idle: #3f3f46;
  --border-hover: #52525b;
  
  /* Accent Colors */
  --accent-base: #3730a3;   
  --accent-hover: #312e81;  
  --accent-active: #1e1b4b; 
  --accent-focus: #4338ca;  
}

/* Base page background */
/* body {
  background-color: var(--bg-page);
  color: var(--text-main);
  padding: 20px;
} */

/* ============================
   1. BUTTON
   ============================ */
button {
  padding: 12px 20px;
  font-size: 16px;
  border: none;
  border-radius: 24px; 
  background-color: var(--accent-base);
  color: var(--text-main);
  cursor: pointer;
}

button:hover {
  background-color: var(--accent-hover);
}

button:active {
  background-color: var(--accent-active);
}

/* ============================
   2. TEXT, SEARCH, NUMBER, TEXTAREA & SELECT
   ============================ */
input[type="text"],
input[type="search"],
input[type="number"],
textarea,
select {
  -webkit-appearance: none; 
  appearance: none;
  padding: 10px 16px;
  font-size: 16px;
  font-family: inherit;
  border: 2px solid var(--border-idle);
  border-radius: 12px; 
  background-color: var(--bg-element);
  color: var(--text-main);
  outline: none; 
}

/* Hover State */
input[type="text"]:hover,
input[type="search"]:hover,
input[type="number"]:hover,
textarea:hover,
select:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-element-hover);
}

/* Focus/Click State */
input[type="text"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-focus);
}

/* 
  FIX FOR BROWSER AUTOFILL / SUGGESTION POPUPS
  Overrides the forced white background and black text on autofill 
*/
input:-webkit-autofill,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-main);
  -webkit-box-shadow: 0 0 0px 1000px var(--bg-element) inset;
}

/* Maintain hover background color during autofill */
input:-webkit-autofill:hover,
textarea:-webkit-autofill:hover,
select:-webkit-autofill:hover {
  -webkit-box-shadow: 0 0 0px 1000px var(--bg-element-hover) inset;
}

/* Specifics for Select */
select {
  cursor: pointer;
}

/* Specifics for Textarea */
textarea {
  resize: vertical;
  min-height: 80px; 
}

/* ============================
   3. INPUT: RANGE
   ============================ */
input[type="range"] {
  -webkit-appearance: none; 
  appearance: none;
  width: 100%;
  background: transparent;
  outline: none;
}

/* Range Track (Webkit/Blink) */
input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 12px;
  background-color: var(--border-idle);
  border-radius: 12px; 
}

input[type="range"]:hover::-webkit-slider-runnable-track {
  background-color: var(--border-hover);
}

/* Range Thumb (Webkit/Blink) */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 24px;
  width: 24px;
  background-color: var(--accent-base);
  border-radius: 50%; 
  margin-top: -6px; 
  cursor: pointer;
  border: none;
}

input[type="range"]:hover::-webkit-slider-thumb {
  background-color: var(--accent-hover);
}

input[type="range"]:active::-webkit-slider-thumb {
  background-color: var(--accent-active);
}

/* Range Track (Firefox) */
input[type="range"]::-moz-range-track {
  width: 100%;
  height: 12px;
  background-color: var(--border-idle);
  border-radius: 12px;
}

input[type="range"]:hover::-moz-range-track {
  background-color: var(--border-hover);
}

/* Range Thumb (Firefox) */
input[type="range"]::-moz-range-thumb {
  height: 24px;
  width: 24px;
  background-color: var(--accent-base);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

input[type="range"]:hover::-moz-range-thumb {
  background-color: var(--accent-hover);
}

input[type="range"]:active::-moz-range-thumb {
  background-color: var(--accent-active);
}