:root {
  --bg-color: #f7f9fa;
  --text-color: #222;
  --black: #111;
  --white: #fff;
  --border: #e5e7eb;
  --green: #4ade80;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Noto Sans JP', sans-serif; background-color: var(--bg-color); color: var(--text-color); line-height: 1.6; }

.top-nav { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background-color: var(--white); border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.breadcrumb a { text-decoration: none; color: var(--text-color); font-weight: bold; }
.breadcrumb .current { color: #666; }
.twin-link { text-decoration: none; color: var(--black); display: flex; align-items: center; gap: 5px; font-weight: bold; transition: color 0.3s; }
.twin-link:hover { color: var(--green); }

.header { text-align: center; padding: 40px 20px 20px; }
.logo-icon { font-size: 3rem; margin-bottom: 10px; }
.header h1 { font-size: 2.5rem; font-weight: 900; letter-spacing: 2px; margin-bottom: 15px; }
.catchphrase { font-size: 1.2rem; font-weight: bold; color: #444; margin-bottom: 20px; }
.desc { max-width: 600px; margin: 0 auto; font-size: 0.95rem; color: #666; }

main { max-width: 800px; margin: 0 auto; padding: 20px; }

.input-section { background: var(--white); padding: 30px; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.05); margin-bottom: 30px; }
.input-section h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.sub-desc { font-size: 0.85rem; color: #888; margin-bottom: 20px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; margin-bottom: 25px; }
.input-group label { display: block; font-size: 0.85rem; font-weight: bold; margin-bottom: 5px; color: #555; }
.input-group input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; text-align: center; text-transform: uppercase; transition: border-color 0.3s; }
.input-group input:focus { outline: none; border-color: var(--black); }

.reverse-btn { display: block; width: 100%; max-width: 300px; margin: 0 auto; background-color: var(--black); color: var(--white); border: none; padding: 15px; font-size: 1.1rem; font-weight: bold; border-radius: 30px; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 10px; transition: transform 0.2s, background-color 0.3s; }
.reverse-btn:hover { background-color: #333; transform: scale(1.02); }

.result-section { animation: fadeIn 0.5s ease; margin-bottom: 30px; }
.hidden { display: none !important; }

/* 画像保存されるエリアのデザイン */
.capture-area { background-color: var(--bg-color); padding: 30px 20px; border-radius: 12px; }
.block-title { display: flex; align-items: center; gap: 8px; margin-bottom: 15px; font-size: 1.2rem; font-weight: 900; border-bottom: 2px solid var(--border); padding-bottom: 5px;}

.reversi-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 15px; }

/* 👤 My Type 用の静的な白カード */
.static-card {
  background-color: var(--white);
  color: var(--black);
  border: 2px solid var(--black);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.static-card .card-title { font-size: 0.75rem; opacity: 0.8; margin-bottom: 5px; }
.static-card .card-value { font-size: 1.3rem; font-weight: bold; }

/* 🪞 Reverse 用のフリップカード */
.flip-card { background-color: transparent; width: 100%; height: 90px; perspective: 1000px; }
.flip-card-inner { position: relative; width: 100%; height: 100%; text-align: center; transition: transform 0.8s; transform-style: preserve-3d; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; border-radius: 12px; padding: 10px; }

.flip-card-front { background-color: var(--white); color: var(--black); border: 2px solid var(--black); }
.flip-card-back { background-color: var(--black); color: var(--white); transform: rotateY(180deg); border: 2px solid var(--black); }

.card-title { font-size: 0.75rem; opacity: 0.8; margin-bottom: 5px; }
.card-value { font-size: 1.3rem; font-weight: bold; }

/* 📸 キャプチャバグ(灰色・スケスケ)対策！確実に表面を消して裏面を平面化する */
.capture-mode .flip-card-inner { transform: none !important; transition: none !important; }
.capture-mode .flip-card.flipped .flip-card-front { display: none !important; }
.capture-mode .flip-card.flipped .flip-card-back { 
  transform: none !important; 
  position: relative !important; 
  display: flex !important; 
  backface-visibility: visible !important; 
  z-index: 10; 
}

.action-buttons { display: flex; gap: 15px; justify-content: center; margin-bottom: 30px; margin-top: 20px;}
.action-btn { background: var(--white); border: 2px solid var(--black); color: var(--black); padding: 10px 20px; border-radius: 8px; font-weight: bold; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.3s; }
.action-btn:hover { background: var(--black); color: var(--white); }

.explanation-box { background: var(--white); padding: 25px; border-radius: 12px; border-left: 5px solid var(--black); margin-bottom: 20px; }
.explanation-box h4 { display: flex; align-items: center; gap: 8px; margin-top: 20px; margin-bottom: 10px; }
.explanation-box h4:first-child { margin-top: 0; }
.explanation-box p { font-size: 0.95rem; color: #444; }

/* スマホ用保存モーダル */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); z-index: 9999; display: flex; justify-content: center; align-items: center; padding: 20px; opacity: 1; transition: opacity 0.3s; }
.modal-content { background: var(--white); border-radius: 12px; padding: 15px; width: 100%; max-width: 500px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.modal-header p { font-weight: bold; color: var(--black); display: flex; align-items: center; gap: 5px; margin: 0; }
.close-btn { font-size: 1.2rem; cursor: pointer; background: var(--border); border-radius: 50%; width: 32px; height: 32px; display: flex; justify-content: center; align-items: center; color: var(--black); transition: 0.2s; }
.close-btn:hover { background: #d1d5db; }
.modal-body { overflow-y: auto; border-radius: 8px; background: var(--bg-color); }
.modal-body img { width: 100%; height: auto; display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) { .header h1 { font-size: 2rem; } .form-grid { grid-template-columns: 1fr 1fr; } .action-buttons { flex-direction: column; } .action-btn { width: 100%; justify-content: center; } }
