/* Telephone Game — Light Pixel Style */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

.game-container {
  max-width: 640px;
  width: calc(100% - 48px);
  margin: 0 auto 40px;
  border-radius: 16px;
  border: 3px solid #222;
  background: #f0efe8;
  position: relative;
  overflow: hidden;
  box-shadow: 6px 6px 0 #d4d0c8;
}

@media (max-width: 768px) {
  .game-container {
    width: calc(100% - 24px);
    margin-left: 12px;
    margin-right: 12px;
    border-radius: 12px;
    box-shadow: 4px 4px 0 #d4d0c8;
  }
}

.game-mode {
  display: none;
  padding: 48px 28px;
}

.game-mode.active {
  display: block;
}

.game-mode-inner {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
  color: #222;
}

.game-mode-inner h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  color: #222;
  margin-bottom: 24px;
  line-height: 2;
}

.play-step {
  margin-top: 28px;
  animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.preview-row { margin-bottom: 20px; }

.btn-sm {
  padding: 12px 24px;
  font-size: 12px;
}

.chain-divider {
  border-top: 2px dashed #c4c0b8;
  margin: 28px 0 24px;
}

.chain-header { margin-bottom: 20px; }

.chain-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.game-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  line-height: 1;
}

.sub {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 32px;
}

.label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
  margin-bottom: 14px;
}

.hint {
  color: #777;
  font-size: 0.9rem;
  margin-top: 16px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.hint.listener-hint {
  color: #e85d45;
  font-size: 1.05rem;
  font-weight: 700;
  background: #fff5f3;
  border: 2px solid #f5c4bb;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
}

/* Phrase Card */
.phrase-card {
  background: #fff;
  border: 3px solid #222;
  border-radius: 12px;
  padding: 28px 24px;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.7;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  color: #222;
  box-shadow: 4px 4px 0 #d4d0c8;
}

.phrase-card.blurred {
  user-select: none;
  -webkit-user-select: none;
  border-color: #b0a8a0;
}

.phrase-card.blurred .blur-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  font-weight: 600;
  color: #b0a8a0;
  background: repeating-linear-gradient(
    45deg,
    #f0efe8 0px, #f0efe8 4px,
    #e8e6de 4px, #e8e6de 8px
  );
  padding: 24px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.phrase-card.reveal {
  background: #e8f9ec;
  border-color: #2d9f4a;
  color: #1a6b30;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 4px 4px 0 #b8e6c4;
  animation: revealPop 0.5s ease;
}

.phrase-card.revealing {
  animation: revealOut 0.4s ease forwards;
}

@keyframes revealOut {
  to { opacity: 0; transform: scale(0.95); }
}

@keyframes revealPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.chain-card.reveal-card {
  animation: cardUnlock 0.4s ease;
}

@keyframes cardUnlock {
  0% { transform: scale(0.97); opacity: 0.5; }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

/* Name Input */
.name-input-wrap { margin-bottom: 24px; }

.name-input-wrap input {
  width: 100%;
  max-width: 280px;
  padding: 14px 18px;
  border: 3px solid #222;
  border-radius: 12px;
  font-size: 1rem;
  text-align: center;
  background: #fff;
  color: #222;
  outline: none;
  box-shadow: 3px 3px 0 #d4d0c8;
  transition: border-color 0.15s;
}

.name-input-wrap input:focus {
  border-color: #e85d45;
}

.name-input-wrap input::placeholder {
  color: #bbb;
}

/* Buttons */
.btn-primary {
  display: inline-block;
  padding: 16px 36px;
  background: #e85d45;
  color: #fff;
  border: 3px solid #222;
  border-radius: 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.08s;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 #222;
  letter-spacing: 0.02em;
}

.btn-primary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #222;
}

.btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #222;
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: 4px 4px 0 #222;
}

.btn-secondary {
  display: inline-block;
  padding: 14px 28px;
  background: #fff;
  color: #222;
  border: 2px solid #222;
  border-radius: 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  cursor: pointer;
  transition: all 0.08s;
  box-shadow: 3px 3px 0 #d4d0c8;
}

.btn-secondary:hover {
  background: #f0efe8;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #d4d0c8;
}

.btn-danger {
  display: inline-block;
  padding: 16px 32px;
  background: #d93636;
  color: #fff;
  border: 3px solid #222;
  border-radius: 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  cursor: pointer;
  transition: all 0.08s;
  box-shadow: 4px 4px 0 #222;
  text-transform: uppercase;
}

.btn-danger:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #222;
}

.btn-danger:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #222;
}

.btn-danger:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* Listen Button */
.btn-listen {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 36px;
  background: #fff;
  color: #222;
  border: 3px solid #222;
  border-radius: 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.08s;
  box-shadow: 4px 4px 0 #d4d0c8;
}

.btn-listen:hover {
  background: #222;
  color: #fff;
}

.btn-listen:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-listen.played {
  border-color: #ccc;
  color: #aaa;
  box-shadow: 3px 3px 0 #e8e6de;
}

.listen-icon { font-size: 1.3rem; }

/* Listen Progress */
.listen-progress { margin-top: 24px; }

.listen-bar {
  width: 100%;
  height: 10px;
  background: #e8e6de;
  border: 2px solid #222;
  border-radius: 12px;
  overflow: hidden;
}

.listen-fill {
  width: 0%;
  height: 100%;
  background: #e85d45;
  transition: width 0.3s linear;
}

.listen-label {
  font-size: 0.8rem;
  color: #999;
  margin-top: 10px;
}

/* Record Visual */
.record-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 36px 0;
}

.record-dot {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e85d45;
  border: 3px solid #222;
  box-shadow: 4px 4px 0 #222;
  animation: pixelPulse 0.8s step-end infinite;
}

@keyframes pixelPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.record-timer {
  font-family: 'Press Start 2P', monospace;
  font-size: 24px;
  color: #e85d45;
}

/* Preview Actions */
.preview-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 28px;
}

/* Share */
.share-link-box {
  display: flex;
  gap: 0;
  margin: 16px 0;
  border: 3px solid #222;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 3px 3px 0 #d4d0c8;
}

.share-link-box input {
  flex: 1;
  padding: 14px 14px;
  border: none;
  font-family: monospace;
  font-size: 0.85rem;
  background: #fff;
  color: #222;
  outline: none;
  min-width: 0;
}

.btn-copy {
  padding: 14px 20px;
  background: #e85d45;
  color: #fff;
  border: none;
  border-left: 3px solid #222;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.1s;
  text-transform: uppercase;
}

.btn-copy:hover { opacity: 0.85; }

.btn-copy.copied {
  background: #2d9f4a;
  transition: background 0.2s;
}

/* Chain Cards */
.chain-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
}

.chain-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 12px;
  text-align: left;
}

.chain-card.result {
  border-color: #222;
  box-shadow: 2px 2px 0 #d4d0c8;
}

.card-round {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #e85d45;
  min-width: 40px;
}

.card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.card-name small {
  color: #e85d45;
  font-weight: 600;
  font-size: 0.8rem;
}

.card-time {
  font-size: 0.8rem;
  color: #aaa;
}

.card-audio {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #ccc;
  background: #f0efe8;
  color: #aaa;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.1s;
}

.card-audio.locked {
  cursor: pointer;
  opacity: 0.4;
}

.locked-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #fff;
  color: #222;
  padding: 14px 24px;
  border: 3px solid #222;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 999;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 4px 4px 0 #d4d0c8;
}

.locked-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.card-audio.playable {
  color: #222;
  border-color: #222;
  background: #fff;
  cursor: pointer;
}

.card-audio.playable:hover {
  background: #222;
  color: #fff;
}

.card-audio.playing {
  background: #e85d45;
  color: #fff;
  border-color: #e85d45;
}

.chain-card.listen-target {
  border-color: #e85d45;
  box-shadow: 2px 2px 0 #f5c4bb;
}

.card-audio.listen-once {
  border-color: #e85d45;
  color: #e85d45;
  background: #fff;
  animation: pulseBtn 1.5s ease-in-out infinite;
}

@keyframes pulseBtn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,93,69,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(232,93,69,0); }
}

.chain-card.your-turn {
  border-style: dashed;
  border-color: #ccc;
  opacity: 0.5;
}

.chain-card.mine {
  border-color: #e85d45;
  box-shadow: 2px 2px 0 #f5c4bb;
}

.chain-share { margin-top: 10px; }

.chain-card.card-enter {
  animation: cardSlideIn 0.5s ease;
}

@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chain-share.fade-in {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.share-prompt {
  color: #777;
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 14px 0 12px;
  text-align: center;
}

/* Watch Status */
.watch-status {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #e85d45;
  margin-bottom: 10px;
  line-height: 2;
}

#watch-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Result */
.result-phrase { margin-bottom: 10px; }

.result-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

#btn-play-all { margin-top: 20px; }

/* Telephone Hero */
.telephone-hero { padding: 72px 24px 24px; }
.telephone-hero .hero-title { font-size: 3rem; }

@media (max-width: 768px) {
  .telephone-hero { padding: 64px 18px 18px; }
  .telephone-hero .hero-title { font-size: 2.2rem; }
  .telephone-hero .hero-sub { font-size: 0.95rem; }
}

@media (max-width: 400px) {
  .telephone-hero { padding: 56px 14px 14px; }
  .telephone-hero .hero-title { font-size: 1.8rem; }
  .telephone-hero .hero-sub { font-size: 0.9rem; }
}

/* Responsive — Tablet */
@media (max-width: 768px) {
  .game-mode { padding: 24px 18px; }
  .game-mode-inner h2 { font-size: 14px; line-height: 1.8; }
  .phrase-card { padding: 22px 18px; font-size: 1.05rem; }
  .phrase-card.reveal { font-size: 1.1rem; }
  .btn-primary { padding: 14px 28px; font-size: 9px; }
  .btn-danger { padding: 14px 24px; font-size: 8px; }
  .btn-secondary { padding: 12px 20px; font-size: 8px; }
  .btn-listen { padding: 14px 24px; font-size: 9px; }
  .chain-card { padding: 14px 14px; gap: 10px; }
  .card-round { font-size: 9px; min-width: 32px; }
  .card-name { font-size: 0.9rem; }
  .card-time { font-size: 0.75rem; }
  .card-audio { width: 40px; height: 40px; font-size: 1rem; }
  .share-link-box { flex-direction: column; }
  .share-link-box input { padding: 12px 14px; font-size: 0.8rem; border-bottom: 3px solid #222; }
  .btn-copy { border-left: none; padding: 12px 16px; }
  .share-prompt { font-size: 0.85rem; }
  .play-step { margin-top: 18px; }
  .record-visual { margin: 20px 0; }
  .record-dot { width: 48px; height: 48px; }
  .record-timer { font-size: 20px; }
  .sub { font-size: 0.9rem; margin-bottom: 18px; }
  .hint { font-size: 0.85rem; }
  .game-icon { font-size: 3rem; margin-bottom: 10px; }
  .game-mode-inner h2 { margin-bottom: 16px; }
  .name-input-wrap input { max-width: 100%; }
  .locked-toast { font-size: 0.82rem; padding: 12px 18px; white-space: normal; max-width: 90vw; text-align: center; }
}

/* Responsive — Small Phone */
@media (max-width: 400px) {
  .game-mode { padding: 20px 12px; }
  .game-mode-inner h2 { font-size: 12px; }
  .phrase-card { padding: 18px 14px; font-size: 1rem; }
  .phrase-card.reveal { font-size: 1.05rem; }
  .phrase-card.blurred .blur-overlay { font-size: 9px; padding: 18px; }
  .btn-primary { padding: 12px 20px; font-size: 8px; box-shadow: 3px 3px 0 #222; }
  .btn-danger { padding: 12px 18px; box-shadow: 3px 3px 0 #222; }
  .btn-secondary { padding: 10px 16px; }
  .chain-card { padding: 12px 10px; gap: 8px; }
  .card-round { font-size: 8px; min-width: 28px; }
  .card-name { font-size: 0.85rem; }
  .card-audio { width: 36px; height: 36px; font-size: 0.9rem; }
  .game-icon { font-size: 2.8rem; }
  .chain-actions, .result-actions, .preview-actions, #watch-actions { flex-direction: column; align-items: stretch; }
  .chain-actions button, .result-actions button { width: 100%; }
}
