:root {
  --bg-dark: #121214;
  --bg-panel: #1e1e24;
  --text-main: #ffffff;
  --text-muted: #a0a0a0;
  --accent: #6c5ce7;
  --accent-hover: #5b4bc4;
  --danger: #ff4757;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden; /* 全体のスクロールを防ぐ */
}

.app-container {
  display: flex;
  height: 100%;
}

/* サイドバー */
.sidebar {
  width: 250px;
  background-color: var(--bg-panel);
  padding: 20px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #333;
}

.sidebar h2 {
  margin-bottom: 20px;
  font-size: 1.5rem;
  letter-spacing: 1px;
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin-bottom: 10px;
}

.sidebar button {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  text-align: left;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s, color 0.2s;
}

.sidebar button:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.sidebar button.active {
  background-color: var(--accent);
  color: #ffffff;
}

/* メインコンテンツ */
.content {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.view {
  width: 100%;
  height: 100%;
  padding: 20px;
  display: none;
  flex-direction: column;
}

.view.active-view {
  display: flex;
}

/* webview はフルサイズに */
webview {
  display: inline-flex;
  flex: 1;
  width: 100%;
  height: 100%;
  background: #fff;
}

/* ゲームランチャー部分 */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  overflow-y: auto;
  padding-right: 10px;
}

/* スクロールバーのカスタマイズ (Webkit) */
.games-grid::-webkit-scrollbar {
  width: 8px;
}
.games-grid::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

.game-card {
  background-color: var(--bg-panel);
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 1; /* 正方形に近付ける */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.game-card:hover {
  transform: translateY(-5px);
  background-color: #2a2a32;
}

.game-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin: 0 auto 15px;
  border-radius: 8px;
}

.game-card .icon-placeholder {
  width: 64px;
  height: 64px;
  margin: 0 auto 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #333;
  border-radius: 8px;
  font-size: 24px;
}

.game-card h3 {
  font-size: 1rem;
  margin-bottom: 5px;
  word-break: break-word; /* 長い単語で改行 */
}

.game-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--danger);
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 24px;
  display: none;
  text-align: center;
}

.game-card:hover .btn-delete {
  display: block;
}

.btn-delete:hover {
  background: #ff6b81;
}

/* 汎用ボタン */
button {
  font-family: inherit;
}

.btn-primary {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s;
}
.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid #555;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* モーダル */
.modal {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-panel);
  padding: 30px;
  border-radius: 10px;
  width: 450px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.modal-content h3 {
  margin-bottom: 20px;
  font-size: 1.25rem;
}

form label {
  display: block;
  margin-bottom: 15px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
form input, form select {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  background: #2a2a32;
  border: 1px solid #444;
  color: white;
  border-radius: 4px;
}
form input:focus, form select:focus {
  outline: none;
  border-color: var(--accent);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
}
