flowchart TD
START(["Player is on the Challenges area"])
START --> Q1{"Has the player<br/>finished the intro<br/>walkthrough before?"}
Q1 -->|"No — new player"| FIRST["Show the intro walkthrough automatically"]
Q1 -->|"Yes"| BROWSE["Player browses challenges normally"]
%% First-time walkthrough
FIRST --> W1["1. Welcome / how challenges work"]
W1 --> W2["2. Weekly challenges explained"]
W2 --> W3["3. Medals explained"]
W3 --> FORK{"Are group<br/>challenges turned<br/>on for this player?"}
FORK -->|"No"| SOLODONE["Final screen:<br/>ready to play solo"]
FORK -->|"Yes"| GINV["Invitation screen:<br/>join a group?"]
SOLODONE --> ENTER(["Player enters challenges"])
GINV -->|"Join a group"| PICK["Pick a group theme"]
GINV -->|"Skip for now"| SKIP["Enters challenges alone<br/>(can still join later)"]
PICK --> GCONF["Welcome to your group!"]
GCONF --> ENTER
%% Returning players
BROWSE --> ACT{"What does the<br/>player do?"}
ACT -->|"Taps Play on a game"| PLAYGATE{"Finished the<br/>walkthrough?"}
ACT -->|"Taps 'Join a group'<br/>(shown to solo players)"| JOINGATE{"Finished the<br/>walkthrough?"}
PLAYGATE -->|"Yes"| PLAY(["Game starts"])
PLAYGATE -->|"No"| FIRST2["Run the full walkthrough first,<br/>then drop them into the game they tapped"]
JOINGATE -->|"Yes"| MODAL["Quick join popup:<br/>pick theme → welcome"]
JOINGATE -->|"No"| FIRST3["Run the full walkthrough,<br/>ending on the group join step"]
SKIP --> ENTER