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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background-color: #0a0a14; /* 画像ロード前のフォールバック色 */
  background-size: cover;
  background-position: center;
  background-attachment: fixed; /* スクロールしても背景が固定される */
  color: #e0e0e0;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---- Auth screen ---- */

#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-box { text-align: center; padding: 2rem; }

.auth-box h1 {
  font-size: 2rem;
  margin-bottom: 2rem;
  color: #fff;
}

/* ---- Dashboard ---- */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo { font-size: 1.2rem; font-weight: bold; color: #fff; }

main { padding: 2rem; max-width: 1200px; margin: 0 auto; }

/* ---- Reminders ---- */

.reminders-box {
  background: rgba(255, 200, 0, 0.08);
  border: 1px solid rgba(255, 200, 0, 0.3);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
}

.reminders-box h2 {
  font-size: 0.85rem;
  color: #ffc800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.reminders-box ul { list-style: none; }

.reminders-box li {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.reminders-box li:last-child { border-bottom: none; }

.reminder-due { color: #ffc800; font-size: 0.85rem; }

/* ---- Links grid ---- */

#links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.link-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 1.2rem 1rem;
  text-decoration: none;
  color: #e0e0e0;
  font-size: 0.9rem;
  text-align: center;
  transition: background 0.15s, transform 0.1s;
  min-height: 70px;
}

.link-tile:hover {
  background: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}

/* ---- Buttons ---- */

button {
  background: #4285f4;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover { background: #3367d6; }

#signout-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
}

#signout-btn:hover { background: rgba(255,255,255,0.1); }

/* ---- Version ---- */

#version {
  position: fixed;
  bottom: 6px;
  right: 10px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.25);
  pointer-events: none;
}

/* ---- Header actions ---- */

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ---- Edit button ---- */

#edit-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
}

#edit-btn:hover { background: rgba(255,255,255,0.1); }

/* 編集モード中（「完了」表示時）は緑に変える */
#edit-btn.active {
  background: rgba(76,175,80,0.2);
  border-color: #4caf50;
  color: #4caf50;
}

/* ---- Add link form ---- */

#add-link-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  align-items: center;
}

#add-link-form input {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  color: #e0e0e0;
  font-size: 0.9rem;
  flex: 1;
  min-width: 120px;
}

#add-link-form input:focus {
  outline: none;
  border-color: rgba(255,255,255,0.5);
}

#add-link-form input::placeholder { color: rgba(255,255,255,0.3); }

#add-link-form button {
  background: rgba(66,133,244,0.85);
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ---- Edit mode tiles ---- */

.link-edit-tile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  color: #e0e0e0;
  font-size: 0.9rem;
  min-height: 70px;
}

.drag-handle {
  cursor: grab;
  color: rgba(255,255,255,0.35);
  font-size: 1.2rem;
  flex-shrink: 0;
  user-select: none;
  padding: 0 2px;
}

.drag-handle:active { cursor: grabbing; }

.tile-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-btn {
  background: transparent;
  border: 1px solid rgba(255,80,80,0.4);
  border-radius: 4px;
  color: rgba(255,120,120,0.9);
  padding: 0.15rem 0.45rem;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.1s;
}

.delete-btn:hover { background: rgba(255,80,80,0.25); }

/* SortableJS がドラッグ中に付与するクラス */
.tile-ghost { opacity: 0.35; }

/* ---- Background title ---- */

#bg-title {
  position: fixed;
  bottom: 6px;
  left: 10px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.2);
  pointer-events: none;
}

/* ---- Mobile ---- */

@media (max-width: 600px) {
  main { padding: 1rem; }
  header { padding: 0.8rem 1rem; }
  #links-grid { grid-template-columns: repeat(2, 1fr); }
}
