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

body {
  background: #1a6e3c;
  font-family: 'Segoe UI', sans-serif;
  color: #fff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
}

/* ========== START SCREEN ========== */
#start-screen {
  width: 100%;
  max-width: 420px;
  margin: 60px auto 0;
  text-align: center;
}

#start-box {
  background: rgba(0,0,0,0.35);
  border-radius: 16px;
  padding: 36px 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

#start-box h1 {
  font-size: 3rem;
  margin-bottom: 6px;
  text-shadow: 2px 2px 6px #000;
}

.start-subtitle {
  font-size: 1rem;
  opacity: 0.75;
  margin-bottom: 28px;
}

.section-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.7;
  margin-bottom: 10px;
}

/* ========== DIFFICULTY BUTTONS ========== */
.difficulty-group {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.diff-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.diff-btn:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.6);
}

.diff-btn.active {
  background: rgba(255,255,255,0.3);
  border-color: #ffe500;
  color: #ffe500;
}

.difficulty-group.small .diff-btn {
  padding: 4px 10px;
  font-size: 0.75rem;
}

/* ========== BUTTONS ========== */
.btn {
  padding: 12px 22px;
  border-radius: 8px;
  background: #ff6f00;
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}
.btn:hover { background: #e65100; }
.btn:disabled { background: #777; cursor: not-allowed; }

.primary-btn {
  background: #ff6f00;
  display: block;
  width: 100%;
  margin-bottom: 12px;
  font-size: 1.1rem;
  padding: 14px;
}
.primary-btn:hover { background: #e65100; }

.ghost-btn {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.4);
  color: #fff;
  display: block;
  width: 100%;
}
.ghost-btn:hover { background: rgba(255,255,255,0.1); }

.small-btn {
  padding: 5px 12px;
  font-size: 0.85rem;
  width: auto;
  display: inline-block;
}

/* ========== GAME SCREEN ========== */
#app {
  width: 100%;
  max-width: 700px;
  text-align: center;
}

h1 { font-size: 2.5rem; margin-bottom: 12px; text-shadow: 2px 2px 4px #000; }

.title-icon {
  height: 0.85em;
  width: auto;
  vertical-align: middle;
  margin-right: 4px;
  filter: drop-shadow(2px 2px 4px #000);
}

#turn-timer {
  font-size: 0.95rem;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.3);
  transition: color 0.3s;
}

#info {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 10px;
  font-size: 1rem;
}

#action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 8px;
  flex-wrap: wrap;
}

#action-bar .difficulty-group {
  margin-bottom: 0;
}

#pile-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
}

/* ========== CARDS ========== */
.card {
  width: 80px;
  height: 110px;
  border-radius: 10px;
  cursor: pointer;
  border: 3px solid #fff;
  transition: transform 0.15s;
  user-select: none;
  background-color: #fff;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: 2px 4px 8px rgba(0,0,0,0.4);
  position: relative;
}

.card:hover { transform: scale(1.08); }

.card.circle   { background-image: url('resources/circle.png'); }
.card.triangle { background-image: url('resources/triangle.png'); }
.card.cross    { background-image: url('resources/cross.png'); }
.card.square   { background-image: url('resources/square.png'); }
.card.star     { background-image: url('resources/star.png'); }
.card.whot     { background-image: url('resources/whot.png'); }

.card.playable { border-color: #ffe500; box-shadow: 0 0 12px #ffe500; }

.card-corner {
  position: absolute;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
  color: #111;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
}

.card-corner.top-left {
  top: 4px;
  left: 5px;
}

.card-corner.bottom-right {
  bottom: 4px;
  right: 5px;
  transform: rotate(180deg);
}

.card.whot .card-corner {
  color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
}

.card-called {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.6rem;
  font-weight: bold;
  color: #1565c0;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff;
  pointer-events: none;
}

/* ========== HAND ========== */
.hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 130px;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

#message {
  font-size: 1.2rem;
  min-height: 1.5rem;
  margin-bottom: 10px;
  color: #ffe500;
  font-weight: bold;
}

#call-no-area {
  background: rgba(0,0,0,0.5);
  padding: 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}

#call-no-btns { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

#turn-label {
  font-weight: bold;
  color: #ffe500;
}

#diff-badge {
  font-size: 0.85rem;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
}

#end-actions {
  margin-top: 8px;
}

/* ========== RULES MODAL ========== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 30px 16px;
  z-index: 1000;
  overflow-y: auto;
}

.modal-box {
  background: #1a6e3c;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 14px;
  padding: 28px 28px 24px;
  max-width: 520px;
  width: 100%;
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  color: #fff;
  text-align: left;
}

.modal-box h2 {
  font-size: 1.5rem;
  margin-bottom: 18px;
  text-align: center;
  text-shadow: 1px 1px 4px #000;
}

.modal-box h3 {
  font-size: 1rem;
  color: #ffe500;
  margin: 16px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-box p,
.modal-box li {
  font-size: 0.95rem;
  line-height: 1.55;
  opacity: 0.92;
}

.modal-box ul {
  padding-left: 18px;
}

.modal-box li {
  margin-bottom: 6px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  font-weight: bold;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close:hover { background: rgba(255,255,255,0.3); }
