:root {
  --color-bg: #fff6e0;
  --color-primary: #ff5350;
  --color-primary-dark: #d8322f;
  --color-secondary: #3b6ee0;
  --color-accent: #ffcb05;
  --color-text: #2b2b2b;
  --color-card: #ffffff;
  --color-success: #45c26b;
  --color-miss: #ff8a3d;
  --radius: 18px;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  background: linear-gradient(180deg, var(--color-bg) 0%, #ffe9b8 100%);
  color: var(--color-text);
}

.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.big-title {
  text-align: center;
  font-size: clamp(28px, 5vw, 44px);
  color: var(--color-primary);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.08);
  margin: 8px 0 24px;
}

.card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 16px 32px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0,0,0,0.18);
  transition: transform 0.08s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,0.18); }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-secondary { background: var(--color-secondary); color: #fff; }
.btn-accent { background: var(--color-accent); color: #4a3800; }
.btn-block { display: block; width: 100%; text-align: center; }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  font-size: 22px;
  font-weight: 700;
}

.menu-item .icon { font-size: 40px; }

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  border: 3px solid #f0dca0;
  border-radius: 12px;
  margin-bottom: 16px;
}
input[type="text"]:focus, input[type="password"]:focus {
  outline: 3px solid var(--color-secondary);
  border-color: var(--color-secondary);
}

.form-label {
  font-weight: 700;
  margin-bottom: 6px;
  display: block;
}

.error-message {
  color: var(--color-primary-dark);
  background: #ffe3e3;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-weight: 700;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.topbar .user-name { font-weight: 700; }

.link-back {
  color: var(--color-secondary);
  font-weight: 700;
  text-decoration: none;
}

.duration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.duration-option {
  padding: 22px 8px;
  border-radius: var(--radius);
  border: 4px solid #f0dca0;
  background: #fffdf5;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.duration-option.selected {
  border-color: var(--color-secondary);
  background: #e7f0ff;
  color: var(--color-secondary);
}

table.history-table {
  width: 100%;
  border-collapse: collapse;
}
table.history-table th, table.history-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 2px solid #f3e6c4;
  font-size: 16px;
}
table.history-table th { color: #a07d1c; }

.role-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: var(--color-secondary);
  padding: 4px 20px 4px 4px;
  border-radius: 8px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%233b6ee0' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
}
.role-select:hover { background-color: #eef3ff; }
.role-select:focus { outline: 2px solid var(--color-secondary); outline-offset: 1px; }
.role-select:disabled { color: #999; cursor: default; background-color: transparent; }

.pokedex-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.pokedex-summary-item {
  background: #fffdf5;
  border: 3px solid #f0dca0;
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}
.pokedex-summary-item .label { font-size: 13px; color: #a07d1c; font-weight: 700; }
.pokedex-summary-item .value { font-size: 26px; font-weight: 900; color: var(--color-primary); }

.capture-chart svg { display: block; width: 100%; height: auto; }

.pokedex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.pokedex-card {
  background: #fffdf5;
  border-radius: var(--radius);
  border: 3px solid #f0dca0;
  padding: 12px;
  text-align: center;
}
.pokedex-card img { width: 80px; height: 80px; object-fit: contain; image-rendering: pixelated; }
.pokedex-card .name { font-weight: 700; margin-top: 6px; }
.pokedex-card .count { color: var(--color-secondary); font-weight: 700; }
.pokedex-card.uncaptured { opacity: 0.55; filter: grayscale(1); }
.pokedex-card.uncaptured .silhouette {
  width: 80px; height: 80px; margin: 0 auto;
  background: #ccc; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #888; font-weight: 900;
}

.best-record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.best-record-item {
  background: #fffdf5;
  border-radius: 14px;
  border: 3px solid #f0dca0;
  padding: 14px;
  text-align: center;
}
.best-record-item .duration { font-weight: 700; color: #a07d1c; }
.best-record-item .score { font-size: 26px; font-weight: 900; color: var(--color-primary); }

@media (max-width: 480px) {
  .card { padding: 16px; }
  .btn { padding: 14px 24px; font-size: 18px; }
}
