@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&family=Zen+Antique+Soft&family=Yuji+Syuku&display=swap');

:root {
  --bg-color: #2d1b14;
  --bg-secondary: #3d2518;
  --card-bg: #f5f0e1;
  --card-border: #8b7355;
  --accent: #c41e3a;
  --accent-hover: #a01830;
  --text: #f5f0e1;
  --text-muted: #a89880;
  --text-dark: #2d1b14;
  --win: #2e8b57;
  --lose: #c41e3a;
  --draw: #daa520;
  --gold: #d4af37;
  --font-brush: 'Yuji Syuku', serif;
  --font-main: 'Zen Antique Soft', serif;
}

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

body {
  font-family: var(--font-main), 'Noto Sans JP', sans-serif;
  background: var(--bg-color) url("/assets/backg-c47be8e9.webp") repeat;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.8;
}

/* Header */
.header {
  background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-color));
  padding: 1rem;
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}

.logo-img {
  height: 36px;
  width: auto;
}

.nav {
  display: flex;
  gap: 1rem;
}

.nav a {
  color: var(--text);
  text-decoration: none;
}

.nav a:hover {
  color: var(--accent);
}

/* ゲーム中はヘッダーを非表示 */
body.games-play .header,
body.games-round_result .header,
body.games-result .header {
  display: none;
}

/* Main */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 0.5rem;
}

/* Flash */
.flash {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  text-align: center;
}

.flash.notice {
  background: rgb(78, 204, 163);
  border: 1px solid var(--win);
  color: #1a1a2e;
}

.flash.alert {
  background: rgb(233, 69, 96);
  border: 1px solid var(--lose);
  color: #fff;
}

/* Buttons */
.btn {
  font-family: var(--font-brush);
  background: linear-gradient(to bottom, var(--accent), #8b0000);
  color: white;
  border: 2px solid var(--gold);
  padding: 0.8rem 2.5rem;
  font-size: 1.1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.btn:hover {
  background: linear-gradient(to bottom, #d4243e, var(--accent));
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

.btn:disabled {
  background: #5a5a5a;
  border-color: #777;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-large {
  padding: 1rem 3rem;
  font-size: 1.3rem;
}

.btn-secondary {
  background: linear-gradient(to bottom, #5a4a3a, #3d2518);
  border-color: var(--card-border);
}

.btn-secondary:hover {
  background: linear-gradient(to bottom, #6a5a4a, #4d3528);
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

/* Home */
.home {
  text-align: center;
  padding: 0.5rem 1rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home-logo {
  max-width: 420px;
  height: auto;
  display: block;
}

.home-logo-wrapper {
  position: relative;
  display: inline-block;
  overflow: hidden;
  isolation: isolate;
  margin-bottom: 1.5rem;
}

.home-logo-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    transparent 40%,
    rgba(255, 255, 255, 0.7) 50%,
    transparent 60%,
    transparent 100%
  );
  background-size: 300% 100%;
  background-position: 100% 0;
  -webkit-mask-image: url("/assets/logo-03fd7312.webp");
  mask-image: url("/assets/logo-03fd7312.webp");
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: top left;
  mask-position: top left;
  animation: shine-mask 1s ease-in-out 0.2s forwards;
  pointer-events: none;
}

@keyframes shine-mask {
  0% {
    background-position: 150% 0;
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  95% {
    background-position: -50% 0;
    opacity: 1;
  }
  100% {
    background-position: -50% 0;
    opacity: 0;
  }
}

@keyframes shine {
  0% {
    left: -100%;
  }
  100% {
    left: 150%;
  }
}

.subtitle {
  font-family: var(--font-main);
  font-size: 1.3rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.guest-notice {
  font-size: 1rem;
  color: #ffeb3b;
  margin-top: 0.3rem;
  margin-bottom: 0;
  font-weight: bold;
  text-shadow: 0 0 8px #000, 0 0 15px #000, 0 0 25px rgba(0, 0, 0, 0.9);
}

.game-description {
  max-width: 700px;
  margin-top: 2rem;
  text-align: left;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--card-border);
}

.game-description h2 {
  font-family: var(--font-brush);
  font-size: 1.5rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 0.3rem;
}

.game-description ol {
  padding-left: 1.5rem;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1.4;
}

.game-description li {
  margin-bottom: 0.2rem;
}

.game-description ol li::marker {
  color: #e91e63;
  font-weight: bold;
}

.game-description .coming-soon {
  text-align: center;
  color: #fff;
  font-size: 0.95rem;
  margin-top: 1rem;
  margin-bottom: 0;
}

.game-description ul {
  padding-left: 1.5rem;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1.4;
}

.game-description ul li {
  margin-bottom: 0.2rem;
}

.member-benefits {
  margin-top: 1.5rem;
  border-top: 1px solid var(--card-border);
  padding-top: 1.2rem;
}

.member-benefits h3 {
  font-family: var(--font-brush);
  font-size: 1.5rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 0.2rem;
}

.member-benefits ul {
  padding-left: 1.5rem;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.4;
}

.register-cta {
  text-align: center;
  margin-top: 1.2rem;
}

.btn-register {
  background: linear-gradient(to bottom, var(--gold), #b8960b);
  color: #1a1a2e;
  border-color: #8b7355;
}

.btn-register:hover {
  background: linear-gradient(to bottom, var(--accent), #8b0000);
}

/* Game Setup */
.game-setup {
  max-width: 1080px;
  margin: 0 auto;
  text-align: center;
}

.game-setup h1 {
  font-family: var(--font-brush);
  text-align: center;
  margin-bottom: 2rem;
  color: var(--gold);
  font-size: 2rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.setup-title {
  font-family: var(--font-brush);
  text-align: center;
  margin-bottom: 1rem;
  color: var(--gold);
  font-size: 2rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* Theme Grid - mobile first (vertical stack) */
.theme-grid {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.theme-card {
  background: linear-gradient(135deg, #f5f0e1 0%, #e8e0c8 100%);
  border: 3px solid var(--card-border);
  border-radius: 8px;
  padding: 1.2rem;
  cursor: pointer;
  display: block;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
  transition: all 0.2s;
  text-align: center;
}

.theme-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.theme-card input {
  display: none;
}

.theme-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent);
}

.theme-card-placeholder {
  cursor: default;
  opacity: 0.8;
}

.theme-card-placeholder:hover {
  transform: none;
  border-color: var(--card-border);
}

.theme-name {
  font-family: var(--font-brush);
  font-size: 1.5rem;
  color: var(--text-dark);
  display: block;
  margin-bottom: 0.5rem;
}

.theme-desc {
  font-family: var(--font-main);
  font-size: 1rem;
  color: var(--card-border);
}

/* CPU Select Page - Carousel */
.cpu-select {
  max-width: 100%;
  margin: 0 auto;
  text-align: center;
  padding: 0 1rem;
}

.cpu-form {
  text-align: center;
}

.carousel-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem 0;
}

.carousel-track {
  width: 95vw;
  max-width: 600px;
  aspect-ratio: 1 / 1;
  position: relative;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.carousel-slide.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.cpu-image-large {
  width: 100%;
  height: 100%;
  border: 4px solid var(--card-border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 4px 4px 12px rgba(0,0,0,0.3);
  overflow: hidden;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0f0f1a 50%, #050510 100%);
}

.cpu-image-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cpu-image-large .placeholder-text {
  font-family: var(--font-main);
  font-size: 2rem;
  color: var(--text-muted);
  position: absolute;
}

.cpu-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  text-align: center;
  border-radius: 0 0 12px 12px;
}

.cpu-name {
  font-family: var(--font-brush);
  font-size: 1.8rem;
  color: #fff;
  display: block;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.cpu-difficulty {
  font-family: var(--font-main);
  font-size: 1rem;
  padding: 0.2rem 0.8rem;
  border-radius: 20px;
  display: inline-block;
  margin-top: 0.3rem;
}

.difficulty-easy {
  background: #4caf50;
  color: white;
}

.difficulty-normal {
  background: #ff9800;
  color: white;
}

.difficulty-hard {
  background: #f44336;
  color: white;
}

.carousel-btn {
  background: rgba(255,255,255,0.7);
  border: 2px solid var(--gold);
  color: var(--gold);
  font-size: 2.5rem;
  width: 150px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding-bottom: 4px;
}

.carousel-prev::before {
  content: '‹';
  animation: arrow-left 0.4s ease-in-out 3;
}

.carousel-next::after {
  content: '›';
  animation: arrow-right 0.4s ease-in-out 3;
}

@keyframes arrow-left {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-5px); }
}

@keyframes arrow-right {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

.carousel-btn:hover {
  background: var(--gold);
  color: var(--bg-dark);
}

.carousel-btn:active {
  transform: scale(0.95);
}

.carousel-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin: 0.5rem 0 1.5rem;
}

.carousel-counter {
  font-family: var(--font-main);
  font-size: 1.2rem;
  color: var(--text-light);
  min-width: 60px;
  text-align: center;
}

/* Desktop carousel */
@media (min-width: 769px) {
  .carousel-track {
    width: 60vw;
    max-width: 550px;
  }
}

/* Game Exit */
.game-exit {
  position: relative;
}

.exit-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  z-index: 100;
  transition: color 0.2s;
}

.exit-link:hover {
  color: var(--gold);
}

/* Confirm Modal */
.confirm-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.confirm-modal.active {
  display: flex;
}

.confirm-modal-content {
  background: linear-gradient(135deg, #f5f0e1 0%, #e8e0c8 100%);
  border: 4px solid var(--gold);
  border-radius: 12px;
  padding: 2rem 3rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.confirm-message {
  font-family: var(--font-brush);
  font-size: 1.4rem;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
}

.confirm-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.confirm-buttons .btn {
  min-width: 80px;
}

.btn-cancel {
  background: linear-gradient(to bottom, #888 0%, #666 100%);
}

.btn-cancel:hover {
  background: linear-gradient(to bottom, #777 0%, #555 100%);
}

/* Game Board */
.game-board {
  max-width: 1080px;
  margin: 0 auto;
}

.round-info {
  font-family: var(--font-brush);
  text-align: center;
  color: var(--gold);
  margin-bottom: 0.3rem;
  font-size: 1.2rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.parent-card {
  background: linear-gradient(135deg, #f5f0e1 0%, #e8e0c8 100%);
  border: 4px solid var(--gold);
  border-radius: 8px;
  padding: 0.8rem 2rem;
  text-align: center;
  margin-bottom: 1rem;
  box-shadow:
    0 4px 12px rgba(0,0,0,0.3),
    inset 0 0 30px rgba(212,175,55,0.1);
  position: relative;
  overflow: hidden;
}

.parent-card-cpu {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  height: 120%;
  width: auto;
  opacity: 0.4;
  z-index: 0;
  pointer-events: none;
}

.parent-card::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border: 2px solid rgba(212,175,55,0.4);
  border-radius: 4px;
  pointer-events: none;
}

.card-label {
  font-family: var(--font-brush);
  font-size: 1.4rem;
  color: var(--card-border);
  margin-bottom: 0.3rem;
  position: relative;
  z-index: 1;
}

.card-name {
  font-family: var(--font-brush);
  font-size: 1.6rem;
  color: var(--text-dark);
  letter-spacing: 0.1em;
  position: relative;
  z-index: 1;
}

/* Compact parent card for round result */
.parent-card-wrapper {
  position: relative;
  margin-bottom: 0.5rem;
  z-index: 1;
}

.parent-card-compact {
  padding: 0.4rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.parent-card-compact::before {
  display: none;
}

.card-label-inline {
  font-family: var(--font-brush);
  font-size: 1.1rem;
  color: var(--card-border);
}

.card-name-inline {
  font-family: var(--font-brush);
  font-size: 1.3rem;
  color: var(--text-dark);
  letter-spacing: 0.05em;
}

.result-cpu-image {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 480px;
  height: 480px;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

.hand-section {
  margin-bottom: 2rem;
}

.hand-instruction {
  font-family: var(--font-main);
  text-align: center;
  color: var(--text);
  margin: 0;
  font-size: 1.1rem;
}

.hand {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  max-width: 648px;
  margin: 0 auto;
}

.card {
  background: linear-gradient(135deg, #f5f0e1 0%, #e8e0c8 100%);
  border: 3px solid var(--card-border);
  border-radius: 8px;
  padding: 1rem 0.5rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  box-shadow:
    2px 2px 4px rgba(0,0,0,0.3),
    inset 0 0 20px rgba(139,115,85,0.1);
}

.card::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 1px solid rgba(139,115,85,0.3);
  border-radius: 3px;
  pointer-events: none;
}

.card input {
  display: none;
}

.card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.card.selected {
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px var(--accent),
    0 8px 16px rgba(196,30,58,0.3);
  background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
}

.selection-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--accent);
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: bold;
  border: 2px solid var(--gold);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  z-index: 10;
}

.card-content {
  font-family: var(--font-brush);
  writing-mode: vertical-rl;
  text-orientation: upright;
  color: var(--text-dark);
  font-size: 1.3rem;
  line-height: 1.4;
  letter-spacing: 0.15em;
  text-align: center;
}

.submit-form {
  text-align: center;
}

/* Round Result */
.round-result {
  text-align: center;
  max-width: 1080px;
  margin: 0 auto;
  position: relative;
  padding-top: 180px;
}

.result-display {
  font-family: var(--font-brush);
  font-size: 3.5rem;
  margin-bottom: 0.2rem;
  text-shadow:
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff,
    0 0 10px rgba(0,0,0,0.8),
    0 0 20px rgba(0,0,0,0.6);
  letter-spacing: 0.2em;
  position: relative;
  z-index: 2;
}

.result-display.win { color: var(--win); }
.result-display.lose { color: var(--lose); }
.result-display.draw { color: var(--draw); }

.cards-display {
  display: flex;
  justify-content: space-around;
  margin-bottom: 2rem;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.player-cards,
.cpu-cards {
  flex: 1;
}

.player-cards h3,
.cpu-cards h3 {
  font-family: var(--font-brush);
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 1rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.cards-display .card {
  cursor: default;
  margin-bottom: 0.5rem;
}

.phrase {
  background: linear-gradient(135deg, #f5f0e1 0%, #e8e0c8 100%);
  border: 3px solid var(--card-border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  margin-top: 0.5rem;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.phrase .word {
  display: block;
  font-family: var(--font-brush);
  color: var(--text-dark);
  font-size: clamp(0.5rem, 3.5vw, 1.32rem);
  letter-spacing: 0.05em;
  margin-bottom: 0.1rem;
  white-space: nowrap;
}

.phrase .word:last-child {
  margin-bottom: 0;
}

.score-display {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  font-family: var(--font-brush);
  font-size: 1.65rem;
  background: linear-gradient(135deg, #f5f0e1 0%, #e8e0c8 100%);
  border-radius: 8px;
  padding: 0.4rem 1.5rem;
  box-shadow:
    0 4px 8px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.5);
  max-width: 672px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 1;
}

.round-result .btn {
  position: relative;
  z-index: 1;
}

.score-display .wins { color: var(--win); text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.score-display .losses { color: var(--lose); text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.score-display .draws { color: var(--draw); text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }

/* Final Result */
.final-result {
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
  padding-top: 180px;
}

.result-banner {
  font-family: var(--font-brush);
  font-size: 4rem;
  margin-bottom: 0.2rem;
  text-shadow:
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff,
    0 0 10px rgba(0,0,0,0.8),
    0 0 20px rgba(0,0,0,0.6);
  letter-spacing: 0.3em;
  position: relative;
  z-index: 2;
}

.result-banner.win {
  color: #ff4444;
}

.result-banner.lose {
  color: #4a0080;
  position: relative;
  display: inline-block;
  animation: appear 2s ease-out forwards;
}

@keyframes appear {
  0% {
    filter: blur(4px) drop-shadow(0 15px 30px rgba(74, 0, 128, 0.1));
    opacity: 0;
  }
  30% {
    filter: blur(3px) drop-shadow(0 10px 20px rgba(74, 0, 128, 0.2));
    opacity: 0.3;
  }
  60% {
    filter: blur(1px) drop-shadow(0 5px 10px rgba(74, 0, 128, 0.4));
    opacity: 0.7;
  }
  100% {
    filter: blur(0px) drop-shadow(0 0 5px rgba(74, 0, 128, 0.5));
    opacity: 1;
  }
}
.result-banner.draw { color: var(--draw); }

.final-score {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, #f5f0e1 0%, #e8e0c8 100%);
  border-radius: 8px;
  padding: 1rem 2rem;
  box-shadow:
    0 4px 8px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.5);
  position: relative;
  z-index: 1;
}

.final-result .parent-card {
  position: relative;
  z-index: 1;
}

.final-result .actions {
  position: relative;
  z-index: 1;
}

.score-item {
  text-align: center;
}

.score-item .label {
  font-family: var(--font-main);
  display: block;
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.score-item .value {
  font-family: var(--font-brush);
  font-size: 2.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.score-item.wins .value { color: var(--win); }
.score-item.draws .value { color: var(--draw); }
.score-item.losses .value { color: var(--lose); }

.actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Import */
.import-page {
  max-width: 700px;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.7);
  padding: 2rem;
  border-radius: 12px;
}

.import-page h1 {
  text-align: center;
  color: var(--gold);
  margin-bottom: 1.5rem;
}

.existing-pack-notice {
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.existing-pack-notice .notice-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.tab-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  padding: 0.8rem 1rem;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: #1a1a2e;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--gold);
  color: #1a1a2e;
  border-color: var(--gold);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.form-section {
  margin-bottom: 2rem;
}

.form-section h3 {
  color: var(--gold);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.form-section .max-notice {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.card-counter,
.chip-counter {
  font-size: 0.9rem;
  color: var(--gold);
  margin-left: 0.5rem;
  font-weight: normal;
}

/* Chip Form */
.chip-input-wrapper {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.chip-input-wrapper .input-field {
  flex: 1;
}

.btn-add-chip {
  background: var(--gold);
  color: #1a1a2e;
  border: none;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  white-space: nowrap;
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
}

.btn-add-chip:hover {
  background: #b8960b;
}

.chip-list-wrapper {
  margin-top: 0.5rem;
}

.chip-list-wrapper.collapsed .chip-list {
  display: none;
}

.chip-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.3rem 0;
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
}

.chip-toggle:hover {
  color: var(--gold);
}

.toggle-icon {
  display: inline-block;
  width: 1em;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
}

.chip-text {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-remove {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  opacity: 0.7;
}

.chip-remove:hover {
  opacity: 1;
}

.form-actions {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 2rem;
}

.form-actions .btn {
  white-space: nowrap;
  font-size: clamp(0.75rem, 3vw, 1rem);
  padding: 0.6rem 0.8rem;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.form-section .hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.input-field {
  width: 100%;
  padding: 0.8rem 1rem;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: #1a1a2e;
  font-size: 1rem;
}

.input-field:focus {
  outline: none;
  border-color: var(--gold);
}

.input-field::placeholder {
  color: #888;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.card-input {
  display: flex;
  gap: 0.5rem;
}

.btn-add {
  background: transparent;
  border: 1px dashed var(--gold);
  color: var(--gold);
}

.btn-add:hover {
  background: rgba(212, 175, 55, 0.2);
}

.btn-add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.file-input {
  width: 100%;
  padding: 1rem;
  background: #fff;
  border: 1px dashed var(--card-border);
  border-radius: 8px;
  color: #1a1a2e;
}

.format-guide {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 2rem;
}

.format-guide h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--gold);
}

.format-guide pre {
  background: var(--bg-color);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.85rem;
}

.import-form .field {
  margin-bottom: 1rem;
}

.import-form label {
  display: block;
  margin-bottom: 0.5rem;
}

/* Mypage */
.mypage {
  max-width: 600px;
  margin: 0 auto;
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  color: #1a1a2e;
}

.mypage h1 {
  margin-bottom: 2rem;
  text-align: center;
  color: #5a3d2b;
}

.stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 2rem;
  background: rgba(139, 90, 43, 0.15);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--card-border);
}

.stat-item {
  text-align: center;
}

.stat-item .label {
  display: block;
  font-size: 0.9rem;
  color: #666;
}

.stat-item .value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #8b5a2b;
}

.mypage-actions {
  margin-bottom: 2rem;
  text-align: center;
}

.btn-theme-create {
  display: inline-block;
  background: #c9a227;
  color: #1a1a2e;
  padding: 1rem 2rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: bold;
  font-size: 1.1rem;
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
  transition: background 0.2s;
}

.btn-theme-create:hover {
  background: #a8871f;
}

.mypage h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: #5a3d2b;
}

.records {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.record-item {
  background: var(--card-bg);
  color: #1a1a2e;
  padding: 0.8rem 1rem;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 3px solid var(--card-border);
}

.record-item.win { border-left-color: var(--win); }
.record-item.lose { border-left-color: var(--lose); }
.record-item.draw { border-left-color: var(--draw); }

.record-item .theme {
  font-weight: bold;
}

.record-item .difficulty {
  font-size: 0.9rem;
  color: #666;
}

.record-item .result {
  font-weight: bold;
}

.record-item .date {
  font-size: 0.9rem;
  color: #666;
}

/* Admin */
.admin-body {
  background: #f5f5f5;
  color: #333;
}

.admin-header {
  background: #333;
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header .logo {
  color: white;
}

.admin-header nav {
  display: flex;
  gap: 1rem;
}

.admin-header nav a {
  color: white;
  text-decoration: none;
}

.admin-main {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.admin-users h1,
.admin-settings h1 {
  margin-bottom: 1rem;
}

.users-table {
  width: 100%;
  background: white;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  padding: 0.8rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.users-table th {
  background: #f0f0f0;
}

.admin-settings .field {
  margin-bottom: 1rem;
}

.admin-settings label {
  display: block;
  margin-bottom: 0.3rem;
}

.admin-settings input[type="number"] {
  padding: 0.5rem;
  width: 100px;
}

/* Devise forms */
.devise-form {
  max-width: 400px;
  margin: 0 auto;
  background: linear-gradient(135deg, rgba(61,37,24,0.9), rgba(45,27,20,0.95));
  padding: 2.5rem;
  border-radius: 12px;
  border: 3px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.devise-form h2 {
  font-family: var(--font-brush);
  text-align: center;
  margin-bottom: 2rem;
  color: var(--gold);
  font-size: 2rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.devise-form .field {
  margin-bottom: 1.2rem;
}

.devise-form label {
  font-family: var(--font-main);
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: 1rem;
}

.devise-form .hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.devise-form input[type="email"],
.devise-form input[type="password"],
.devise-form input[type="text"] {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 2px solid var(--card-border);
  border-radius: 6px;
  background: linear-gradient(135deg, #f5f0e1, #e8e0c8);
  color: var(--text-dark);
  font-family: var(--font-main);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.devise-form input[type="email"]:focus,
.devise-form input[type="password"]:focus,
.devise-form input[type="text"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.3);
}

.devise-form input::placeholder {
  color: #999;
}

.devise-form .field.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.devise-form .field.checkbox input {
  width: auto;
}

.devise-form .field.checkbox label {
  display: inline;
  margin-bottom: 0;
}

.devise-form .actions {
  margin-top: 2rem;
  text-align: center;
}

.devise-form .actions .btn {
  padding-left: 1.2rem;
  padding-right: 1.2rem;
}

.devise-form .links {
  margin-top: 1.5rem;
  text-align: center;
}

.devise-form .links a {
  font-family: var(--font-main);
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.devise-form .links a:hover {
  color: var(--gold);
}

.devise-form #error_explanation {
  background: rgba(196,30,58,0.2);
  border: 2px solid var(--accent);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.devise-form #error_explanation h2 {
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.devise-form #error_explanation ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text);
}

.danger-zone {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(196,30,58,0.3);
}

.danger-zone h3 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.danger-zone p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.btn-danger {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-main);
}

.btn-danger:hover {
  background: #a01830;
}

/* PC・タブレット向けレスポンシブ */
@media (min-width: 768px) {
  /* Theme grid 2x2 on desktop */
  .theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 700px;
    margin: 0 auto 2rem;
  }

  .theme-card {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .hand {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    max-width: 860px;
    margin: 0 auto;
  }

  .hand .card {
    width: 160px;
    aspect-ratio: 5 / 7.2;
    padding: 0.6rem 0.4rem;
  }

  .hand .card .card-content {
    font-size: 1.1rem;
  }
}


/* Sound warning */
.sound-warning {
  text-align: center;
  color: #fff;
  font-size: 0.9rem;
  margin: 1.5rem auto 0;
  background: rgba(255, 100, 100, 0.85);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  display: block;
  width: fit-content;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Sound toggle button */
.sound-toggle {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: background 0.2s;
}

.sound-toggle:hover {
  background: var(--bg-color);
}

.sound-toggle svg {
  width: 24px;
  height: 24px;
  fill: var(--text);
}

.sound-toggle.muted svg.icon-sound-on,
.sound-toggle:not(.muted) svg.icon-sound-off {
  display: none;
}

.sound-toggle.muted svg.icon-sound-off,
.sound-toggle:not(.muted) svg.icon-sound-on {
  display: block;
}
